mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
[Representation] Trust template URLs
Trust resource URLs to skip SCE-checking (which profiling flags as a performance problem) for mct-include and mct-representation; these URLs are pulled from bundles and not user-entered, so should be trusted. WTD-1256.
This commit is contained in:
@ -31,6 +31,7 @@ define(
|
||||
|
||||
describe("The mct-include directive", function () {
|
||||
var testTemplates,
|
||||
mockSce,
|
||||
mctInclude;
|
||||
|
||||
beforeEach(function () {
|
||||
@ -46,7 +47,14 @@ define(
|
||||
templateUrl: "z/template.html"
|
||||
}
|
||||
];
|
||||
mctInclude = new MCTInclude(testTemplates);
|
||||
mockSce = jasmine.createSpyObj(
|
||||
'$sce',
|
||||
['trustAsResourceUrl']
|
||||
);
|
||||
mockSce.trustAsResourceUrl.andCallFake(function (url) {
|
||||
return url;
|
||||
});
|
||||
mctInclude = new MCTInclude(testTemplates, mockSce);
|
||||
});
|
||||
|
||||
it("has a built-in template, with ng-include src=inclusion", function () {
|
||||
@ -69,6 +77,12 @@ define(
|
||||
expect(scope.inclusion).toEqual("x/y/z/template.html");
|
||||
});
|
||||
|
||||
it("trusts template URLs", function () {
|
||||
mctInclude.controller({ key: "xyz" });
|
||||
expect(mockSce.trustAsResourceUrl)
|
||||
.toHaveBeenCalledWith("x/y/z/template.html");
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
Reference in New Issue
Block a user