Skip to content

Commit db6b391

Browse files
Fix tests for moduleJS
- Add moduleJS import to karma.config - Adabt tests to new dateformat implementation. The dateformat 'DD-MM-YYYY' resolves now for example into '01-01-2016' instead of '01/01/2016'.
1 parent aee6372 commit db6b391

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

karma.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ module.exports = function(config) {
3939
'node_modules/zone.js/dist/async-test.js',
4040
'node_modules/zone.js/dist/fake-async-test.js',
4141

42+
// MomentJs for dates
43+
'node_modules/moment/moment.js',
44+
4245
// RxJs
4346
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
4447
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },

src/datepicker.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,21 @@ describe('DatepickerComponent', () => {
9898
const day = new Date(2016, 3, 15);
9999
comp.dateFormat = 'YYYY-MM-DD';
100100
comp.setInputText(day);
101-
expect(comp.inputText).toEqual('2016/04/15');
101+
expect(comp.inputText).toEqual('2016-04-15');
102102
});
103103

104104
it('sets correct inputText when dateFormat equals "MM-DD-YYYY"', () => {
105105
const day = new Date(2016, 3, 15);
106106
comp.dateFormat = 'MM-DD-YYYY';
107107
comp.setInputText(day);
108-
expect(comp.inputText).toEqual('04/15/2016');
108+
expect(comp.inputText).toEqual('04-15-2016');
109109
});
110110

111111
it('sets correct inputText when dateFormat equals "DD-MM-YYYY"', () => {
112112
const day = new Date(2016, 3, 15);
113113
comp.dateFormat = 'DD-MM-YYYY';
114114
comp.setInputText(day);
115-
expect(comp.inputText).toEqual('15/04/2016');
115+
expect(comp.inputText).toEqual('15-04-2016');
116116
});
117117

118118
it('sets correct inputText when dateFormat is a custom function', () => {

0 commit comments

Comments
 (0)