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