mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 15:26:39 +00:00
[Forms] Add test cases to DateTimeController
Add test cases for behavioral changes to DateTimeController, added for WTD-1221.
This commit is contained in:
parent
45568ecb21
commit
28805cd55c
@ -57,6 +57,33 @@ define(
|
||||
expect(mockScope.ngModel.test).toEqual(1417215313000);
|
||||
});
|
||||
|
||||
it("reports when form input is partially complete", function () {
|
||||
// This is needed to flag the control's state as invalid
|
||||
// when it is partially complete without having it treated
|
||||
// as required.
|
||||
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.partiallyComplete).toBeTruthy();
|
||||
});
|
||||
|
||||
it("reports 'undefined' for empty input", function () {
|
||||
mockScope.ngModel = { test: 12345 };
|
||||
mockScope.field = "test";
|
||||
mockScope.$watch.mostRecentCall.args[1]();
|
||||
// Clear all inputs
|
||||
mockScope.datetime = {};
|
||||
mockScope.$watch.mostRecentCall.args[1]();
|
||||
|
||||
// Should have cleared out the time stamp
|
||||
expect(mockScope.ngModel.test).toBeUndefined();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user