-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* changing go to current button position * lint fix * fixing e2e
- Loading branch information
Showing
33 changed files
with
632 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import {DemoPage} from './app.po'; | ||
import * as moment from 'moment'; | ||
import {browser, ElementFinder} from 'protractor'; | ||
|
||
describe('dpDayPicker dayPicker', () => { | ||
|
||
let page: DemoPage; | ||
|
||
beforeEach(() => { | ||
page = new DemoPage(); | ||
page.navigateTo(); | ||
}); | ||
|
||
it('should check if go to current location btn is working as expected', () => { | ||
const currentMonth = moment().format('MMM, YYYY'); | ||
const currentYear = moment().format('YYYY'); | ||
const prevMonth = moment().subtract(1, 'month').format('MMM, YYYY'); | ||
const prevYear = moment().subtract(1, 'year').format('YYYY'); | ||
|
||
const commonDayCalendar = (menu: ElementFinder, input: ElementFinder) => { | ||
menu.click(); | ||
input.click(); | ||
page.showGoToCurrentRadio.click(); | ||
expect(page.currentLocationBtn.isPresent()).toBe(true); | ||
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth); | ||
page.dayCalendarLeftNavBtn.click(); | ||
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(prevMonth); | ||
page.currentLocationBtn.click(); | ||
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth); | ||
page.dayCalendarNavHeaderBtn.click(); | ||
expect(page.dayCalendarNavMonthHeaderBtn.getText()).toEqual(currentYear); | ||
page.monthCalendarLeftNavBtn.click(); | ||
expect(page.dayCalendarNavMonthHeaderBtn.getText()).toEqual(prevYear); | ||
page.dayCalendarNavMonthHeaderBtn.click(); | ||
|
||
page.currentLocationBtn.click(); | ||
expect(page.dayCalendarNavHeaderBtn.getText()).toEqual(currentMonth); | ||
|
||
page.hideGoToCurrentRadio.click(); | ||
input.click(); | ||
expect(page.currentLocationBtn.isPresent()).toBe(false); | ||
page.dayCalendarNavHeaderBtn.click(); | ||
expect(page.currentLocationBtn.isPresent()).toBe(false); | ||
}; | ||
|
||
const commonMonth = (menu: ElementFinder, input?: ElementFinder) => { | ||
menu.click(); | ||
input.click(); | ||
page.showGoToCurrentRadio.click(); | ||
expect(page.currentLocationBtn.isPresent()).toBe(true); | ||
expect(page.deyCalendarMonthNavHeader.getText()).toEqual(currentYear); | ||
page.monthCalendarLeftNavBtn.click(); | ||
expect(page.deyCalendarMonthNavHeader.getText()).toEqual(prevYear); | ||
page.currentLocationBtn.click(); | ||
expect(page.deyCalendarMonthNavHeader.getText()).toEqual(currentYear); | ||
|
||
page.hideGoToCurrentRadio.click(); | ||
input.click(); | ||
expect(page.currentLocationBtn.isPresent()).toBe(false); | ||
}; | ||
|
||
commonDayCalendar(page.daytimePickerMenu, page.daytimePickerInput); | ||
commonDayCalendar(page.daytimeDirectiveMenu, page.daytimeDirectiveInput); | ||
|
||
commonDayCalendar(page.dayPickerMenu, page.dayPickerInput); | ||
commonDayCalendar(page.dayDirectiveMenu, page.dayDirectiveInput); | ||
commonDayCalendar(page.dayDirectiveReactiveMenu, page.dayDirectiveReactiveInput); | ||
|
||
commonMonth(page.monthPickerMenu, page.monthPickerInput); | ||
commonMonth(page.monthDirectiveMenu, page.monthDirectiveInput); | ||
}); | ||
|
||
it('should hide current date button when not between min and max', () => { | ||
page.dayPickerMenu.click(); | ||
page.minSelectableInput.sendKeys(moment().add(3, 'month').format('DD-MM-YYYY')); | ||
page.dayPickerInput.click(); | ||
expect(page.currentLocationBtn.isPresent()).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.