Skip to content

Commit dd22e29

Browse files
authored
Merge branch '9.0.x' into PMiteva/fix-row-drag-tests-9.0
2 parents e990f59 + 6d37c90 commit dd22e29

32 files changed

+4112
-5744
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ All notable changes for each version of this project will be documented in this
106106
</igx-grid>
107107
```
108108
- `IgxSlider`:
109+
- **Breaking Change** - `isContinuous` - input has been deleted. The option is not supported anymore.
109110
- `primaryTicks` input was added. Which sets the number of primary ticks
110111
- `secondaryTicks` input was added. Which sets the number of secondary ticks.
111112
- `showTicks` input was added. Which show/hide all slider ticks and tick labels.
@@ -114,7 +115,6 @@ All notable changes for each version of this project will be documented in this
114115
- `ticksOrientation` input was added. Allows to change ticks orientation to top|bottom|mirror.
115116
- `tickLabelsOrientation` input was added. Allows you to change the rotation of all tick labels from horizontal to vertical(toptobottom, bottomtotop).
116117
- `igxSliderTickLabel` directive has been introduced. Allows you to set a custom template for all tick labels.
117-
- `isContinuous` - input has been deleted. The option is not supported anymore.
118118
- `onValueChanged` - new output has been exposed. This event is emitted at the end of every slide interaction.
119119

120120
- `IgxCarousel`:

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function typedocBuildExportFn(cb) {
184184
}
185185

186186
function typedocImportJsonFn(cb) {
187-
spawnSync('typedoc', [TYPEDOC.PROJECT_PATH, "--generate-from-json", TYPEDOC.EXPORT_JSON_PATH],
187+
spawnSync('typedoc', [TYPEDOC.PROJECT_PATH, "--generate-from-json", TYPEDOC.EXPORT_JSON_PATH, "--warns"],
188188
{ stdio: 'inherit', shell: true});
189189
cb();
190190
}
@@ -206,6 +206,7 @@ function typedocBuildDocsJA (cb) {
206206
slash(path.join(__dirname, 'i18nRepo', 'typedoc', 'ja')),
207207
'--templateStrings',
208208
TYPEDOC.TEMPLATE_STRINGS_PATH,
209+
'--warns',
209210
'--localize',
210211
'jp'], { stdio: 'inherit', shell: true });
211212

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"ts-node": "~7.0.1",
116116
"tslint": "~5.12.1",
117117
"typedoc": "^0.16.9",
118-
"typedoc-plugin-localization": "^1.6.1",
118+
"typedoc-plugin-localization": "^2.2.0",
119119
"typescript": "~3.7.5",
120120
"webpack-sources": "1.3.0"
121121
}

projects/igniteui-angular/src/lib/calendar/calendar-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
620620
* Deselects date(s) (based on the selection type).
621621
*/
622622
public deselectDate(value?: Date | Date[]) {
623-
if (this.selectedDates === null || this.selectedDates.length === 0) {
623+
if (!this.selectedDates || this.selectedDates.length === 0) {
624624
return;
625625
}
626626

projects/igniteui-angular/src/lib/calendar/calendar.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
316316
/**
317317
* Sets the header template.
318318
*
319-
* @example
319+
* @example
320320
* ```html
321321
* <igx-calendar headerTemplateDirective = "igxCalendarHeader"></igx-calendar>
322322
* ```

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 1904 additions & 2994 deletions
Large diffs are not rendered by default.

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_toast.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ $_bootstrap-toast: extend(
5656
(
5757
variant: 'bootstrap',
5858
background: #fff,
59+
60+
text-color: (
61+
igx-color: ('grays', 600)
62+
)
5963
)
6064
);
6165

projects/igniteui-angular/src/lib/date-picker/date-picker.component.html

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
11
<ng-template #readOnlyDatePickerTemplate>
2-
<igx-input-group (click)="openDialog()">
2+
<igx-input-group (click)="openDialog()" (mousedown)="mouseDown($event)">
33
<igx-prefix>
44
<igx-icon>today</igx-icon>
55
</igx-prefix>
66
<label *ngIf="labelVisibility" igxLabel>{{label}}</label>
7-
<input #readonlyInput class="igx-date-picker__input-date" igxInput [value]="displayData || ''"
8-
[disabled]="disabled" readonly />
7+
<input
8+
class="igx-date-picker__input-date"
9+
igxInput
10+
[value]="displayData || ''"
11+
[disabled]="disabled"
12+
(blur)="onBlur($event)"
13+
readonly
14+
/>
915
</igx-input-group>
1016
</ng-template>
1117

1218
<ng-template #editableDatePickerTemplate>
13-
<igx-input-group #editableInputGroup [supressInputAutofocus]="true">
19+
<igx-input-group #editableInputGroup [supressInputAutofocus]="true" (mousedown)="mouseDown($event)">
1420
<igx-prefix (click)="openDialog(editableInputGroup.element.nativeElement)">
1521
<igx-icon>today</igx-icon>
1622
</igx-prefix>
1723
<label *ngIf="labelVisibility" igxLabel>{{label}}</label>
18-
<input #editableInput class="igx-date-picker__input-date" igxInput [igxTextSelection]="true"
19-
type="text" [value]="transformedDate"
20-
[igxMask]="inputMask" [placeholder]="mask" [disabled]="disabled" [displayValuePipe]="displayValuePipe"
21-
[focusedValuePipe]="inputValuePipe" (blur)="onBlur($event)" (wheel)="onWheel($event)"
22-
(input)="onInput($event)" (focus)="onFocus()" />
24+
<input
25+
class="igx-date-picker__input-date"
26+
igxInput
27+
[igxTextSelection]="true"
28+
type="text"
29+
[value]="transformedDate"
30+
[igxMask]="inputMask"
31+
[placeholder]="mask"
32+
[disabled]="disabled"
33+
[displayValuePipe]="displayValuePipe"
34+
[focusedValuePipe]="inputValuePipe"
35+
(blur)="onBlur($event)"
36+
(wheel)="onWheel($event)"
37+
(input)="onInput($event)"
38+
(focus)="onFocus()"
39+
/>
2340
<igx-suffix *ngIf="!isEmpty" (click)="clear()">
2441
<igx-icon>clear</igx-icon>
2542
</igx-suffix>

projects/igniteui-angular/src/lib/date-picker/date-picker.component.spec.ts

Lines changed: 128 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
import { Component, ViewChild, ElementRef } from '@angular/core';
1+
import { Component, ViewChild, ElementRef, EventEmitter } from '@angular/core';
22
import { async, fakeAsync, TestBed, tick, flush, ComponentFixture } from '@angular/core/testing';
3-
import { FormsModule, FormGroup, FormBuilder, FormControl, ReactiveFormsModule} from '@angular/forms';
3+
import { FormsModule, FormGroup, FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
44
import { By } from '@angular/platform-browser';
55
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
66
import { IgxDatePickerComponent, IgxDatePickerModule } from './date-picker.component';
77
import { IgxLabelDirective } from '../directives/label/label.directive';
8-
import { IgxInputDirective } from '../directives/input/input.directive';
8+
import { IgxInputDirective, IgxInputState } from '../directives/input/input.directive';
99
import { UIInteractions, wait } from '../test-utils/ui-interactions.spec';
10-
import { IgxInputGroupModule } from '../input-group';
10+
import { IgxInputGroupModule, IgxInputGroupComponent } from '../input-group';
1111
import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive';
1212
import { configureTestSuite } from '../test-utils/configure-suite';
1313
import { IgxButtonModule } from '../directives/button/button.directive';
1414
import { IgxCalendarModule } from '../calendar';
1515
import { InteractionMode } from '../core/enums';
1616
import { DateRangeType } from '../core/dates/dateRange';
17+
import { OverlayCancelableEventArgs, OverlayEventArgs, OverlayClosingEventArgs, HorizontalAlignment, VerticalAlignment } from '../services';
1718

1819
describe('IgxDatePicker', () => {
1920
configureTestSuite();
@@ -1262,38 +1263,133 @@ describe('IgxDatePicker', () => {
12621263

12631264
describe('Reactive form', () => {
12641265
let fixture: ComponentFixture<IgxDatePickerReactiveFormComponent>;
1265-
let datePicker: IgxDatePickerComponent;
1266+
let datePickerOnChangeComponent: IgxDatePickerComponent;
1267+
let datePickerOnBlurComponent: IgxDatePickerComponent;
12661268

12671269
beforeEach(() => {
12681270
fixture = TestBed.createComponent(IgxDatePickerReactiveFormComponent);
1269-
datePicker = fixture.componentInstance.datePicker;
1271+
datePickerOnChangeComponent = fixture.componentInstance.datePickerOnChangeComponent;
1272+
datePickerOnBlurComponent = fixture.componentInstance.datePickerOnBlurComponent;
12701273
fixture.detectChanges();
12711274
});
12721275

1273-
// Bug #6025 Date picker does not disable in reactive form
1274-
it('Should disable when form is disabled', fakeAsync(() => {
1276+
it('Should set date picker status to invalid when it is required and has no value', fakeAsync(() => {
1277+
const inputGroupsElements = fixture.debugElement.queryAll(By.directive(IgxInputDirective));
1278+
const inputGroupElement = inputGroupsElements.find(d => d.componentInstance === datePickerOnChangeComponent);
1279+
const inputDirective = inputGroupElement.injector.get(IgxInputDirective) as IgxInputDirective;
1280+
1281+
expect(inputDirective.valid).toEqual(IgxInputState.INITIAL);
1282+
1283+
datePickerOnChangeComponent.value = null;
12751284
fixture.detectChanges();
1276-
const formGroup: FormGroup = fixture.componentInstance.reactiveForm;
1277-
const inputGroup = fixture.debugElement.query(By.css('.igx-input-group'));
12781285

1279-
inputGroup.nativeElement.click();
1280-
tick();
1286+
expect(inputDirective.valid).toEqual(IgxInputState.INVALID);
1287+
}));
1288+
1289+
it('Should set date picker status to invalid when it is required and has no value onBlur', fakeAsync(() => {
1290+
datePickerOnBlurComponent.mode = InteractionMode.DropDown;
1291+
datePickerOnBlurComponent.mask = 'dd/mm/yyyy';
1292+
datePickerOnBlurComponent.inputMask = 'dd/mm/yyyy';
12811293
fixture.detectChanges();
1282-
expect(datePicker.collapsed).toBeFalsy();
12831294

1284-
datePicker.closeCalendar();
1295+
const inputDirectiveElements = fixture.debugElement.queryAll(By.directive(IgxInputDirective));
1296+
const inputDirectiveElement = inputDirectiveElements.find(d => d.componentInstance === datePickerOnBlurComponent);
1297+
const inputDirective = inputDirectiveElement.injector.get(IgxInputDirective) as IgxInputDirective;
1298+
1299+
expect(inputDirective.valid).toEqual(IgxInputState.INITIAL);
1300+
1301+
inputDirectiveElement.triggerEventHandler('focus', {});
12851302
fixture.detectChanges();
12861303

1287-
formGroup.disable();
1288-
tick();
1304+
expect(inputDirective.valid).toEqual(IgxInputState.INITIAL);
1305+
1306+
datePickerOnBlurComponent.value = null;
12891307
fixture.detectChanges();
1308+
expect(inputDirective.valid).toEqual(IgxInputState.INITIAL);
12901309

1291-
inputGroup.nativeElement.click();
1292-
tick();
1310+
inputDirectiveElement.triggerEventHandler('blur', { target: { value: ''}});
12931311
fixture.detectChanges();
1294-
const dateDropDown = document.getElementsByClassName('igx-date-picker--dropdown');
1295-
expect(dateDropDown.length).toEqual(0);
1312+
1313+
expect(inputDirective.valid).toEqual(IgxInputState.INVALID);
12961314
}));
1315+
1316+
// Bug #6025 Date picker does not disable in reactive form
1317+
it('Should disable when form is disabled', () => {
1318+
const formGroup: FormGroup = fixture.componentInstance.reactiveForm;
1319+
const inputGroupsElements = fixture.debugElement.queryAll(By.directive(IgxInputDirective));
1320+
const inputGroupElement = inputGroupsElements.find(d => d.componentInstance === datePickerOnBlurComponent);
1321+
const inputDirective = inputGroupElement.injector.get(IgxInputDirective) as IgxInputDirective;
1322+
expect(inputDirective.disabled).toBeFalsy();
1323+
1324+
formGroup.disable();
1325+
fixture.detectChanges();
1326+
expect(inputDirective.disabled).toBeTruthy();
1327+
});
1328+
});
1329+
1330+
describe('Control value accessor unit tests', () => {
1331+
let ngModel;
1332+
let overlay;
1333+
let element;
1334+
let cdr;
1335+
let moduleRef;
1336+
let injector;
1337+
let inputGroup: IgxInputGroupComponent;
1338+
1339+
beforeEach(() => {
1340+
ngModel = {
1341+
control: { touched: false, dirty: false, validator: null },
1342+
valid: false,
1343+
statusChanges: new EventEmitter(),
1344+
};
1345+
overlay = {
1346+
onOpening: new EventEmitter<OverlayCancelableEventArgs>(),
1347+
onOpened: new EventEmitter<OverlayEventArgs>(),
1348+
onClosed: new EventEmitter<OverlayEventArgs>(),
1349+
onClosing: new EventEmitter<OverlayClosingEventArgs>()
1350+
};
1351+
element = {};
1352+
cdr = {
1353+
markForCheck: () => {},
1354+
detectChanges: () => {},
1355+
detach: () => {},
1356+
reattach: () => {}
1357+
};
1358+
moduleRef = {};
1359+
injector = { get: () => ngModel };
1360+
inputGroup = new IgxInputGroupComponent(null, null);
1361+
});
1362+
1363+
it('should initialize date picker with required correctly', () => {
1364+
const datePicker = new IgxDatePickerComponent(overlay, element, cdr, moduleRef, injector);
1365+
datePicker['inputGroup'] = inputGroup;
1366+
ngModel.control.validator = () => ({ required: true});
1367+
datePicker.ngOnInit();
1368+
datePicker.ngAfterViewInit();
1369+
datePicker.ngAfterViewChecked();
1370+
1371+
expect(datePicker).toBeDefined();
1372+
expect(inputGroup.isRequired).toBeTruthy();
1373+
});
1374+
1375+
it('should update inputGroup isRequired correctly', () => {
1376+
const datePicker = new IgxDatePickerComponent(overlay, element, cdr, moduleRef, injector);
1377+
datePicker['inputGroup'] = inputGroup;
1378+
datePicker.ngOnInit();
1379+
datePicker.ngAfterViewInit();
1380+
datePicker.ngAfterViewChecked();
1381+
1382+
expect(datePicker).toBeDefined();
1383+
expect(inputGroup.isRequired).toBeFalsy();
1384+
1385+
ngModel.control.validator = () => ({ required: true});
1386+
ngModel.statusChanges.emit();
1387+
expect(inputGroup.isRequired).toBeTruthy();
1388+
1389+
ngModel.control.validator = () => ({ required: false});
1390+
ngModel.statusChanges.emit();
1391+
expect(inputGroup.isRequired).toBeFalsy();
1392+
});
12971393
});
12981394
});
12991395

@@ -1444,23 +1540,27 @@ export class IgxDatePickerOpeningComponent {
14441540
@Component({
14451541
template: `
14461542
<form [formGroup]="reactiveForm">
1447-
<p>
1448-
<igx-date-picker formControlName="datePickerReactive" #datePickerReactive></igx-date-picker>
1449-
</p>
1450-
</form>
1543+
<igx-date-picker formControlName="datePickerOnChange" #datePickerOnChangeComponent></igx-date-picker>
1544+
<igx-date-picker formControlName="datePickerOnBlur" #datePickerOnBlurComponent></igx-date-picker>
1545+
</form>
14511546
`
14521547
})
14531548
class IgxDatePickerReactiveFormComponent {
1454-
@ViewChild('datePickerReactive', { read: IgxDatePickerComponent, static: true })
1455-
public datePicker: IgxDatePickerComponent;
1549+
@ViewChild('datePickerOnChangeComponent', { read: IgxDatePickerComponent, static: true })
1550+
public datePickerOnChangeComponent: IgxDatePickerComponent;
1551+
1552+
@ViewChild('datePickerOnBlurComponent', { read: IgxDatePickerComponent, static: true })
1553+
public datePickerOnBlurComponent: IgxDatePickerComponent;
1554+
14561555
reactiveForm: FormGroup;
14571556

14581557
constructor(fb: FormBuilder) {
1558+
const date = new Date(2000, 10, 15);
14591559
this.reactiveForm = fb.group({
1460-
datePickerReactive: new FormControl(''),
1560+
datePickerOnChange: [date, Validators.required],
1561+
datePickerOnBlur: [date, { updateOn: 'blur', validators: Validators.required}]
14611562
});
14621563
}
1463-
onSubmitReactive() { }
14641564
}
14651565

14661566
@Component({

0 commit comments

Comments
 (0)