mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 22:17:49 +00:00
1bfc21270b
Fill in specs for scripts which support the mct-form and mct-control directives. WTD-530.
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
|
|
|
define(
|
|
["../../src/controllers/DateTimeController"],
|
|
function (DateTimeController) {
|
|
"use strict";
|
|
|
|
describe("The date-time directive", function () {
|
|
var mockScope,
|
|
controller;
|
|
|
|
beforeEach(function () {
|
|
mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]);
|
|
controller = new DateTimeController(mockScope);
|
|
});
|
|
|
|
it("watches for changes in fields", function () {
|
|
["date", "hour", "min", "sec"].forEach(function (fieldName) {
|
|
expect(mockScope.$watch).toHaveBeenCalledWith(
|
|
"datetime." + fieldName,
|
|
jasmine.any(Function)
|
|
);
|
|
});
|
|
});
|
|
|
|
it("converts date-time input into a timestamp", function () {
|
|
mockScope.ngModel = {};
|
|
mockScope.field = "test";
|
|
mockScope.datetime.date = "2014-332";
|
|
mockScope.datetime.hour = 22;
|
|
mockScope.datetime.min = 55;
|
|
mockScope.datetime.sec = 13;
|
|
|
|
mockScope.$watch.mostRecentCall.args[1]();
|
|
|
|
expect(mockScope.ngModel.test).toEqual(1417215313000);
|
|
});
|
|
|
|
});
|
|
}
|
|
); |