mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 23:20: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
|
// Test implementation, to load from the mock loader
|
||||||
function Constructor() { return { someKey: "some value" }; }
|
function Constructor() { return { someKey: "some value" }; }
|
||||||
|
Constructor.someProperty = "some static value";
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockLoader = jasmine.createSpyObj("loader", ["load"]);
|
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…
x
Reference in New Issue
Block a user