mirror of
https://github.com/nasa/openmct.git
synced 2025-05-03 09:12:51 +00:00
[Templates] Update mct-control spec
...to reflect usage of templateLinker, to support including templates via RequireJS text plugin
This commit is contained in:
parent
3a6e0be2d7
commit
7240ff4f8d
@ -29,6 +29,8 @@ define(
|
|||||||
describe("The mct-control directive", function () {
|
describe("The mct-control directive", function () {
|
||||||
var testControls,
|
var testControls,
|
||||||
mockScope,
|
mockScope,
|
||||||
|
mockLinker,
|
||||||
|
mockChangeTemplate,
|
||||||
mctControl;
|
mctControl;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@ -46,8 +48,11 @@ define(
|
|||||||
];
|
];
|
||||||
|
|
||||||
mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]);
|
mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]);
|
||||||
|
mockLinker = jasmine.createSpyObj("templateLinker", ["link"]);
|
||||||
|
mockChangeTemplate = jasmine.createSpy('changeTemplate');
|
||||||
|
mockLinker.link.andReturn(mockChangeTemplate);
|
||||||
|
|
||||||
mctControl = new MCTControl(testControls);
|
mctControl = new MCTControl(mockLinker, testControls);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("is restricted to the element level", function () {
|
it("is restricted to the element level", function () {
|
||||||
@ -66,14 +71,16 @@ define(
|
|||||||
it("changes its template dynamically", function () {
|
it("changes its template dynamically", function () {
|
||||||
mctControl.link(mockScope);
|
mctControl.link(mockScope);
|
||||||
|
|
||||||
|
expect(mockChangeTemplate)
|
||||||
|
.not.toHaveBeenCalledWith(testControls[1]);
|
||||||
|
|
||||||
mockScope.key = "xyz";
|
mockScope.key = "xyz";
|
||||||
mockScope.$watch.mostRecentCall.args[1]("xyz");
|
mockScope.$watch.mostRecentCall.args[1]("xyz");
|
||||||
|
|
||||||
// Should have communicated the template path to
|
// Should have communicated the template path to
|
||||||
// ng-include via the "inclusion" field in scope
|
// ng-include via the "inclusion" field in scope
|
||||||
expect(mockScope.inclusion).toEqual(
|
expect(mockChangeTemplate)
|
||||||
"x/y/z/template.html"
|
.toHaveBeenCalledWith(testControls[1]);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user