Skip to content

Commit ca88740

Browse files
authored
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
});

0 commit comments

Comments
 (0)