Skip to content

Commit 04dc9c5

Browse files
authored
Merge branch 'master' into bpenkov/mask-refactor
2 parents 54e804e + 20534c5 commit 04dc9c5

File tree

55 files changed

+5672
-4165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5672
-4165
lines changed

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ All notable changes for each version of this project will be documented in this
8383
- `IgxSelect`:
8484
- adding `IgxSelectHeaderDirective` and `IgxSelectFooterDirective`. These can be used to provide a custom header, respectively footer templates for the `igxSelect` drop-down list. If there are no templates marked with these directives - no default templates will be used so the drop-down list will not have header nor footer.
8585

86+
- `IgxCombo`:
87+
- Added `displayText` property to the combo's `onSelectionChange` event args. The property contains the text that will be populated in the combo's text box **after** selection completes. This text can be overwritten in order to display a custom message, e.g. "3 items selected":
88+
```html
89+
<igx-combo [data]="people" valueKey="id" displayKey="name" placeholder="Invite friends..." (onSelectionChange)="handleSelection($event)">
90+
```
91+
```typescript
92+
export class MyInvitationComponent {
93+
public people: { name: string; id: string }[] = [...];
94+
...
95+
handleSelection(event: IComboSelectionChangeEventArgs) {
96+
const count = event.newSelection.length;
97+
event.displayText = count > 0 ? `${count} friend(s) invited!` : `No friends invited :(`;
98+
}
99+
...
100+
}
101+
```
102+
86103
- `IgxDropDown`:
87104
- `clearSelection` method is added, which can be used to deselect the selected dropdown item
88105

package-lock.json

+2,905-1,412
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545
},
4646
"private": true,
4747
"dependencies": {
48-
"@angular/animations": "^9.0.0-rc.7",
49-
"@angular/common": "^9.0.0-rc.7",
50-
"@angular/compiler": "^9.0.0-rc.7",
51-
"@angular/core": "^9.0.0-rc.7",
52-
"@angular/forms": "^9.0.0-rc.7",
53-
"@angular/platform-browser": "^9.0.0-rc.7",
54-
"@angular/platform-browser-dynamic": "^9.0.0-rc.7",
55-
"@angular/router": "^9.0.0-rc.7",
48+
"@angular/animations": "^9.0.0-rc.10",
49+
"@angular/common": "^9.0.0-rc.10",
50+
"@angular/compiler": "^9.0.0-rc.10",
51+
"@angular/core": "^9.0.0-rc.10",
52+
"@angular/forms": "^9.0.0-rc.10",
53+
"@angular/platform-browser": "^9.0.0-rc.10",
54+
"@angular/platform-browser-dynamic": "^9.0.0-rc.10",
55+
"@angular/router": "^9.0.0-rc.10",
5656
"@types/hammerjs": "^2.0.36",
5757
"@types/source-map": "0.5.2",
5858
"classlist.js": "^1.1.20150312",
@@ -66,12 +66,12 @@
6666
"zone.js": "~0.10.2"
6767
},
6868
"devDependencies": {
69-
"@angular-devkit/build-angular": "~0.900.0-rc.7",
70-
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.7",
71-
"@angular-devkit/schematics": "^9.0.0-rc.7",
72-
"@angular/cli": "~9.0.0-rc.7",
73-
"@angular/compiler-cli": "^9.0.0-rc.7",
74-
"@angular/language-service": "^9.0.0-rc.7",
69+
"@angular-devkit/build-angular": "~0.900.0-rc.10",
70+
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.10",
71+
"@angular-devkit/schematics": "^9.0.0-rc.10",
72+
"@angular/cli": "~9.0.0-rc.10",
73+
"@angular/compiler-cli": "^9.0.0-rc.10",
74+
"@angular/language-service": "^9.0.0-rc.10",
7575
"@angularclass/hmr": "^2.1.3",
7676
"@types/jasmine": "~3.3.5",
7777
"@types/jasminewd2": "~2.0.6",
@@ -105,7 +105,7 @@
105105
"karma-junit-reporter": "~1.2.0",
106106
"karma-spec-reporter": "~0.0.32",
107107
"lunr": "^2.3.5",
108-
"ng-packagr": "^9.0.0-rc.1",
108+
"ng-packagr": "^9.0.0-rc.7",
109109
"pngcrush": "^2.0.1",
110110
"protractor": "~5.4.2",
111111
"sassdoc": "^2.5.1",
@@ -117,7 +117,7 @@
117117
"tslint": "~5.12.1",
118118
"typedoc": "^0.14.1",
119119
"typedoc-plugin-localization": "^1.4.1",
120-
"typescript": "~3.6.4",
120+
"typescript": "~3.7.5",
121121
"webpack-sources": "1.3.0"
122122
}
123123
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import { By } from '@angular/platform-browser';
2+
3+
export class HelperTestFunctions {
4+
public static DAYS_VIEW = 'igx-days-view';
5+
public static CALENDAR = 'igx-calendar';
6+
public static SELECTED_DATE = 'igx-calendar__date--selected';
7+
public static ICON_CSSCLASS = '.igx-icon';
8+
public static OVERLAY_CSSCLASS = '.igx-overlay';
9+
public static MODAL_OVERLAY_CSSCLASS = 'igx-overlay__wrapper--modal';
10+
11+
public static CALENDAR_CSSCLASS = '.igx-calendar';
12+
public static CALENDAR_HEADER_CSSCLASS = '.igx-calendar__header';
13+
public static CALENDAR_HEADER_YEAR_CSSCLASS = '.igx-calendar__header-year';
14+
public static CALENDAR_HEADER_DATE_CSSCLASS = '.igx-calendar__header-date';
15+
public static WEEKSTART_LABEL_CSSCLASS = '.igx-calendar__label';
16+
public static VERTICAL_CALENDAR_CSSCLASS = '.igx-calendar--vertical';
17+
public static DAY_CSSCLASS = '.igx-calendar__date';
18+
public static CURRENT_DATE_CSSCLASS = '.igx-calendar__date--current';
19+
public static INACTIVE_DAYS_CSSCLASS = '.igx-calendar__date--inactive';
20+
public static HIDDEN_DAYS_CSSCLASS = '.igx-calendar__date--hidden';
21+
public static SELECTED_DATE_CSSCLASS = '.igx-calendar__date--selected';
22+
public static RANGE_CSSCLASS = 'igx-calendar__date--range';
23+
public static CALENDAR_ROW_CSSCLASS = '.igx-calendar__body-row';
24+
public static CALENDAR_ROW_WRAP_CSSCLASS = '.igx-calendar__body-row--wrap';
25+
public static CALENDAR_COLUMN_CSSCLASS = '.igx-calendar__body-column';
26+
public static MONTH_CSSCLASS = '.igx-calendar__month';
27+
public static CURRENT_MONTH_CSSCLASS = '.igx-calendar__month--current';
28+
public static YEAR_CSSCLASS = '.igx-calendar__year';
29+
public static CURRENT_YEAR_CSSCLASS = '.igx-calendar__year--current';
30+
31+
public static CALENDAR_PREV_BUTTON_CSSCLASS = '.igx-calendar-picker__prev';
32+
public static CALENDAR_NEXT_BUTTON_CSSCLASS = '.igx-calendar-picker__next';
33+
public static CALENDAR_DATE_CSSCLASS = '.igx-calendar-picker__date';
34+
35+
public static CALENDAR_SUBHEADERS_SELECTOR =
36+
'div:not(' + HelperTestFunctions.CALENDAR_PREV_BUTTON_CSSCLASS + '):not(' + HelperTestFunctions.CALENDAR_NEXT_BUTTON_CSSCLASS + ')';
37+
38+
public static verifyMonthsViewNumber(fixture, monthsView: number, checkCurrentDate = false) {
39+
const el = fixture.nativeElement ? fixture.nativeElement : fixture;
40+
const daysView = el.querySelectorAll(HelperTestFunctions.DAYS_VIEW);
41+
expect(daysView).toBeDefined();
42+
expect(daysView.length).toBe(monthsView);
43+
const monthPickers = HelperTestFunctions.getCalendarSubHeader(el).querySelectorAll('div');
44+
expect(monthPickers.length).toBe(monthsView + 2); // plus the navigation arrows
45+
if (checkCurrentDate) {
46+
const currentDate = el.querySelector(HelperTestFunctions.CURRENT_DATE_CSSCLASS);
47+
expect(currentDate).not.toBeNull();
48+
}
49+
}
50+
51+
public static verifyCalendarHeader(fixture, selectedDate: Date) {
52+
const daysView = fixture.nativeElement.querySelector(HelperTestFunctions.CALENDAR_HEADER_CSSCLASS);
53+
expect(daysView).not.toBeNull();
54+
const year = fixture.nativeElement.querySelector(HelperTestFunctions.CALENDAR_HEADER_YEAR_CSSCLASS);
55+
expect(year).not.toBeNull();
56+
expect(Number(year.innerText)).toEqual(selectedDate.getFullYear());
57+
const date = fixture.nativeElement.querySelector(HelperTestFunctions.CALENDAR_HEADER_DATE_CSSCLASS);
58+
expect(date).not.toBeNull();
59+
const dateParts = selectedDate.toUTCString().split(' '); // (weekday, date month year)
60+
expect(date.children[0].innerText.trim()).toEqual(dateParts[0]);
61+
expect(date.children[1].innerText.trim()).toEqual(dateParts[2] + ' ' + Number(dateParts[1]));
62+
}
63+
64+
public static verifyNoRangeSelectionCreated(fixture, monthNumber: number) {
65+
expect(HelperTestFunctions.getMonthView(fixture, monthNumber).querySelector('.igx-calendar__date--range')).toBeNull();
66+
expect(HelperTestFunctions.getMonthView(fixture, monthNumber).querySelector('.igx-calendar__date--first')).toBeNull();
67+
expect(HelperTestFunctions.getMonthView(fixture, monthNumber).querySelector('.igx-calendar__date--last')).toBeNull();
68+
}
69+
70+
public static verifyCalendarSubHeader(fixture, monthNumber: number, viewDate: Date) {
71+
const monthPickers = HelperTestFunctions.getCalendarSubHeader(fixture).querySelectorAll('div');
72+
const dateParts = viewDate.toString().split(' '); // weekday month day year
73+
expect(monthPickers[monthNumber].children[0].innerHTML.trim()).toEqual(dateParts[1]);
74+
expect(monthPickers[monthNumber].children[1].innerHTML.trim()).toEqual(dateParts[3]);
75+
}
76+
77+
public static verifyCalendarSubHeaders(fixture, viewDates: Date[]) {
78+
const dom = fixture.nativeElement ? fixture.nativeElement : fixture;
79+
const monthPickers = HelperTestFunctions.getCalendarSubHeader(dom).querySelectorAll(this.CALENDAR_SUBHEADERS_SELECTOR);
80+
expect(monthPickers.length).toEqual(viewDates.length);
81+
for (let index = 0; index < viewDates.length; index++) {
82+
const dateParts = viewDates[index].toString().split(' '); // weekday month day year
83+
expect(monthPickers[index].children[0].innerHTML.trim()).toEqual(dateParts[1]);
84+
expect(monthPickers[index].children[1].innerHTML.trim()).toEqual(dateParts[3]);
85+
}
86+
}
87+
88+
public static getHiddenDays(fixture, monthNumber: number) {
89+
const monthView = HelperTestFunctions.getMonthView(fixture, monthNumber);
90+
return monthView.querySelectorAll(HelperTestFunctions.HIDDEN_DAYS_CSSCLASS);
91+
}
92+
93+
public static getInactiveDays(fixture, monthNumber: number) {
94+
const monthView = HelperTestFunctions.getMonthView(fixture, monthNumber);
95+
return monthView.querySelectorAll(HelperTestFunctions.INACTIVE_DAYS_CSSCLASS);
96+
}
97+
98+
public static getCalendarSubHeader(fixture): HTMLElement {
99+
const element = fixture.nativeElement ? fixture.nativeElement : fixture;
100+
return element.querySelector('div.igx-calendar-picker');
101+
}
102+
103+
public static getMonthView(fixture, monthsViewNumber: number) {
104+
const domEL = fixture.nativeElement ? fixture.nativeElement : fixture;
105+
return domEL.querySelectorAll('igx-days-view')[monthsViewNumber];
106+
}
107+
108+
public static getMonthViewDates(fixture, monthsViewNumber: number) {
109+
const month = HelperTestFunctions.getMonthView(fixture, monthsViewNumber);
110+
return month.querySelectorAll(HelperTestFunctions.DAY_CSSCLASS);
111+
}
112+
113+
public static getMonthViewInactiveDates(fixture, monthsViewNumber: number) {
114+
const month = HelperTestFunctions.getMonthView(fixture, monthsViewNumber);
115+
return month.querySelectorAll(HelperTestFunctions.INACTIVE_DAYS_CSSCLASS);
116+
}
117+
118+
public static getMonthViewSelectedDates(fixture, monthsViewNumber: number) {
119+
const month = HelperTestFunctions.getMonthView(fixture, monthsViewNumber);
120+
return month.querySelectorAll(HelperTestFunctions.SELECTED_DATE_CSSCLASS +
121+
`:not(${HelperTestFunctions.HIDDEN_DAYS_CSSCLASS})`);
122+
}
123+
124+
public static getMonthsFromMonthView(fixture) {
125+
return fixture.nativeElement.querySelector('igx-months-view')
126+
.querySelectorAll('.igx-calendar__month, .igx-calendar__month--current');
127+
}
128+
129+
public static getYearsFromYearView(fixture) {
130+
return fixture.nativeElement.querySelector('igx-years-view')
131+
.querySelectorAll('.igx-calendar__year, .igx-calendar__year--current');
132+
}
133+
134+
public static getCurrentYearsFromYearView(fixture) {
135+
return fixture.nativeElement.querySelector('igx-years-view')
136+
.querySelector('.igx-calendar__year--current');
137+
}
138+
139+
public static getNexArrowElement(fixture) {
140+
return fixture.debugElement.query(By.css(HelperTestFunctions.CALENDAR_NEXT_BUTTON_CSSCLASS)).nativeElement;
141+
}
142+
143+
public static getPreviousArrowElement(fixture) {
144+
return fixture.debugElement.query(By.css(HelperTestFunctions.CALENDAR_PREV_BUTTON_CSSCLASS)).nativeElement;
145+
}
146+
147+
public static verifyDateSelected(el) {
148+
expect(
149+
el.nativeElement.classList.contains(
150+
HelperTestFunctions.SELECTED_DATE
151+
)
152+
).toBe(true);
153+
}
154+
155+
public static verifyDateNotSelected(el) {
156+
expect(
157+
el.nativeElement.classList.contains(
158+
HelperTestFunctions.SELECTED_DATE
159+
)
160+
).toBe(false);
161+
}
162+
}

0 commit comments

Comments
 (0)