From 327ee33facefd20fe120c38d33646ca052af282d Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Fri, 5 Jan 2018 15:25:13 -0600 Subject: [PATCH] move test --- spec/command-registry-spec.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/spec/command-registry-spec.js b/spec/command-registry-spec.js index ab8007040..bc7d25dee 100644 --- a/spec/command-registry-spec.js +++ b/spec/command-registry-spec.js @@ -210,20 +210,6 @@ describe("CommandRegistry", () => { expect(sequence[0][1].constructor).toBe(CustomEvent); expect(sequence[0][1].target).toBe(grandchild); }); - - it("returns a promise", () => { - const calls = []; - registry.add('.grandchild', 'command', () => 'grandchild'); - registry.add(child, 'command', () => 'child-inline'); - registry.add('.child', 'command', () => 'child'); - registry.add('.parent', 'command', () => 'parent'); - - waitsForPromise(() => grandchild.dispatchEvent(new CustomEvent('command', {bubbles: true})).then(args => { calls = args; })); - - runs(() => { - expect(calls).toEqual(['grandchild', 'child-inline', 'child', 'parent']); - }); - }); }); describe("::add(selector, commandName, callback)", () => { @@ -371,12 +357,12 @@ describe("CommandRegistry", () => { expect(called).toBe(true); }); - it("returns a boolean indicating whether any listeners matched the command", () => { + it("returns a promise if any listeners matched the command", () => { registry.add('.grandchild', 'command', () => {}); - expect(registry.dispatch(grandchild, 'command')).toBe(true); - expect(registry.dispatch(grandchild, 'bogus')).toBe(false); - expect(registry.dispatch(parent, 'command')).toBe(false); + expect(registry.dispatch(grandchild, 'command').constructor.name).toBe("Promise"); + expect(registry.dispatch(grandchild, 'bogus')).toBe(null); + expect(registry.dispatch(parent, 'command')).toBe(null); }); });