mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
[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.
This commit is contained in:
parent
5ae58644d9
commit
9d84bbca5c
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user