[Forms] Add test for date-time controller

Add test case to complete coverage of date-time controller;
done in the context of WTD-884 (albeit unrelated) to improve
code coverage.
This commit is contained in:
Victor Woeltjen 2015-06-10 14:31:34 -07:00
parent d7e43026cd
commit fd63aa30ea

View File

@ -84,6 +84,22 @@ define(
// Should have cleared out the time stamp
expect(mockScope.ngModel.test).toBeUndefined();
});
it("initializes form fields with values from ng-model", function () {
mockScope.ngModel = { test: 1417215313000 };
mockScope.field = "test";
mockScope.$watch.calls.forEach(function (call) {
if (call.args[0] === 'ngModel[field]') {
call.args[1](mockScope.ngModel.test);
}
});
expect(mockScope.datetime).toEqual({
date: "2014-332",
hour: "22",
min: "55",
sec: "13"
});
});
});
}
);
);