Skip to content

Commit 31e5d6c

Browse files
authored
Merge branch '8.2.x' into masenov/export-hierarchical-cell-82x
2 parents 25f7cd5 + 16ee6ad commit 31e5d6c

File tree

82 files changed

+1575
-424
lines changed

Some content is hidden

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

82 files changed

+1575
-424
lines changed

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
sudo: required
22
dist: xenial
33
addons:
4-
apt:
5-
sources:
6-
- google-chrome
7-
packages:
8-
- google-chrome-stable
4+
chrome: stable
95
services:
106
- xvfb
117
language: node_js

projects/igniteui-angular/karma.grid.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = function (config) {
4242
colors: true,
4343
logLevel: config.LOG_INFO,
4444
autoWatch: true,
45-
browsers: ['Chrome'],
45+
browsers: ['ChromeHeadless'],
4646
singleRun: false
4747
});
4848
};

projects/igniteui-angular/karma.hierarchical-grid.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function (config) {
4141
colors: true,
4242
logLevel: config.LOG_INFO,
4343
autoWatch: true,
44-
browsers: ['Chrome'],
44+
browsers: ['ChromeHeadless'],
4545
singleRun: false
4646
});
4747
};

projects/igniteui-angular/karma.non-grid.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function (config) {
4141
colors: true,
4242
logLevel: config.LOG_INFO,
4343
autoWatch: true,
44-
browsers: ['Chrome'],
44+
browsers: ['ChromeHeadless'],
4545
singleRun: false
4646
});
4747
};

projects/igniteui-angular/karma.test-perf.conf.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ module.exports = function (config) {
3535
colors: true,
3636
logLevel: config.LOG_INFO,
3737
autoWatch: true,
38-
browsers: ['Chrome'],
38+
browsers: ['ChromeHeadless'],
3939
singleRun: false
4040
});
4141
};
42-

projects/igniteui-angular/karma.tree-grid.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function (config) {
4141
colors: true,
4242
logLevel: config.LOG_INFO,
4343
autoWatch: true,
44-
browsers: ['Chrome'],
44+
browsers: ['ChromeHeadless'],
4545
singleRun: false
4646
});
4747
};

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"web-animations-js": "^2.3.2"
8080
},
8181
"devDependencies": {
82-
"igniteui-cli": "~4.2.0"
82+
"igniteui-cli": "~4.3.0"
8383
},
8484
"ng-update": {
8585
"migrations": "./migrations/migration-collection.json"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
Output
1313
} from '@angular/core';
1414
import { IgxIconModule } from '../icon/index';
15-
import { IBaseEventArgs } from '../core/utils';
15+
import { IBaseEventArgs, PlatformUtil } from '../core/utils';
1616

1717
let NEXT_ID = 0;
1818

@@ -202,7 +202,7 @@ export class IgxCarouselComponent implements OnDestroy {
202202
private _destroyed: boolean;
203203
private _total = 0;
204204

205-
constructor(private element: ElementRef) { }
205+
constructor(private element: ElementRef, private platformUtil: PlatformUtil) { }
206206
/**
207207
*@hidden
208208
*/
@@ -465,7 +465,7 @@ export class IgxCarouselComponent implements OnDestroy {
465465
private _restartInterval() {
466466
this._resetInterval();
467467

468-
if (!isNaN(this.interval) && this.interval > 0) {
468+
if (!isNaN(this.interval) && this.interval > 0 && this.platformUtil.isBrowser) {
469469
this._lastInterval = setInterval(() => {
470470
const tick = +this.interval;
471471
if (this._playing && this.total && !isNaN(tick) && tick > 0) {

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
<ng-content select="igx-hint, [igxHint]"></ng-content>
2626
</ng-container>
2727
<input igxInput #comboInput name="comboInput" type="text" [value]="value" readonly [attr.placeholder]="placeholder"
28-
[disabled]="disabled" (blur)="onBlur()" />
28+
[disabled]="disabled" (blur)="onBlur()" (focus)="onFocus()"/>
2929
<ng-container ngProjectAs="igx-suffix">
3030
<ng-content select="igx-suffix"></ng-content>
3131
</ng-container>
32-
<igx-suffix *ngIf="value.length" aria-label="Clear Selection" class="igx-combo__clear-button" igxRipple (click)="handleClearItems($event)">
32+
<igx-suffix *ngIf="value.length" aria-label="Clear Selection" class="igx-combo__clear-button" (click)="handleClearItems($event)">
3333
<ng-container *ngIf="clearIconTemplate">
3434
<ng-container *ngTemplateOutlet="clearIconTemplate"></ng-container>
3535
</ng-container>

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

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IgxToggleModule } from '../directives/toggle/toggle.directive';
77
import { IgxComboItemComponent } from './combo-item.component';
88
import { IgxComboComponent, IgxComboModule, IComboSelectionChangeEventArgs, IgxComboState } from './combo.component';
99
import { IgxComboDropDownComponent } from './combo-dropdown.component';
10-
import { FormGroup, FormControl, Validators, FormBuilder, ReactiveFormsModule, FormsModule } from '@angular/forms';
10+
import { FormGroup, FormControl, Validators, FormBuilder, ReactiveFormsModule, FormsModule, NgControl } from '@angular/forms';
1111
import { IForOfState } from '../directives/for-of/for_of.directive';
1212
import { BehaviorSubject, Observable } from 'rxjs';
1313
import { take } from 'rxjs/operators';
@@ -3302,6 +3302,25 @@ describe('igxCombo', () => {
33023302
fixture.detectChanges();
33033303
expect(component.selectedItems).toEqual([combo.data[0], combo.data[2], combo.data[4]]);
33043304
}));
3305+
3306+
it('Should have correctly bound focus and blur handlers', () => {
3307+
const fixture = TestBed.createComponent(IgxComboInTemplatedFormComponent);
3308+
fixture.detectChanges();
3309+
const combo = fixture.componentInstance.testCombo;
3310+
const input = fixture.debugElement.query(By.css(`${CSS_CLASS_INPUTGROUP} input`));
3311+
3312+
spyOn(combo, 'onFocus');
3313+
spyOn(combo, 'onBlur');
3314+
3315+
3316+
input.triggerEventHandler('focus', {});
3317+
expect(combo.onFocus).toHaveBeenCalled();
3318+
expect(combo.onFocus).toHaveBeenCalledWith();
3319+
3320+
input.triggerEventHandler('blur', {});
3321+
expect(combo.onBlur).toHaveBeenCalled();
3322+
expect(combo.onFocus).toHaveBeenCalledWith();
3323+
});
33053324
});
33063325

33073326
describe('Combo - Display Density', () => {
@@ -3374,6 +3393,66 @@ describe('igxCombo', () => {
33743393
});
33753394
});
33763395

3396+
describe('Combo ControlValueAccessor Unit', () => {
3397+
let combo: IgxComboComponent;
3398+
it('should correctly implement interface methods', () => {
3399+
const mockSelection: {
3400+
[key: string]: jasmine.Spy
3401+
} = jasmine.createSpyObj('IgxSelectionAPIService', ['get', 'set', 'add_items', 'select_items']);
3402+
const mockCdr = jasmine.createSpyObj('ChangeDetectorRef', ['markForCheck']);
3403+
const mockComboService = jasmine.createSpyObj('IgxComboAPIService', ['register']);
3404+
const mockNgControl = jasmine.createSpyObj('NgControl', ['registerOnChangeCb', 'registerOnTouchedCb']);
3405+
const mockInjector = jasmine.createSpyObj('Injector', {
3406+
'get': mockNgControl
3407+
});
3408+
mockSelection.get.and.returnValue(new Set([]));
3409+
3410+
// init
3411+
combo = new IgxComboComponent({ nativeElement: null }, mockCdr, mockSelection as any, mockComboService, null, mockInjector);
3412+
combo.ngOnInit();
3413+
expect(mockInjector.get).toHaveBeenCalledWith(NgControl, null);
3414+
combo.registerOnChange(mockNgControl.registerOnChangeCb);
3415+
combo.registerOnTouched(mockNgControl.registerOnTouchedCb);
3416+
3417+
// writeValue
3418+
expect(combo.value).toBe('');
3419+
mockSelection.add_items.and.returnValue(new Set(['test']));
3420+
spyOnProperty(combo, 'isRemote').and.returnValue(false);
3421+
combo.writeValue(['test']);
3422+
// TODO: Uncomment after fix for write value going through entire selection process
3423+
// expect(mockNgControl.registerOnChangeCb).not.toHaveBeenCalled();
3424+
expect(mockSelection.add_items).toHaveBeenCalledWith(combo.id, ['test'], true);
3425+
expect(mockSelection.select_items).toHaveBeenCalledWith(combo.id, ['test'], true);
3426+
expect(combo.value).toBe('test');
3427+
3428+
// setDisabledState
3429+
combo.setDisabledState(true);
3430+
expect(combo.disabled).toBe(true);
3431+
combo.setDisabledState(false);
3432+
expect(combo.disabled).toBe(false);
3433+
3434+
// OnChange callback
3435+
mockSelection.add_items.and.returnValue(new Set(['simpleValue']));
3436+
combo.selectItems(['simpleValue']);
3437+
expect(mockSelection.add_items).toHaveBeenCalledWith(combo.id, ['simpleValue'], undefined);
3438+
expect(mockSelection.select_items).toHaveBeenCalledWith(combo.id, ['simpleValue'], true);
3439+
expect(mockNgControl.registerOnChangeCb).toHaveBeenCalledWith(['simpleValue']);
3440+
3441+
// OnTouched callback
3442+
spyOnProperty(combo, 'collapsed').and.returnValue(true);
3443+
spyOnProperty(combo, 'valid', 'set');
3444+
3445+
combo.onFocus();
3446+
expect(mockNgControl.registerOnTouchedCb).toHaveBeenCalledTimes(1);
3447+
3448+
combo.onBlur();
3449+
expect(mockNgControl.registerOnTouchedCb).toHaveBeenCalledTimes(2);
3450+
});
3451+
3452+
it('should correctly handle ngControl validity', () => {
3453+
pending('Convert existing form test here');
3454+
});
3455+
});
33773456
@Component({
33783457
template: `
33793458
<igx-combo #combo

0 commit comments

Comments
 (0)