mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 18:57:01 +00:00
[Pages] Test controller
Test controller for WTD-1145.
This commit is contained in:
parent
012fad6984
commit
cab259415d
@ -5,7 +5,7 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Controller($sce) {
|
||||
function EmbeddedPageController($sce) {
|
||||
return {
|
||||
trust: function (url) {
|
||||
return $sce.trustAsResourceUrl(url);
|
||||
@ -13,7 +13,7 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
return Controller;
|
||||
return EmbeddedPageController;
|
||||
}
|
||||
|
||||
);
|
37
platform/features/pages/test/EmbeddedPageControllerSpec.js
Normal file
37
platform/features/pages/test/EmbeddedPageControllerSpec.js
Normal file
@ -0,0 +1,37 @@
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../src/EmbeddedPageController"],
|
||||
function (EmbeddedPageController) {
|
||||
"use strict";
|
||||
|
||||
describe("The controller for embedded pages", function () {
|
||||
var mockSCE,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockSCE = jasmine.createSpyObj(
|
||||
'$sce',
|
||||
["trustAsResourceUrl"]
|
||||
);
|
||||
|
||||
mockSCE.trustAsResourceUrl.andCallFake(function (v) {
|
||||
return v;
|
||||
});
|
||||
|
||||
controller = new EmbeddedPageController(mockSCE)
|
||||
});
|
||||
|
||||
it("allows URLs to be marked as trusted", function () {
|
||||
var testURL = "http://www.nasa.gov";
|
||||
|
||||
expect(controller.trust(testURL))
|
||||
.toEqual(testURL);
|
||||
|
||||
expect(mockSCE.trustAsResourceUrl)
|
||||
.toHaveBeenCalledWith(testURL);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
3
platform/features/pages/test/suite.json
Normal file
3
platform/features/pages/test/suite.json
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
"EmbeddedPageController"
|
||||
]
|
Loading…
Reference in New Issue
Block a user