From f70fca081e961a997d5b8da6a12e678f207c067d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 16:33:30 -0800 Subject: [PATCH] [Framework] Add specs for built-in extension for run Add tests for a built-in extension type to framework to allow app.run to be invoked via bundle extensions. This supports stylesheet injection, which should happen on load but isn't triggered from any particular part of the page. WTD-591. --- .../framework/test/register/CustomRegistrarsSpec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/framework/test/register/CustomRegistrarsSpec.js b/platform/framework/test/register/CustomRegistrarsSpec.js index d70b7d4f2e..106253ca6c 100644 --- a/platform/framework/test/register/CustomRegistrarsSpec.js +++ b/platform/framework/test/register/CustomRegistrarsSpec.js @@ -20,7 +20,8 @@ define( "directive", "service", "constant", - "config" + "config", + "run" ]); mockLog = jasmine.createSpyObj("$log", [ @@ -39,6 +40,7 @@ define( expect(customRegistrars.services).toBeTruthy(); expect(customRegistrars.routes).toBeTruthy(); expect(customRegistrars.constants).toBeTruthy(); + expect(customRegistrars.runs).toBeTruthy(); }); it("invokes built-in functions on the app", function () { @@ -58,6 +60,11 @@ define( expect(mockApp.constant.calls.length).toEqual(0); customRegistrars.constants([{ key: "a", value: "b" }, { key: "b", value: "c" }, { key: "c", value: "d" }]); expect(mockApp.constant.calls.length).toEqual(3); + + expect(mockApp.run.calls.length).toEqual(0); + customRegistrars.runs([jasmine.createSpy("a"), jasmine.createSpy("a"), jasmine.createSpy("a")]); + expect(mockApp.run.calls.length).toEqual(3); + }); it("warns when keys are not defined, then skips", function () { @@ -81,6 +88,8 @@ define( customRegistrars.constants([{ }, { }, { }]); expect(mockApp.constant.calls.length).toEqual(0); expect(mockLog.warn.calls.length).toEqual(9); + + // Notably, keys are not needed for run calls }); it("allows routes to be registered", function () {