12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 'use babel';
- import Qsp from '../lib/qsp';
- describe('Qsp', () => {
- let workspaceElement, activationPromise;
- beforeEach(() => {
- workspaceElement = atom.views.getView(atom.workspace);
- activationPromise = atom.packages.activatePackage('qsp');
- });
- describe('when the qsp:toggle event is triggered', () => {
- it('hides and shows the modal panel', () => {
-
-
- expect(workspaceElement.querySelector('.qsrc')).not.toExist();
-
-
- atom.commands.dispatch(workspaceElement, 'qsp:toggle');
- waitsForPromise(() => {
- return activationPromise;
- });
- runs(() => {
- expect(workspaceElement.querySelector('.qsrc')).toExist();
- let qspElement = workspaceElement.querySelector('.qsrc');
- expect(qspElement).toExist();
- let qspPanel = atom.workspace.panelForItem(qspElement);
- expect(qspPanel.isVisible()).toBe(true);
- atom.commands.dispatch(workspaceElement, 'qsp:toggle');
- expect(qspPanel.isVisible()).toBe(false);
- });
- });
- it('hides and shows the view', () => {
-
-
-
-
-
- jasmine.attachToDOM(workspaceElement);
- expect(workspaceElement.querySelector('.qsrc')).not.toExist();
-
-
- atom.commands.dispatch(workspaceElement, 'qsp:toggle');
- waitsForPromise(() => {
- return activationPromise;
- });
- runs(() => {
-
- let qspElement = workspaceElement.querySelector('.qsrc');
- expect(qspElement).toBeVisible();
- atom.commands.dispatch(workspaceElement, 'qsp:toggle');
- expect(qspElement).not.toBeVisible();
- });
- });
- });
- });
|