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 () {
|
||||
var testControls,
|
||||
mockScope,
|
||||
mockLinker,
|
||||
mockChangeTemplate,
|
||||
mctControl;
|
||||
|
||||
beforeEach(function () {
|
||||
@ -46,8 +48,11 @@ define(
|
||||
];
|
||||
|
||||
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 () {
|
||||
@ -66,14 +71,16 @@ define(
|
||||
it("changes its template dynamically", function () {
|
||||
mctControl.link(mockScope);
|
||||
|
||||
expect(mockChangeTemplate)
|
||||
.not.toHaveBeenCalledWith(testControls[1]);
|
||||
|
||||
mockScope.key = "xyz";
|
||||
mockScope.$watch.mostRecentCall.args[1]("xyz");
|
||||
|
||||
// Should have communicated the template path to
|
||||
// ng-include via the "inclusion" field in scope
|
||||
expect(mockScope.inclusion).toEqual(
|
||||
"x/y/z/template.html"
|
||||
);
|
||||
expect(mockChangeTemplate)
|
||||
.toHaveBeenCalledWith(testControls[1]);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user