Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit a49ce8e

Browse files
bgrohmanwesleycho
authored andcommittedDec 14, 2015
test(datepicker): test that changing time updates model
- Add unit test for changing the time and verifying that the model updates Closes #5073
1 parent e6474f0 commit a49ce8e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

Diff for: ‎src/datepicker/test/datepicker.spec.js

+18
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,24 @@ describe('datepicker', function() {
18341834
expect(inputEl.val()).toBe('10-January-1983');
18351835
});
18361836
});
1837+
1838+
describe('custom format with time', function() {
1839+
beforeEach(inject(function() {
1840+
var wrapElement = $compile('<div><input type="text" ng-model="date" uib-datepicker-popup="MMM-d-yyyy h:mm a" is-open="false"><div>')($rootScope);
1841+
$rootScope.$digest();
1842+
assignElements(wrapElement);
1843+
}));
1844+
1845+
it('updates the model correctly when the input value changes', function() {
1846+
$rootScope.date = new Date(2015, 10, 24, 10, 0);
1847+
$rootScope.$digest();
1848+
expect(inputEl.val()).toBe('Nov-24-2015 10:00 AM');
1849+
1850+
inputEl.val('Nov-24-2015 11:00 AM').trigger('input');
1851+
$rootScope.$digest();
1852+
expect($rootScope.date).toEqual(new Date(2015, 10, 24, 11, 0));
1853+
});
1854+
});
18371855

18381856
describe('dynamic custom format', function() {
18391857
beforeEach(inject(function() {

0 commit comments

Comments
 (0)