Skip to content

Commit ca88740

Browse files
authoredNov 30, 2018
Next (#441)
* fixing tests * adding info to CONTRIBUTING.md * Reset selection when model is falsy fix #127 (#436) * ng 7 update * fixing unit tests + travis fix * fixing e2e * fixing more e2e * fixing more e2e
1 parent f11657a commit ca88740

21 files changed

+7091
-4434
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ before_install:
2929

3030
before_script:
3131
- npm run lint
32-
- npm test -- -watch=false
32+
- npm test -- --watch=false
3333
- npm run e2e
3434

3535
script:

‎CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
<a name="2.11.0"></a>
5+
# [2.11.0] (2018-11-27)
6+
### Improvements
7+
- Angular 7 upgrade ([???](https://github.com/vlio20/angular-datepicker/commit/???)) closes [#434](https://github.com/vlio20/angular-datepicker/issues/434)
8+
49
<a name="2.10.2"></a>
510
# [2.10.2] (2018-08-08)
611
### Bug Fixes

‎e2e/app.po.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -158,26 +158,26 @@ export class DemoPage {
158158
}
159159

160160
clickOnBody() {
161-
this.emptyElem.click();
161+
return this.emptyElem.click();
162162
}
163163

164164
scrollIntoView(el, top = false) {
165-
browser.executeScript(`arguments[0].scrollIntoView(${top})`, el.getWebElement());
165+
return browser.executeScript(`arguments[0].scrollIntoView(${top})`, el.getWebElement());
166166
}
167167

168168
clickOnDayButton(text: string) {
169-
element(by.cssContainingText(`${this.popupSelector} .dp-calendar-day`, text)).click();
169+
return element(by.cssContainingText(`${this.popupSelector} .dp-calendar-day`, text)).click();
170170
}
171171

172172
clickOnDayButtonInline(text: string) {
173-
element(by.cssContainingText(`.dp-inline-day .dp-calendar-day`, text)).click();
173+
return element(by.cssContainingText(`.dp-inline-day .dp-calendar-day`, text)).click();
174174
}
175175

176176
clickOnMonthButton(text: string) {
177-
element(by.cssContainingText(`${this.popupSelector} .dp-calendar-month`, text)).click();
177+
return element(by.cssContainingText(`${this.popupSelector} .dp-calendar-month`, text)).click();
178178
}
179179

180180
clickOnMonthButtonInline(text: string) {
181-
element(by.cssContainingText(`.dp-inline-month .dp-calendar-month`, text)).click();
181+
return element(by.cssContainingText(`.dp-inline-month .dp-calendar-month`, text)).click();
182182
}
183183
}

‎e2e/configuration-e2e.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ describe('dpDayPicker configuration', () => {
1010
page.daytimePickerMenu.click();
1111
});
1212

13-
it('openOnClick = false, should not open picker when clicked', () => {
13+
it('openOnClick = false, should not open picker when clicked', async () => {
1414
page.openOnClickRadioOff.click();
1515
page.openOnFocusRadioOff.click();
1616
page.daytimePickerInput.click();
17-
expect(page.datePickerPopup.isDisplayed()).toBe(false);
17+
expect(await page.datePickerPopup.isDisplayed()).toBe(false);
1818
});
1919

20-
it('openOnClick = true, should open picker when clicked', () => {
20+
it('openOnClick = true, should open picker when clicked', async () => {
2121
page.openOnClickRadioOn.click();
2222
page.openOnFocusRadioOff.click();
2323
page.daytimePickerInput.click();
24-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
24+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
2525
});
2626
});

‎e2e/current-btn-e2e.spec.ts

+48-48
Original file line numberDiff line numberDiff line change
@@ -11,69 +11,69 @@ describe('dpDayPicker dayPicker', () => {
1111
page.navigateTo();
1212
});
1313

14-
it('should check if go to current location btn is working as expected', () => {
14+
it('should check if go to current location btn is working as expected', async () => {
1515
const currentMonth = moment().format('MMM, YYYY');
1616
const currentYear = moment().format('YYYY');
1717
const prevMonth = moment().subtract(1, 'month').format('MMM, YYYY');
1818
const prevYear = moment().subtract(1, 'year').format('YYYY');
1919

20-
const commonDayCalendar = (menu: ElementFinder, input: ElementFinder) => {
21-
menu.click();
22-
page.showGoToCurrentRadio.click();
23-
input.click();
24-
expect(page.currentLocationBtn.isPresent()).toBe(true);
25-
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth);
26-
page.dayCalendarLeftNavBtn.click();
27-
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(prevMonth);
28-
page.currentLocationBtn.click();
29-
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth);
30-
page.dayCalendarNavHeaderBtn.click();
31-
expect(page.dayCalendarNavMonthHeaderBtn.getText()).toEqual(currentYear);
32-
page.monthCalendarLeftNavBtn.click();
33-
expect(page.dayCalendarNavMonthHeaderBtn.getText()).toEqual(prevYear);
34-
page.dayCalendarNavMonthHeaderBtn.click();
20+
const commonDayCalendar = async (menu: ElementFinder, input: ElementFinder) => {
21+
await menu.click();
22+
await page.showGoToCurrentRadio.click();
23+
await input.click();
24+
expect(await page.currentLocationBtn.isPresent()).toBe(true);
25+
expect(await page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth);
26+
await page.dayCalendarLeftNavBtn.click();
27+
expect(await page.dayCalendarNavHeaderBtn.getText()).toEqual(prevMonth);
28+
await page.currentLocationBtn.click();
29+
expect(await page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth);
30+
await page.dayCalendarNavHeaderBtn.click();
31+
expect(await page.dayCalendarNavMonthHeaderBtn.getText()).toEqual(currentYear);
32+
await page.monthCalendarLeftNavBtn.click();
33+
expect(await page.dayCalendarNavMonthHeaderBtn.getText()).toEqual(prevYear);
34+
await page.dayCalendarNavMonthHeaderBtn.click();
3535

36-
page.currentLocationBtn.click();
37-
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth);
36+
await page.currentLocationBtn.click();
37+
expect(await page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth);
3838

39-
page.hideGoToCurrentRadio.click();
40-
input.click();
41-
expect(page.currentLocationBtn.isPresent()).toBe(false);
42-
page.dayCalendarNavHeaderBtn.click();
43-
expect(page.currentLocationBtn.isPresent()).toBe(false);
39+
await page.hideGoToCurrentRadio.click();
40+
await input.click();
41+
expect(await page.currentLocationBtn.isPresent()).toBe(false);
42+
await page.dayCalendarNavHeaderBtn.click();
43+
expect(await page.currentLocationBtn.isPresent()).toBe(false);
4444
};
4545

46-
const commonMonth = (menu: ElementFinder, input?: ElementFinder) => {
47-
menu.click();
48-
page.showGoToCurrentRadio.click();
49-
input.click();
50-
expect(page.currentLocationBtn.isPresent()).toBe(true);
51-
expect(page.deyCalendarMonthNavHeader.getText()).toEqual(currentYear);
52-
page.monthCalendarLeftNavBtn.click();
53-
expect(page.deyCalendarMonthNavHeader.getText()).toEqual(prevYear);
54-
page.currentLocationBtn.click();
55-
expect(page.deyCalendarMonthNavHeader.getText()).toEqual(currentYear);
46+
const commonMonth = async (menu: ElementFinder, input?: ElementFinder) => {
47+
await menu.click();
48+
await page.showGoToCurrentRadio.click();
49+
await input.click();
50+
expect(await page.currentLocationBtn.isPresent()).toBe(true);
51+
expect(await page.deyCalendarMonthNavHeader.getText()).toEqual(currentYear);
52+
await page.monthCalendarLeftNavBtn.click();
53+
expect(await page.deyCalendarMonthNavHeader.getText()).toEqual(prevYear);
54+
await page.currentLocationBtn.click();
55+
expect(await page.deyCalendarMonthNavHeader.getText()).toEqual(currentYear);
5656

57-
page.hideGoToCurrentRadio.click();
58-
input.click();
59-
expect(page.currentLocationBtn.isPresent()).toBe(false);
57+
await page.hideGoToCurrentRadio.click();
58+
await input.click();
59+
expect(await page.currentLocationBtn.isPresent()).toBe(false);
6060
};
6161

62-
commonDayCalendar(page.daytimePickerMenu, page.daytimePickerInput);
63-
commonDayCalendar(page.daytimeDirectiveMenu, page.daytimeDirectiveInput);
62+
await commonDayCalendar(page.daytimePickerMenu, page.daytimePickerInput);
63+
await commonDayCalendar(page.daytimeDirectiveMenu, page.daytimeDirectiveInput);
6464

65-
commonDayCalendar(page.dayPickerMenu, page.dayPickerInput);
66-
commonDayCalendar(page.dayDirectiveMenu, page.dayDirectiveInput);
67-
commonDayCalendar(page.dayDirectiveReactiveMenu, page.dayDirectiveReactiveInput);
65+
await commonDayCalendar(page.dayPickerMenu, page.dayPickerInput);
66+
await commonDayCalendar(page.dayDirectiveMenu, page.dayDirectiveInput);
67+
await commonDayCalendar(page.dayDirectiveReactiveMenu, page.dayDirectiveReactiveInput);
6868

69-
commonMonth(page.monthPickerMenu, page.monthPickerInput);
70-
commonMonth(page.monthDirectiveMenu, page.monthDirectiveInput);
69+
await commonMonth(page.monthPickerMenu, page.monthPickerInput);
70+
await commonMonth(page.monthDirectiveMenu, page.monthDirectiveInput);
7171
});
7272

73-
it('should hide current date button when not between min and max', () => {
74-
page.dayPickerMenu.click();
75-
page.minSelectableInput.sendKeys(moment().add(3, 'month').format('DD-MM-YYYY'));
76-
page.dayPickerInput.click();
77-
expect(page.currentLocationBtn.isPresent()).toBe(false);
73+
it('should hide current date button when not between min and max', async () => {
74+
await page.dayPickerMenu.click();
75+
await page.minSelectableInput.sendKeys(moment().add(3, 'month').format('DD-MM-YYYY'));
76+
await page.dayPickerInput.click();
77+
expect(await page.currentLocationBtn.isPresent()).toBe(false);
7878
});
7979
});

‎e2e/datpicker-e2e.spec.ts

+101-101
Large diffs are not rendered by default.

‎e2e/daypicker-e2e.spec.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ describe('dpDayPicker daytimePicker', () => {
1212
page.daytimePickerMenu.click();
1313
});
1414

15-
it('should check if min date validation is working', () => {
15+
it('should check if min date validation is working', async () => {
1616
page.minDateValidationPickerInput.clear();
17-
expect(page.minDateValidationMsg.isPresent()).toBe(false);
17+
expect(await page.minDateValidationMsg.isPresent()).toBe(false);
1818
page.minDateValidationPickerInput.sendKeys('10-04-2017 10:08:07');
1919
page.daytimePickerInput.sendKeys('10-04-2017 09:08:07');
20-
expect(page.minDateValidationMsg.getText()).toEqual('minDate invalid');
20+
expect(await page.minDateValidationMsg.getText()).toEqual('minDate invalid');
2121
page.minDateValidationPickerInput.clear();
2222
page.minDateValidationPickerInput.sendKeys('10-04-2017 09:08:07');
23-
expect(page.minDateValidationMsg.isPresent()).toBe(false);
23+
expect(await page.minDateValidationMsg.isPresent()).toBe(false);
2424
});
2525

26-
it('should check if max date validation is working', () => {
26+
it('should check if max date validation is working', async () => {
2727
page.maxDateValidationPickerInput.clear();
28-
expect(page.maxDateValidationMsg.isPresent()).toBe(false);
28+
expect(await page.maxDateValidationMsg.isPresent()).toBe(false);
2929
page.maxDateValidationPickerInput.sendKeys('12-04-2017 08:08:07');
3030
page.daytimePickerInput.sendKeys('12-04-2017 09:08:07');
31-
expect(page.maxDateValidationMsg.getText()).toEqual('maxDate invalid');
31+
expect(await page.maxDateValidationMsg.getText()).toEqual('maxDate invalid');
3232
page.maxDateValidationPickerInput.clear();
3333
page.maxDateValidationPickerInput.sendKeys('12-04-2017 09:08:07');
34-
expect(page.maxDateValidationMsg.isPresent()).toBe(false);
34+
expect(await page.maxDateValidationMsg.isPresent()).toBe(false);
3535
});
3636

37-
it('should check that the min selectable option is working', () => {
37+
it('should check that the min selectable option is working', async () => {
3838
page.minSelectableInput.clear();
3939
page.minSelectableInput.sendKeys('11-04-2017 09:08:07');
4040
page.daytimePickerInput.sendKeys('17-04-2017 09:08:07');
4141
page.daytimePickerInput.click();
42-
expect(page.calendarDisabledDays.count()).toBe(16);
42+
expect(await page.calendarDisabledDays.count()).toBe(16);
4343
page.daytimePickerInput.clear();
4444
page.daytimePickerInput.sendKeys('11-04-2017 09:18:07');
45-
expect(page.hourDownBtn.getAttribute('disabled')).toEqual('true');
46-
expect(page.minuteDownBtn.getAttribute('disabled')).toBe(null);
47-
expect(page.meridiemUpBtn.getAttribute('disabled')).toBe(null);
48-
expect(page.meridiemDownBtn.getAttribute('disabled')).toBe(null);
45+
expect(await page.hourDownBtn.getAttribute('disabled')).toEqual('true');
46+
expect(await page.minuteDownBtn.getAttribute('disabled')).toBe(null);
47+
expect(await page.meridiemUpBtn.getAttribute('disabled')).toBe(null);
48+
expect(await page.meridiemDownBtn.getAttribute('disabled')).toBe(null);
4949
});
5050

51-
it('should check that the max selectable option is working', () => {
51+
it('should check that the max selectable option is working', async () => {
5252
page.maxSelectableInput.clear();
5353
page.maxSelectableInput.sendKeys('11-04-2017 09:08:07');
5454
page.daytimePickerInput.sendKeys('12-04-2017 09:08:07');
5555
page.daytimePickerInput.click();
56-
expect(page.calendarDisabledDays.count()).toBe(25);
56+
expect(await page.calendarDisabledDays.count()).toBe(25);
5757
page.daytimePickerInput.clear();
5858
page.daytimePickerInput.sendKeys('11-04-2017 09:06:07');
59-
expect(page.hourUpBtn.getAttribute('disabled')).toEqual('true');
60-
expect(page.minuteUpBtn.getAttribute('disabled')).toBe(null);
61-
expect(page.meridiemUpBtn.getAttribute('disabled')).toBe('true');
62-
expect(page.meridiemDownBtn.getAttribute('disabled')).toBe('true');
59+
expect(await page.hourUpBtn.getAttribute('disabled')).toEqual('true');
60+
expect(await page.minuteUpBtn.getAttribute('disabled')).toBe(null);
61+
expect(await page.meridiemUpBtn.getAttribute('disabled')).toBe('true');
62+
expect(await page.meridiemDownBtn.getAttribute('disabled')).toBe('true');
6363
});
6464
});

‎e2e/daytimepicker-e2e.spec.ts

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {DemoPage} from './app.po';
2-
import {browser} from 'protractor';
32

43
describe('dpDayPicker daytimePicker', () => {
54
let page: DemoPage;
@@ -13,63 +12,63 @@ describe('dpDayPicker daytimePicker', () => {
1312
page.daytimePickerMenu.click();
1413
});
1514

16-
it('should check if min date validation is working', () => {
15+
it('should check if min date validation is working', async () => {
1716
page.minDateValidationPickerInput.clear();
18-
expect(page.minDateValidationMsg.isPresent()).toBe(false);
17+
expect(await page.minDateValidationMsg.isPresent()).toBe(false);
1918
page.minDateValidationPickerInput.sendKeys('10-04-2017 10:08:07');
2019
page.daytimePickerInput.sendKeys('10-04-2017 09:08:07');
21-
expect(page.minDateValidationMsg.getText()).toEqual('minDate invalid');
20+
expect(await page.minDateValidationMsg.getText()).toEqual('minDate invalid');
2221
page.minDateValidationPickerInput.clear();
2322
page.minDateValidationPickerInput.sendKeys('10-04-2017 09:08:07');
24-
expect(page.minDateValidationMsg.isPresent()).toBe(false);
23+
expect(await page.minDateValidationMsg.isPresent()).toBe(false);
2524
});
2625

27-
it('should check if max date validation is working', () => {
26+
it('should check if max date validation is working', async () => {
2827
page.maxDateValidationPickerInput.clear();
29-
expect(page.maxDateValidationMsg.isPresent()).toBe(false);
28+
expect(await page.maxDateValidationMsg.isPresent()).toBe(false);
3029
page.maxDateValidationPickerInput.sendKeys('12-04-2017 08:08:07');
3130
page.daytimePickerInput.sendKeys('12-04-2017 09:08:07');
32-
expect(page.maxDateValidationMsg.getText()).toEqual('maxDate invalid');
31+
expect(await page.maxDateValidationMsg.getText()).toEqual('maxDate invalid');
3332
page.maxDateValidationPickerInput.clear();
3433
page.maxDateValidationPickerInput.sendKeys('12-04-2017 09:08:07');
35-
expect(page.maxDateValidationMsg.isPresent()).toBe(false);
34+
expect(await page.maxDateValidationMsg.isPresent()).toBe(false);
3635
});
3736

38-
it('should check that the min selectable option is working', () => {
37+
it('should check that the min selectable option is working', async () => {
3938
page.minSelectableInput.clear();
4039
page.minSelectableInput.sendKeys('11-04-2017 09:08:07');
4140
page.daytimePickerInput.sendKeys('17-04-2017 09:08:07');
4241
page.daytimePickerInput.click();
43-
expect(page.calendarDisabledDays.count()).toBe(16);
42+
expect(await page.calendarDisabledDays.count()).toBe(16);
4443
page.daytimePickerInput.clear();
4544
page.daytimePickerInput.sendKeys('11-04-2017 09:18:07');
46-
expect(page.hourDownBtn.getAttribute('disabled')).toEqual('true');
47-
expect(page.minuteDownBtn.getAttribute('disabled')).toBe(null);
48-
expect(page.meridiemUpBtn.getAttribute('disabled')).toBe(null);
49-
expect(page.meridiemDownBtn.getAttribute('disabled')).toBe(null);
45+
expect(await page.hourDownBtn.getAttribute('disabled')).toEqual('true');
46+
expect(await page.minuteDownBtn.getAttribute('disabled')).toBe(null);
47+
expect(await page.meridiemUpBtn.getAttribute('disabled')).toBe(null);
48+
expect(await page.meridiemDownBtn.getAttribute('disabled')).toBe(null);
5049
});
5150

52-
it('should check that the max selectable option is working', () => {
51+
it('should check that the max selectable option is working', async () => {
5352
page.maxSelectableInput.clear();
5453
page.maxSelectableInput.sendKeys('11-04-2017 09:08:07');
5554
page.daytimePickerInput.sendKeys('12-04-2017 09:08:07');
5655
page.daytimePickerInput.click();
57-
expect(page.calendarDisabledDays.count()).toBe(25);
56+
expect(await page.calendarDisabledDays.count()).toBe(25);
5857
page.daytimePickerInput.clear();
5958
page.daytimePickerInput.sendKeys('11-04-2017 09:06:07');
60-
expect(page.hourUpBtn.getAttribute('disabled')).toEqual('true');
61-
expect(page.minuteUpBtn.getAttribute('disabled')).toBe(null);
62-
expect(page.meridiemUpBtn.getAttribute('disabled')).toBe('true');
63-
expect(page.meridiemDownBtn.getAttribute('disabled')).toBe('true');
59+
expect(await page.hourUpBtn.getAttribute('disabled')).toEqual('true');
60+
expect(await page.minuteUpBtn.getAttribute('disabled')).toBe(null);
61+
expect(await page.meridiemUpBtn.getAttribute('disabled')).toBe('true');
62+
expect(await page.meridiemDownBtn.getAttribute('disabled')).toBe('true');
6463
});
6564

66-
it('should check that the max selectable option is working', () => {
65+
it('should check that the max selectable option is working', async () => {
6766
page.daytimePickerInput.click();
6867
page.daytimePickerInput.sendKeys('11-04-2017 09:08:07');
69-
expect(page.selectedDays.count()).toEqual(1);
68+
expect(await page.selectedDays.count()).toEqual(1);
7069
page.daytimePickerInput.clear();
7170
page.daytimePickerInput.sendKeys(' ');
7271

73-
expect(page.selectedDays.count()).toEqual(0);
72+
expect(await page.selectedDays.count()).toEqual(0);
7473
});
7574
});

‎e2e/directive-e2e.spec.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -13,58 +13,58 @@ describe('dpDayPicker directive', () => {
1313
page.dayDirectiveMenu.click();
1414
});
1515

16-
xit('should check that the popup appended to body', () => {
16+
xit('should check that the popup appended to body', async () => {
1717
page.dayDirectiveInput.click();
18-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
18+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
1919
page.clickOnBody();
20-
expect(page.datePickerPopup.isDisplayed()).toBe(false);
20+
expect(await page.datePickerPopup.isDisplayed()).toBe(false);
2121
});
2222

23-
it('should make sure that day directive keeps the prev state of the calendar', () => {
23+
it('should make sure that day directive keeps the prev state of the calendar', async () => {
2424
page.dayDirectiveInput.click();
2525
page.dayCalendarLeftNavBtn.click();
2626
page.clickOnBody();
2727

2828
page.dayDirectiveInput.click();
29-
expect(page.dayCalendarNavHeaderBtn.getText())
29+
expect(await page.dayCalendarNavHeaderBtn.getText())
3030
.toEqual(moment().subtract(1, 'month').format('MMM, YYYY'));
3131
});
3232

33-
it('should check that the theme is added and removed', () => {
33+
it('should check that the theme is added and removed', async () => {
3434
page.themeOnRadio.click();
35-
expect(page.datePickerPopup.getAttribute('class')).toContain('dp-material');
35+
expect(await page.datePickerPopup.getAttribute('class')).toContain('dp-material');
3636
page.themeOffRadio.click();
37-
expect(page.datePickerPopup.getAttribute('class')).not.toContain('dp-material');
37+
expect(await page.datePickerPopup.getAttribute('class')).not.toContain('dp-material');
3838
page.themeOnRadio.click();
39-
expect(page.datePickerPopup.getAttribute('class')).toContain('dp-material');
39+
expect(await page.datePickerPopup.getAttribute('class')).toContain('dp-material');
4040
});
4141

42-
it('should check that the onOpenDelay is working', () => {
42+
it('should check that the onOpenDelay is working', async () => {
4343
page.onOpenDelayInput.clear();
4444
page.onOpenDelayInput.sendKeys(1000);
4545
page.scrollIntoView(page.openBtn);
4646
page.openBtn.click();
47-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
47+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
4848
page.clickOnBody();
4949
browser.sleep(200);
5050
browser.waitForAngularEnabled(false);
5151
page.dayDirectiveInput.click();
52-
expect(page.datePickerPopup.isDisplayed()).toBe(false);
52+
expect(await page.datePickerPopup.isDisplayed()).toBe(false);
5353
browser.waitForAngularEnabled(true);
5454
browser.sleep(1000);
55-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
55+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
5656
});
5757

58-
it('should allow input to be modified from beginning', () => {
58+
it('should allow input to be modified from beginning', async () => {
5959
page.dayDirectiveInput.sendKeys('10-04-2017');
6060
for (let i = 0; i < 11; i++) {
6161
page.dayDirectiveInput.sendKeys(Key.LEFT);
6262
}
6363
page.dayDirectiveInput.sendKeys(Key.DELETE);
6464
page.dayDirectiveInput.sendKeys('2');
65-
expect(page.dayDirectiveInput.getAttribute('value')).toBe('20-04-2017');
66-
expect(page.selectedDays.count()).toBe(1);
67-
expect(page.selectedDays.first().getText()).toBe('20');
68-
expect(page.dayCalendarNavHeaderBtn.getText()).toBe('Apr, 2017');
65+
expect(await page.dayDirectiveInput.getAttribute('value')).toBe('20-04-2017');
66+
expect(await page.selectedDays.count()).toBe(1);
67+
expect(await page.selectedDays.first().getText()).toBe('20');
68+
expect(await page.dayCalendarNavHeaderBtn.getText()).toBe('Apr, 2017');
6969
});
7070
});

‎e2e/format-validation-e2e.spec.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ import {DemoPage} from './app.po';
33
describe('format validation', () => {
44
let page: DemoPage;
55

6-
beforeEach(() => {
6+
beforeEach(async () => {
77
page = new DemoPage();
8-
page.navigateTo();
8+
await page.navigateTo();
99
});
1010

11-
it('should check that the format validation is working', () => {
12-
const common = (menu, input) => {
13-
menu.click();
14-
input.sendKeys('lmaldlad');
15-
page.clickOnBody();
16-
expect(page.formatValidationMsg.getText()).toBe('invalid format');
17-
input.clear();
11+
it('should check that the format validation is working', async () => {
12+
const common = async (menu, input) => {
13+
await menu.click();
14+
await input.sendKeys('lmaldlad');
15+
await page.clickOnBody();
16+
expect(await page.formatValidationMsg.getText()).toBe('invalid format');
17+
await input.clear();
1818
};
1919

20-
common(page.daytimePickerMenu, page.daytimePickerInput);
21-
common(page.daytimeDirectiveMenu, page.daytimeDirectiveInput);
22-
common(page.dayPickerMenu, page.dayPickerInput);
23-
common(page.dayDirectiveMenu, page.dayDirectiveInput);
24-
common(page.dayDirectiveReactiveMenu, page.dayDirectiveReactiveInput);
25-
common(page.monthPickerMenu, page.monthPickerInput);
26-
common(page.monthDirectiveMenu, page.monthDirectiveInput);
27-
common(page.timePickerMenu, page.timePickerInput);
28-
common(page.timeDirectiveMenu, page.timeSelectDirectiveInput);
20+
await common(page.daytimePickerMenu, page.daytimePickerInput);
21+
await common(page.daytimeDirectiveMenu, page.daytimeDirectiveInput);
22+
await common(page.dayPickerMenu, page.dayPickerInput);
23+
await common(page.dayDirectiveMenu, page.dayDirectiveInput);
24+
await common(page.dayDirectiveReactiveMenu, page.dayDirectiveReactiveInput);
25+
await common(page.monthPickerMenu, page.monthPickerInput);
26+
await common(page.monthDirectiveMenu, page.monthDirectiveInput);
27+
await common(page.timePickerMenu, page.timePickerInput);
28+
await common(page.timeDirectiveMenu, page.timeSelectDirectiveInput);
2929
});
3030
});

‎e2e/hide-input-container-e2e.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ describe('hideInputContainer', () => {
88
page.navigateTo();
99
});
1010

11-
it('should hide/show InputContainer datetimepicker', () => {
12-
expect(page.daytimePickerInput.isDisplayed()).toBe(true);
11+
it('should hide/show InputContainer datetimepicker', async () => {
12+
expect(await page.daytimePickerInput.isDisplayed()).toBe(true);
1313
page.hideInputRadio.click();
14-
expect(page.daytimePickerInput.isDisplayed()).toBe(false);
14+
expect(await page.daytimePickerInput.isDisplayed()).toBe(false);
1515
});
1616
});

‎e2e/locale-e2e.spec.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,51 @@ describe('Locales', () => {
88
page.navigateTo();
99
});
1010

11-
it('should check day time picker locale', () => {
11+
it('should check day time picker locale', async () => {
1212
page.hebrewLocale.click();
1313

1414
page.daytimePickerMenu.click();
1515
page.daytimePickerInput.click();
16-
expect(page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
16+
expect(await page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
1717

1818
page.daytimeInlineMenu.click();
19-
expect(page.weekDayInline.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
19+
expect(await page.weekDayInline.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
2020

2121
page.daytimeDirectiveMenu.click();
2222
page.daytimeDirectiveInput.click();
23-
expect(page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
23+
expect(await page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
2424

2525
page.dayPickerMenu.click();
2626
page.dayPickerInput.click();
27-
expect(page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
27+
expect(await page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
2828

2929
page.dayInlineMenu.click();
30-
expect(page.weekDayInline.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
30+
expect(await page.weekDayInline.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
3131

3232
page.dayDirectiveMenu.click();
3333
page.dayDirectiveInput.click();
34-
expect(page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
34+
expect(await page.weekDayNames.getText()).toEqual(['א׳ב׳ג׳ד׳ה׳ו׳ש׳']);
3535

3636
page.monthPickerMenu.click();
3737
page.monthPickerInput.click();
38-
expect(page.calendarFirstMonthOfYear.getText()).toEqual('ינו׳');
38+
expect(await page.calendarFirstMonthOfYear.getText()).toEqual('ינו׳');
3939

4040
page.monthInlineMenu.click();
41-
expect(page.calendarFirstMonthOfYearInline.getText()).toEqual('ינו׳');
41+
expect(await page.calendarFirstMonthOfYearInline.getText()).toEqual('ינו׳');
4242

4343
page.monthDirectiveMenu.click();
4444
page.monthDirectiveInput.click();
45-
expect(page.calendarFirstMonthOfYear.getText()).toEqual('ינו׳');
45+
expect(await page.calendarFirstMonthOfYear.getText()).toEqual('ינו׳');
4646

4747
page.timePickerMenu.click();
4848
page.timePickerInput.click();
49-
expect(page.meridiemDisplay.getText()).toMatch(/(בערב|בבוקר|לפני הצהריים|אחרי הצהריים|לפנות בוקר)/);
49+
expect(await page.meridiemDisplay.getText()).toMatch(/(בערב|בבוקר|לפני הצהריים|אחרי הצהריים|לפנות בוקר)/);
5050

5151
page.timeDirectiveMenu.click();
5252
page.timeSelectDirectiveInput.click();
53-
expect(page.meridiemDisplay.getText()).toMatch(/(בערב|בבוקר|לפני הצהריים|אחרי הצהריים|לפנות בוקר)/);
53+
expect(await page.meridiemDisplay.getText()).toMatch(/(בערב|בבוקר|לפני הצהריים|אחרי הצהריים|לפנות בוקר)/);
5454

5555
page.timeInlineMenu.click();
56-
expect(page.meridiemDisplayInline.getText()).toMatch(/(בערב|בבוקר|לפני הצהריים|אחרי הצהריים|לפנות בוקר)/);
56+
expect(await page.meridiemDisplayInline.getText()).toMatch(/(בערב|בבוקר|לפני הצהריים|אחרי הצהריים|לפנות בוקר)/);
5757
});
5858
});

‎e2e/move-to-date-api-e2e.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ describe('Move to date api', () => {
1010
});
1111

1212
it('should move to date API on day', () => {
13-
const runner = (menuItem, input, isPicker, cont) => {
13+
const runner = async (menuItem, input, isPicker, cont) => {
1414
menuItem.click();
1515
page.moveCalendarTo.click();
1616

1717
if (isPicker) {
1818
input.click();
1919
}
2020

21-
expect(cont.getText()).toContain('1987');
21+
expect(await cont.getText()).toContain('1987');
2222
};
2323

2424
runner(page.dayPickerMenu, page.dayPickerInput, true, page.dayCalendarNavHeaderBtn);

‎e2e/reactive-directive-e2e.spec.ts

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {DemoPage} from './app.po';
22
import {browser} from 'protractor';
3+
import {not} from 'rxjs/internal-compatibility';
34

45
describe('dpDayPicker reactive directive', () => {
56
let page: DemoPage;
@@ -13,69 +14,69 @@ describe('dpDayPicker reactive directive', () => {
1314
page.dayDirectiveReactiveMenu.click();
1415
});
1516

16-
xit('should check that the popup appended to body', () => {
17+
xit('should check that the popup appended to body', async () => {
1718
page.dayDirectiveReactiveInput.click();
18-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
19+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
1920
page.clickOnBody();
20-
expect(page.datePickerPopup.isDisplayed()).toBe(false);
21+
expect(await page.datePickerPopup.isDisplayed()).toBe(false);
2122
});
2223

23-
it('should check that the theme is added and removed', () => {
24+
it('should check that the theme is added and removed', async () => {
2425
page.themeOnRadio.click();
25-
expect(page.datePickerPopup.getAttribute('class')).toContain('dp-material');
26+
expect(await page.datePickerPopup.getAttribute('class')).toContain('dp-material');
2627
page.themeOffRadio.click();
27-
expect(page.datePickerPopup.getAttribute('class')).not.toContain('dp-material');
28+
expect(await page.datePickerPopup.getAttribute('class')).not.toContain('dp-material');
2829
page.themeOnRadio.click();
29-
expect(page.datePickerPopup.getAttribute('class')).toContain('dp-material');
30+
expect(await page.datePickerPopup.getAttribute('class')).toContain('dp-material');
3031
});
3132

32-
it('should check that the onOpenDelay is working', () => {
33+
it('should check that the onOpenDelay is working', async () => {
3334
page.onOpenDelayInput.clear();
3435
page.onOpenDelayInput.sendKeys(1000);
3536
page.scrollIntoView(page.openBtn);
3637
page.openBtn.click();
37-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
38+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
3839
page.clickOnBody();
3940
browser.sleep(200);
4041
browser.waitForAngularEnabled(false);
4142
page.dayDirectiveReactiveInput.click();
42-
expect(page.datePickerPopup.isDisplayed()).toBe(false);
43+
expect(await page.datePickerPopup.isDisplayed()).toBe(false);
4344
browser.waitForAngularEnabled(true);
4445
browser.sleep(1000);
45-
expect(page.datePickerPopup.isDisplayed()).toBe(true);
46+
expect(await page.datePickerPopup.isDisplayed()).toBe(true);
4647
});
4748

48-
it('should check if enable/disable required validation is working', () => {
49+
it('should check if enable/disable required validation is working', async () => {
4950
page.dayDirectiveReactiveInput.click();
5051
page.dayDirectiveReactiveInput.clear();
51-
expect(page.reactiveRequiredValidationMsg.isPresent()).toBe(false);
52+
expect(await page.reactiveRequiredValidationMsg.isPresent()).toBe(false);
5253
page.enableRequiredValidationRadio.click();
53-
expect(page.reactiveRequiredValidationMsg.getText()).toEqual('required');
54+
expect(await page.reactiveRequiredValidationMsg.getText()).toEqual('required');
5455
page.disableRequiredValidationRadio.click();
55-
expect(page.reactiveRequiredValidationMsg.isPresent()).toBe(false);
56+
expect(await page.reactiveRequiredValidationMsg.isPresent()).toBe(false);
5657
});
5758

58-
it('should check if min date validation is working', () => {
59+
it('should check if min date validation is working', async () => {
5960
page.minDateValidationPickerInput.clear();
60-
expect(page.reactiveMinDateValidationMsg.isPresent()).toBe(false);
61+
expect(await page.reactiveMinDateValidationMsg.isPresent()).toBe(false);
6162
page.minDateValidationPickerInput.sendKeys('11-04-2017');
6263
page.dayDirectiveReactiveInput.sendKeys('10-04-2017');
6364
page.clickOnBody();
64-
expect(page.reactiveMinDateValidationMsg.getText()).toEqual('minDate invalid');
65+
expect(await page.reactiveMinDateValidationMsg.getText()).toEqual('minDate invalid');
6566
page.minDateValidationPickerInput.clear();
6667
page.minDateValidationPickerInput.sendKeys('10-04-2017');
67-
expect(page.reactiveMinDateValidationMsg.isPresent()).toBe(false);
68+
expect(await page.reactiveMinDateValidationMsg.isPresent()).toBe(false);
6869
});
6970

70-
it('should check if max date validation is working', () => {
71+
it('should check if max date validation is working', async () => {
7172
page.maxDateValidationPickerInput.clear();
72-
expect(page.reactiveMaxDateValidationMsg.isPresent()).toBe(false);
73+
expect(await page.reactiveMaxDateValidationMsg.isPresent()).toBe(false);
7374
page.maxDateValidationPickerInput.sendKeys('11-04-2017');
7475
page.dayDirectiveReactiveInput.sendKeys('12-04-2017');
7576
page.clickOnBody();
76-
expect(page.reactiveMaxDateValidationMsg.getText()).toEqual('maxDate invalid');
77+
expect(await page.reactiveMaxDateValidationMsg.getText()).toEqual('maxDate invalid');
7778
page.maxDateValidationPickerInput.clear();
7879
page.maxDateValidationPickerInput.sendKeys('12-04-2017');
79-
expect(page.reactiveMaxDateValidationMsg.isPresent()).toBe(false);
80+
expect(await page.reactiveMaxDateValidationMsg.isPresent()).toBe(false);
8081
});
8182
});

‎e2e/selected-unselect-e2e.spec.ts

+57-60
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import {DemoPage} from './app.po';
22
import * as moment from 'moment';
3-
import {browser} from 'protractor';
4-
import * as fs from 'fs';
5-
import {TestUtils} from './test-utils';
63

74
describe('dpDayPicker timePicker', () => {
85

@@ -13,113 +10,113 @@ describe('dpDayPicker timePicker', () => {
1310
page.navigateTo();
1411
});
1512

16-
it('should make sure unSelectOnClick feature works as expected for day calendar', () => {
17-
const dayRunner = (menuItem, input, isPicker) => {
13+
it('should make sure unSelectOnClick feature works as expected for day calendar', async () => {
14+
const dayRunner = async (menuItem, input, isPicker) => {
1815
const date = moment();
19-
const dayClick = () => {
16+
const dayClick = async () => {
2017
if (isPicker) {
21-
page.clickOnDayButton(date.format('DD'));
18+
await page.clickOnDayButton(date.format('DD'));
2219
} else {
23-
page.clickOnDayButtonInline(date.format('DD'));
20+
await page.clickOnDayButtonInline(date.format('DD'));
2421
}
2522
};
2623

27-
menuItem.click();
28-
page.enableUnselectSelected.click();
24+
await menuItem.click();
25+
await page.enableUnselectSelected.click();
2926

3027
if (isPicker) {
31-
page.scrollIntoView(page.noCloseOnSelect);
32-
page.noCloseOnSelect.click();
33-
input.click();
28+
await page.scrollIntoView(page.noCloseOnSelect);
29+
await page.noCloseOnSelect.click();
30+
await input.click();
3431
}
3532

36-
dayClick();
37-
expect(page.selectedDay.isPresent()).toEqual(true);
38-
dayClick();
39-
expect(page.selectedDay.isPresent()).toEqual(false);
33+
await dayClick();
34+
expect(await page.selectedDay.isPresent()).toEqual(true);
35+
await dayClick();
36+
expect(await page.selectedDay.isPresent()).toEqual(false);
4037

41-
page.clickOnBody();
38+
await page.clickOnBody();
4239

43-
page.disableUnselectSelected.click();
40+
await page.disableUnselectSelected.click();
4441

4542
if (isPicker) {
46-
input.click();
43+
await input.click();
4744
}
4845

49-
dayClick();
46+
await dayClick();
5047

51-
expect(page.selectedDay.isPresent()).toEqual(true);
48+
expect(await page.selectedDay.isPresent()).toEqual(true);
5249

53-
dayClick();
54-
expect(page.selectedDay.isPresent()).toEqual(true);
50+
await dayClick();
51+
expect(await page.selectedDay.isPresent()).toEqual(true);
5552

56-
page.enableUnselectSelected.click();
53+
await page.enableUnselectSelected.click();
5754

5855
if (isPicker) {
59-
input.click();
56+
await input.click();
6057
}
6158

62-
dayClick();
63-
expect(page.selectedDay.isPresent()).toEqual(false);
59+
await dayClick();
60+
expect(await page.selectedDay.isPresent()).toEqual(false);
6461
};
6562

66-
dayRunner(page.dayPickerMenu, page.dayPickerInput, true);
67-
dayRunner(page.dayDirectiveMenu, page.dayDirectiveInput, true);
68-
dayRunner(page.dayInlineMenu, null, false);
63+
await dayRunner(page.dayPickerMenu, page.dayPickerInput, true);
64+
await dayRunner(page.dayDirectiveMenu, page.dayDirectiveInput, true);
65+
await dayRunner(page.dayInlineMenu, null, false);
6966
});
7067

71-
it('should make sure unSelectOnClick feature works as expected for month calendar', () => {
72-
const monthRunner = (menuItem, input, isPicker) => {
68+
it('should make sure unSelectOnClick feature works as expected for month calendar', async () => {
69+
const monthRunner = async (menuItem, input, isPicker) => {
7370
const date = moment();
74-
const dayClick = () => {
71+
const dayClick = async () => {
7572
if (isPicker) {
76-
page.clickOnMonthButton(date.format('MMM'));
73+
await page.clickOnMonthButton(date.format('MMM'));
7774
} else {
78-
page.clickOnMonthButtonInline(date.format('MMM'));
75+
await page.clickOnMonthButtonInline(date.format('MMM'));
7976
}
8077
};
8178

82-
menuItem.click();
83-
page.enableUnselectSelected.click();
79+
await menuItem.click();
80+
await page.enableUnselectSelected.click();
8481

8582
if (isPicker) {
86-
page.scrollIntoView(page.noCloseOnSelect);
87-
page.noCloseOnSelect.click();
88-
input.click();
83+
await page.scrollIntoView(page.noCloseOnSelect);
84+
await page.noCloseOnSelect.click();
85+
await input.click();
8986
}
9087

91-
dayClick();
92-
expect(page.selectedMonth.isPresent()).toEqual(true);
93-
dayClick();
94-
expect(page.selectedMonth.isPresent()).toEqual(false);
88+
await dayClick();
89+
expect(await page.selectedMonth.isPresent()).toEqual(true);
90+
await dayClick();
91+
expect(await page.selectedMonth.isPresent()).toEqual(false);
9592

96-
page.clickOnBody();
97-
page.scrollIntoView(page.disableUnselectSelected);
98-
page.disableUnselectSelected.click();
93+
await page.clickOnBody();
94+
await page.scrollIntoView(page.disableUnselectSelected);
95+
await page.disableUnselectSelected.click();
9996

10097
if (isPicker) {
101-
input.click();
98+
await input.click();
10299
}
103100

104-
dayClick();
101+
await dayClick();
105102

106-
expect(page.selectedMonth.isPresent()).toEqual(true);
103+
expect(await page.selectedMonth.isPresent()).toEqual(true);
107104

108-
dayClick();
109-
expect(page.selectedMonth.isPresent()).toEqual(true);
105+
await dayClick();
106+
expect(await page.selectedMonth.isPresent()).toEqual(true);
110107

111-
page.enableUnselectSelected.click();
108+
await page.enableUnselectSelected.click();
112109

113110
if (isPicker) {
114-
input.click();
111+
await input.click();
115112
}
116113

117-
dayClick();
118-
expect(page.selectedMonth.isPresent()).toEqual(false);
114+
await dayClick();
115+
expect(await page.selectedMonth.isPresent()).toEqual(false);
119116
};
120117

121-
monthRunner(page.monthPickerMenu, page.monthPickerInput, true);
122-
monthRunner(page.monthDirectiveMenu, page.monthDirectiveInput, true);
123-
monthRunner(page.monthInlineMenu, null, false);
118+
await monthRunner(page.monthPickerMenu, page.monthPickerInput, true);
119+
await monthRunner(page.monthDirectiveMenu, page.monthDirectiveInput, true);
120+
await monthRunner(page.monthInlineMenu, null, false);
124121
});
125122
});

‎e2e/timepicker-e2e.spec.ts

+38-38
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,65 @@ describe('dpDayPicker timePicker', () => {
1212
page.dateFormatInput.sendKeys('HH:mm:ss');
1313
});
1414

15-
it('should check if min time validation is working', () => {
15+
it('should check if min time validation is working', async () => {
1616
page.minTimeValidationPickerInput.clear();
17-
expect(page.timePickerMinTimeValidationMsg.isPresent()).toBe(false);
17+
expect(await page.timePickerMinTimeValidationMsg.isPresent()).toBe(false);
1818
page.minTimeValidationPickerInput.clear();
1919
page.minTimeValidationPickerInput.sendKeys('10:11:12');
2020
page.timePickerInput.click();
2121
page.timePickerInput.clear();
2222
page.timePickerInput.sendKeys('09:00:00');
2323
page.clickOnBody();
24-
expect(page.timePickerMinTimeValidationMsg.getText()).toEqual('minTime invalid');
24+
expect(await page.timePickerMinTimeValidationMsg.getText()).toEqual('minTime invalid');
2525
page.minTimeValidationPickerInput.clear();
2626
page.minTimeValidationPickerInput.sendKeys('08:07:06');
2727
page.clickOnBody();
28-
expect(page.timePickerMinTimeValidationMsg.isPresent()).toBe(false);
28+
expect(await page.timePickerMinTimeValidationMsg.isPresent()).toBe(false);
2929
});
3030

31-
it('should check if max time validation is working', () => {
31+
it('should check if max time validation is working', async () => {
3232
page.maxTimeValidationPickerInput.click();
3333
page.maxTimeValidationPickerInput.clear();
34-
expect(page.timePickerMaxTimeValidationMsg.isPresent()).toBe(false);
34+
expect(await page.timePickerMaxTimeValidationMsg.isPresent()).toBe(false);
3535
page.maxTimeValidationPickerInput.clear();
3636
page.maxTimeValidationPickerInput.sendKeys('08:07:06');
3737
page.timePickerInput.click();
3838
page.timePickerInput.clear();
3939
page.timePickerInput.sendKeys('09:00:00');
4040
page.clickOnBody();
41-
expect(page.timePickerMaxTimeValidationMsg.getText()).toEqual('maxTime invalid');
41+
expect(await page.timePickerMaxTimeValidationMsg.getText()).toEqual('maxTime invalid');
4242
page.maxTimeValidationPickerInput.clear();
4343
page.maxTimeValidationPickerInput.sendKeys('10:11:12');
44-
expect(page.timePickerMaxTimeValidationMsg.isPresent()).toBe(false);
44+
expect(await page.timePickerMaxTimeValidationMsg.isPresent()).toBe(false);
4545
});
4646

47-
it('should check that the min selectable time option is working', () => {
47+
it('should check that the min selectable time option is working', async () => {
4848
page.minTimeInput.click();
4949
page.minTimeInput.clear();
5050
page.minTimeInput.sendKeys('08:07:06');
5151
page.timePickerInput.click();
5252
page.timePickerInput.clear();
5353
page.timePickerInput.sendKeys('09:00:00');
54-
expect(page.hourDownBtn.getAttribute('disabled')).toEqual('true');
55-
expect(page.minuteDownBtn.getAttribute('disabled')).toBe(null);
56-
expect(page.meridiemUpBtn.getAttribute('disabled')).toBe(null);
57-
expect(page.meridiemDownBtn.getAttribute('disabled')).toBe(null);
54+
expect(await page.hourDownBtn.getAttribute('disabled')).toEqual('true');
55+
expect(await page.minuteDownBtn.getAttribute('disabled')).toBe(null);
56+
expect(await page.meridiemUpBtn.getAttribute('disabled')).toBe(null);
57+
expect(await page.meridiemDownBtn.getAttribute('disabled')).toBe(null);
5858
});
5959

60-
it('should check that the max selectable time option is working', () => {
60+
it('should check that the max selectable time option is working', async () => {
6161
page.maxTimeInput.click();
6262
page.maxTimeInput.clear();
6363
page.maxTimeInput.sendKeys('09:07:06');
6464
page.timePickerInput.click();
6565
page.timePickerInput.clear();
6666
page.timePickerInput.sendKeys('09:00:00');
67-
expect(page.hourUpBtn.getAttribute('disabled')).toEqual('true');
68-
expect(page.minuteUpBtn.getAttribute('disabled')).toBe(null);
69-
expect(page.meridiemUpBtn.getAttribute('disabled')).toEqual('true');
70-
expect(page.meridiemDownBtn.getAttribute('disabled')).toEqual('true');
67+
expect(await page.hourUpBtn.getAttribute('disabled')).toEqual('true');
68+
expect(await page.minuteUpBtn.getAttribute('disabled')).toBe(null);
69+
expect(await page.meridiemUpBtn.getAttribute('disabled')).toEqual('true');
70+
expect(await page.meridiemDownBtn.getAttribute('disabled')).toEqual('true');
7171
});
7272

73-
it('should check that the 12 hour time format options work', () => {
73+
it('should check that the 12 hour time format options work', async () => {
7474
page.showSeconds.click();
7575
page.hours12FormatInput.clear();
7676
page.hours12FormatInput.sendKeys('h');
@@ -85,14 +85,14 @@ describe('dpDayPicker timePicker', () => {
8585
page.timePickerInput.click();
8686
page.timePickerInput.clear();
8787
page.timePickerInput.sendKeys('09:08:07');
88-
expect(page.hourDisplay.getText()).toEqual('9');
89-
expect(page.minuteDisplay.getText()).toEqual('8');
90-
expect(page.secondDisplay.getText()).toEqual('7');
91-
expect(page.meridiemDisplay.getText()).toEqual('am');
92-
expect(page.timeSeparatorDisplay.getText()).toEqual('-');
88+
expect(await page.hourDisplay.getText()).toEqual('9');
89+
expect(await page.minuteDisplay.getText()).toEqual('8');
90+
expect(await page.secondDisplay.getText()).toEqual('7');
91+
expect(await page.meridiemDisplay.getText()).toEqual('am');
92+
expect(await page.timeSeparatorDisplay.getText()).toEqual('-');
9393
});
9494

95-
it('should check that the 24 hour time format options work', () => {
95+
it('should check that the 24 hour time format options work', async () => {
9696
page.showTwentyFourHours.click();
9797
page.showSeconds.click();
9898
page.hours24FormatInput.clear();
@@ -106,13 +106,13 @@ describe('dpDayPicker timePicker', () => {
106106
page.timePickerInput.click();
107107
page.timePickerInput.clear();
108108
page.timePickerInput.sendKeys('09:08:07');
109-
expect(page.hourDisplay.getText()).toEqual('9');
110-
expect(page.minuteDisplay.getText()).toEqual('8');
111-
expect(page.secondDisplay.getText()).toEqual('7');
112-
expect(page.timeSeparatorDisplay.getText()).toEqual('-');
109+
expect(await page.hourDisplay.getText()).toEqual('9');
110+
expect(await page.minuteDisplay.getText()).toEqual('8');
111+
expect(await page.secondDisplay.getText()).toEqual('7');
112+
expect(await page.timeSeparatorDisplay.getText()).toEqual('-');
113113
});
114114

115-
it('should check that the interval options work', () => {
115+
it('should check that the interval options work', async () => {
116116
page.showSeconds.click();
117117
page.minutesIntervalInput.clear();
118118
page.minutesIntervalInput.sendKeys('6');
@@ -122,16 +122,16 @@ describe('dpDayPicker timePicker', () => {
122122
page.timePickerInput.clear();
123123
page.timePickerInput.sendKeys('09:08:07');
124124
page.minuteUpBtn.click();
125-
expect(page.minuteDisplay.getText()).toEqual('14');
126-
expect(page.timePickerInput.getAttribute('value')).toEqual('09:14:07');
125+
expect(await page.minuteDisplay.getText()).toEqual('14');
126+
expect(await page.timePickerInput.getAttribute('value')).toEqual('09:14:07');
127127
page.minuteDownBtn.click();
128-
expect(page.minuteDisplay.getText()).toEqual('08');
129-
expect(page.timePickerInput.getAttribute('value')).toEqual('09:08:07');
128+
expect(await page.minuteDisplay.getText()).toEqual('08');
129+
expect(await page.timePickerInput.getAttribute('value')).toEqual('09:08:07');
130130
page.secondUpBtn.click();
131-
expect(page.secondDisplay.getText()).toEqual('14');
132-
expect(page.timePickerInput.getAttribute('value')).toEqual('09:08:14');
131+
expect(await page.secondDisplay.getText()).toEqual('14');
132+
expect(await page.timePickerInput.getAttribute('value')).toEqual('09:08:14');
133133
page.secondDownBtn.click();
134-
expect(page.secondDisplay.getText()).toEqual('07');
135-
expect(page.timePickerInput.getAttribute('value')).toEqual('09:08:07');
134+
expect(await page.secondDisplay.getText()).toEqual('07');
135+
expect(await page.timePickerInput.getAttribute('value')).toEqual('09:08:07');
136136
});
137137
});

‎package-lock.json

+6,663-4,015
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+33-31
Original file line numberDiff line numberDiff line change
@@ -38,43 +38,45 @@
3838
"moment": "^2.17.1"
3939
},
4040
"devDependencies": {
41-
"@angular-devkit/core": "0.6.8",
42-
"@angular/cli": "^6.0.8",
43-
"@angular/common": "6.0.5",
44-
"@angular/compiler": "6.0.5",
45-
"@angular/compiler-cli": "6.0.5",
46-
"@angular/core": "6.0.5",
47-
"@angular/forms": "6.0.5",
48-
"@angular/platform-browser": "6.0.5",
49-
"@angular/platform-browser-dynamic": "6.0.5",
50-
"@angular/router": "6.0.5",
51-
"@types/google.analytics": "0.0.33",
52-
"@types/jasmine": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.5.38.tgz",
53-
"@types/node": "https://registry.npmjs.org/@types/node/-/node-6.0.94.tgz",
41+
"@angular-devkit/build-angular": "~0.11.0",
42+
"@angular-devkit/core": "7.1.0",
43+
"@angular/cli": "^7.1.0",
44+
"@angular/common": "7.1.0",
45+
"@angular/compiler": "7.1.0",
46+
"@angular/compiler-cli": "7.1.0",
47+
"@angular/core": "7.1.0",
48+
"@angular/forms": "7.1.0",
49+
"@angular/platform-browser": "7.1.0",
50+
"@angular/platform-browser-dynamic": "7.1.0",
51+
"@angular/router": "7.1.0",
52+
"@types/google.analytics": "0.0.39",
53+
"@types/jasmine": "3.3.0",
54+
"@types/node": "10.12.10",
5455
"classlist.js": "^1.1.20150312",
55-
"codelyzer": "^4.3.0",
56+
"codelyzer": "^4.5.0",
5657
"core-js": "^2.5.7",
57-
"jasmine-core": "~2.5.2",
58-
"jasmine-spec-reporter": "~3.2.0",
59-
"karma": "~1.4.1",
60-
"karma-chrome-launcher": "~2.0.0",
58+
"jasmine-core": "~3.3.0",
59+
"jasmine-spec-reporter": "~4.2.1",
60+
"karma": "~3.1.1",
61+
"karma-chrome-launcher": "~2.2.0",
6162
"karma-cli": "~1.0.1",
62-
"karma-coverage-istanbul-reporter": "^0.2.0",
63-
"karma-jasmine": "^1.1.2",
64-
"karma-jasmine-html-reporter": "^0.2.2",
65-
"less": "^2.7.2",
63+
"karma-coverage-istanbul-reporter": "^2.0.4",
64+
"karma-jasmine": "^2.0.1",
65+
"karma-jasmine-html-reporter": "^1.4.0",
66+
"less": "^3.8.1",
6667
"ncp": "^2.0.0",
67-
"ng-packagr": "^2.4.2",
68-
"protractor": "~5.1.0",
68+
"ng-packagr": "^4.4.0",
69+
"protractor": "~5.4.1",
6970
"rimraf": "^2.6.1",
70-
"rxjs": "^6.2.1",
71-
"ts-node": "^4.1.0",
72-
"tslint": "~5.8.0",
73-
"typescript": "2.7.2",
74-
"uglify-js": "^2.8.12",
71+
"rxjs": "^6.3.3",
72+
"ts-node": "^7.0.1",
73+
"tsickle": "^0.34.0",
74+
"tslib": "^1.9.3",
75+
"tslint": "~5.11.0",
76+
"typescript": "3.1.6",
77+
"uglify-js": "^3.4.9",
7578
"web-animations-js": "^2.2.5",
76-
"zone.js": "^0.8.26",
77-
"@angular-devkit/build-angular": "~0.6.8"
79+
"zone.js": "^0.8.26"
7880
},
7981
"angularCompilerOptions": {
8082
"skipTemplateCodegen": true,

‎src/app/date-picker/date-picker-directive.service.spec.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {DatePickerDirectiveService} from './date-picker-directive.service';
33
import {UtilsService} from '../common/services/utils/utils.service';
44

55
describe('Service: DatePickerDirective', () => {
6+
const fakeElement: HTMLElement = document.createElement('div');
7+
68
beforeEach(() => {
79
TestBed.configureTestingModule({
810
providers: [DatePickerDirectiveService, UtilsService]
@@ -11,21 +13,21 @@ describe('Service: DatePickerDirective', () => {
1113

1214
it('should check convertToElement method', inject([DatePickerDirectiveService, UtilsService],
1315
(service: DatePickerDirectiveService, stubUtilsService: UtilsService) => {
14-
stubUtilsService.closestParent = jasmine.createSpy('closestParent').and.returnValue('fakeElement');
16+
stubUtilsService.closestParent = jasmine.createSpy('closestParent').and.returnValue(fakeElement);
1517

1618
const baseElement = <any>{};
17-
const element1 = service.convertToHTMLElement({nativeElement: 'fakeElement'}, baseElement);
18-
expect(element1).toBe('fakeElement');
19+
const element1 = service.convertToHTMLElement({nativeElement: fakeElement}, baseElement);
20+
expect(element1).toBe(fakeElement);
1921
expect(stubUtilsService.closestParent).not.toHaveBeenCalled();
2022

2123
const element2 = service.convertToHTMLElement('.notFound', baseElement);
22-
expect(element2).toBe('fakeElement');
24+
expect(element2).toBe(<HTMLElement>fakeElement);
2325
expect(stubUtilsService.closestParent).toHaveBeenCalledWith(baseElement, '.notFound');
2426
}));
2527

2628
it('should check getConfig method', inject([DatePickerDirectiveService],
2729
(service: DatePickerDirectiveService) => {
28-
service.convertToHTMLElement = jasmine.createSpy('convertToHTMLElement').and.returnValue('fakeElement');
30+
service.convertToHTMLElement = jasmine.createSpy('convertToHTMLElement').and.returnValue(fakeElement);
2931

3032
const config1 = service.getConfig();
3133
expect(config1).toEqual({hideInputContainer: true});
@@ -38,7 +40,6 @@ describe('Service: DatePickerDirective', () => {
3840
});
3941
expect(service.convertToHTMLElement).not.toHaveBeenCalled();
4042

41-
const fakeElement = {};
4243
const config3 = service.getConfig({allowMultiSelect: true}, {nativeElement: fakeElement});
4344
expect(config3).toEqual({
4445
allowMultiSelect: true,
@@ -53,15 +54,15 @@ describe('Service: DatePickerDirective', () => {
5354
expect(config4).toEqual({
5455
allowMultiSelect: true,
5556
hideInputContainer: true,
56-
inputElementContainer: 'fakeElement'
57+
inputElementContainer: fakeElement
5758
});
5859
expect(service.convertToHTMLElement).toHaveBeenCalledWith(fakeAttachElementRef, fakeElement);
5960

6061
const config5 = service.getConfig({allowMultiSelect: true}, fakeElementRef, 'someSelector');
6162
expect(config5).toEqual({
6263
allowMultiSelect: true,
6364
hideInputContainer: true,
64-
inputElementContainer: 'fakeElement'
65+
inputElementContainer: fakeElement
6566
});
6667
expect(service.convertToHTMLElement).toHaveBeenCalledWith('someSelector', fakeElement);
6768
}));

‎src/app/day-calendar/day-calendar.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class DayCalendarService {
5757
map[day] = index;
5858

5959
return map;
60-
}, <{[key: number]: string}>{});
60+
}, <{[key: string]: number}>{});
6161
}
6262

6363
generateMonthArray(config: IDayCalendarConfigInternal, month: Moment, selected: Moment[]): IDay[][] {

‎src/app/month-calendar/month-calendar.component.ts

+4
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ export class MonthCalendarComponent implements OnInit, OnChanges, ControlValueAc
162162
this.yearMonths = this.monthCalendarService
163163
.generateYear(this.componentConfig, this.currentDateView, this.selected);
164164
this.inputValueType = this.utilsService.getInputType(this.inputValue, this.componentConfig.allowMultiSelect);
165+
} else {
166+
this.selected = [];
167+
this.yearMonths = this.monthCalendarService
168+
.generateYear(this.componentConfig, this.currentDateView, this.selected);
165169
}
166170

167171
this.cd.markForCheck();

0 commit comments

Comments
 (0)
Please sign in to comment.