From 9d84bbca5cc6a6051cc9ac2db12c4874454b4075 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu, 20 Nov 2014 10:56:21 -0800 Subject: [PATCH] [Framework] Add property retention spec Add spec to verify that static properties continue to be exposed on extension implementations after they have been loaded. WTD-572. --- .../test/resolve/ExtensionResolverSpec.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/platform/framework/test/resolve/ExtensionResolverSpec.js b/platform/framework/test/resolve/ExtensionResolverSpec.js index 0140133cb3..0ccbf97dbe 100644 --- a/platform/framework/test/resolve/ExtensionResolverSpec.js +++ b/platform/framework/test/resolve/ExtensionResolverSpec.js @@ -15,6 +15,7 @@ define( // Test implementation, to load from the mock loader function Constructor() { return { someKey: "some value" }; } + Constructor.someProperty = "some static value"; beforeEach(function () { mockLoader = jasmine.createSpyObj("loader", ["load"]); @@ -86,6 +87,33 @@ define( }); }); + it("ensures implementation properties are exposed", function () { + var bundle = new Bundle("w", { + sources: "x", + extensions: { tests: [ { implementation: "y/z.js" } ] } + }), + extension = bundle.getExtensions("tests")[0], + result; + + resolver.resolve(extension).then(function (v) { result = v; }); + + waitsFor( + function () { return result !== undefined; }, + "promise resolution", + 250 + ); + + runs(function () { + // Verify that the right file was requested + expect(mockLoader.load).toHaveBeenCalledWith("w/x/y/z.js"); + + // We should have resolved to the constructor from above + expect(typeof result).toEqual('function'); + expect(result().someKey).toEqual("some value"); + expect(result.someProperty).toEqual("some static value"); + }); + }); + }); }