about-spec.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. describe('About', () => {
  2. let workspaceElement;
  3. beforeEach(async () => {
  4. workspaceElement = atom.views.getView(atom.workspace);
  5. await atom.packages.activatePackage('about');
  6. });
  7. it('deserializes correctly', () => {
  8. let deserializedAboutView = atom.deserializers.deserialize({
  9. deserializer: 'AboutView',
  10. uri: 'atom://about'
  11. });
  12. expect(deserializedAboutView).toBeTruthy();
  13. });
  14. describe('when the about:about-atom command is triggered', () => {
  15. it('shows the About Pulsar view', async () => {
  16. // Attaching the workspaceElement to the DOM is required to allow the
  17. // `toBeVisible()` matchers to work. Anything testing visibility or focus
  18. // requires that the workspaceElement is on the DOM. Tests that attach the
  19. // workspaceElement to the DOM are generally slower than those off DOM.
  20. jasmine.attachToDOM(workspaceElement);
  21. expect(workspaceElement.querySelector('.about')).not.toExist();
  22. await atom.workspace.open('atom://about');
  23. let aboutElement = workspaceElement.querySelector('.about');
  24. expect(aboutElement).toBeVisible();
  25. });
  26. });
  27. describe('when the Pulsar version number is clicked', () => {
  28. it('copies the version number to the clipboard', async () => {
  29. await atom.workspace.open('atom://about');
  30. jasmine.attachToDOM(workspaceElement);
  31. let aboutElement = workspaceElement.querySelector('.about');
  32. let versionContainer = aboutElement.querySelector('.atom');
  33. versionContainer.click();
  34. expect(atom.clipboard.read()).toBe(atom.getVersion());
  35. });
  36. });
  37. describe('when the show more link is clicked', () => {
  38. it('expands to show additional version numbers', async () => {
  39. await atom.workspace.open('atom://about');
  40. jasmine.attachToDOM(workspaceElement);
  41. let aboutElement = workspaceElement.querySelector('.about');
  42. let showMoreElement = aboutElement.querySelector('.show-more-expand');
  43. let moreInfoElement = workspaceElement.querySelector('.show-more');
  44. showMoreElement.click();
  45. expect(moreInfoElement).toBeVisible();
  46. });
  47. });
  48. describe('when the Electron version number is clicked', () => {
  49. it('copies the version number to the clipboard', async () => {
  50. await atom.workspace.open('atom://about');
  51. jasmine.attachToDOM(workspaceElement);
  52. let aboutElement = workspaceElement.querySelector('.about');
  53. let versionContainer = aboutElement.querySelector('.electron');
  54. versionContainer.click();
  55. expect(atom.clipboard.read()).toBe(process.versions.electron);
  56. });
  57. });
  58. describe('when the Chrome version number is clicked', () => {
  59. it('copies the version number to the clipboard', async () => {
  60. await atom.workspace.open('atom://about');
  61. jasmine.attachToDOM(workspaceElement);
  62. let aboutElement = workspaceElement.querySelector('.about');
  63. let versionContainer = aboutElement.querySelector('.chrome');
  64. versionContainer.click();
  65. expect(atom.clipboard.read()).toBe(process.versions.chrome);
  66. });
  67. });
  68. describe('when the Node version number is clicked', () => {
  69. it('copies the version number to the clipboard', async () => {
  70. await atom.workspace.open('atom://about');
  71. jasmine.attachToDOM(workspaceElement);
  72. let aboutElement = workspaceElement.querySelector('.about');
  73. let versionContainer = aboutElement.querySelector('.node');
  74. versionContainer.click();
  75. expect(atom.clipboard.read()).toBe(process.version);
  76. });
  77. });
  78. describe('check for update appears', () => {
  79. it('when "pulsar-updater" is enabled', async () => {
  80. atom.packages.activatePackage('pulsar-updater');
  81. await atom.workspace.open('atom://about');
  82. jasmine.attachToDOM(workspaceElement);
  83. let aboutElement = workspaceElement.querySelector('.about');
  84. let updateContainer = aboutElement.querySelector('.about-update-action-button');
  85. expect(updateContainer.innerText).toBe('Check Now');
  86. });
  87. });
  88. });