Skip to content

Commit

Permalink
Go to current changed place (#241)
Browse files Browse the repository at this point in the history
* changing go to current button position

* lint fix

* fixing e2e
  • Loading branch information
vlio20 authored Oct 13, 2017
1 parent ec692cd commit dd283c5
Show file tree
Hide file tree
Showing 33 changed files with 632 additions and 165 deletions.
17 changes: 17 additions & 0 deletions CAHNGELOG.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Changelog
All notable changes to this project will be documented in this file.

<a name="2.6.0"></a>
# [2.6.0] (2017-00-00)

### Features
- none

### UI/UX Changes
- Moving go to current button inside the navigation component (#commit).

### Bug Fixed
- none

### Breaking Changes
- Go to current button moved from input element to the navigation component (#commit).



<a name="2.5.1"></a>
# [2.5.1] (2017-10-12)

Expand Down
7 changes: 4 additions & 3 deletions e2e/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {$, $$, browser, by, element} from 'protractor';

export class DemoPage {
private popupSelector = 'body > div .dp-popup';
private popupSelector = '.dp-popup.dp-main';
body = $('body');
dayPickerInput = $('#datePicker input');
timePickerInput = $('#timePicker input');
daytimePickerInput = $('#daytimePicker input');
daytimeDirectiveInput = $('#daytimeDirective input');
dayDirectiveInput = $('#dayDirective input');
dayReactiveDirectivePickerInput = $('#datePickerDirDayReactive input');
dayDirectiveReactiveInput = $('#datePickerDirDayReactive input');
monthDirectiveInput = $('#datePickerDirMonth input');
timeSelectDirectiveInput = $('#timePickerDirDay input');
datePickerPopup = $(this.popupSelector);
Expand All @@ -28,7 +28,7 @@ export class DemoPage {
weekDayNames = $$(`${this.popupSelector} .dp-weekdays`);
weekDayInline = $$(`.dp-demo-container .dp-weekdays`);
calendarContainer = $$(`${this.popupSelector} .dp-calendar-container `);
currentLocationBtn = $(`#datePicker .dp-current-location-btn`);
currentLocationBtn = $(`${this.popupSelector} .dp-current-location-btn`);
themeOnRadio = $('#themeOn');
themeOffRadio = $('#themeOff');
openOnFocusRadioOn = $('#yesOpenOnFocus');
Expand All @@ -55,6 +55,7 @@ export class DemoPage {
yearFormat = $('#yearFormat');
localeOptions = $('#locale');
hideGoToCurrentRadio = $('#hideGoToCurrent');
showGoToCurrentRadio = $('#showGoToCurrent');
pickerEnabledRadio = $('#inputEnabledRadio');
pickerDisabledRadio = $('#inputDisabledRadio');
enableRequiredValidationRadio = $('#enableRequiredRadio');
Expand Down
File renamed without changes.
79 changes: 79 additions & 0 deletions e2e/current-btn-e2e.spec.ts
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);
});
});
Loading

0 comments on commit dd283c5

Please sign in to comment.