Skip to content

Commit 0288f80

Browse files
authored
Merge branch 'master' into sstoychev/remove-deprecated-var
2 parents c9ae5f7 + dd67a82 commit 0288f80

File tree

3 files changed

+84
-3
lines changed

3 files changed

+84
-3
lines changed
Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,95 @@
1-
import { Component, ViewChild } from '@angular/core';
1+
import { Component, ViewChild, ViewChildren, QueryList } from '@angular/core';
22
import {
33
async,
44
TestBed
55
} from '@angular/core/testing';
66
import { FormsModule } from '@angular/forms';
77
import { By } from '@angular/platform-browser';
8+
import { IgxIconModule } from '../icon/index';
9+
import { IgxChipsModule } from './chips.module';
10+
import { IgxChipComponent } from './chip.component';
811
import { IgxChipsAreaComponent } from './chips-area.component';
912

13+
@Component({
14+
template: `
15+
<igx-chips-area #chipsArea>
16+
<igx-chip #chipElem *ngFor="let chip of chipList"
17+
[id]="chip.id" [draggable]="chip.draggable" [removable]="chip.removable" [selectable]="chip.selectable">
18+
<igx-icon igxPrefix fontSet="material" [name]="'drag_indicator'"></igx-icon>
19+
<span #label [class]="'igx-chip__text'">{{chip.text}}</span>
20+
<igx-icon class="igx-chip__dir-icon" igxConnector fontSet="material" [name]="'forward'"></igx-icon>
21+
</igx-chip>
22+
</igx-chips-area>
23+
`
24+
})
25+
export class TestChipComponent {
26+
27+
public chipList = [
28+
{ id: 'Country', text: 'Country', removable: false, selectable: false, draggable: true },
29+
{ id: 'City', text: 'City', removable: true, selectable: true, draggable: true }
30+
];
31+
32+
@ViewChild('chipsArea', { read: IgxChipsAreaComponent})
33+
public chipsArea: IgxChipsAreaComponent;
34+
35+
@ViewChildren('chipElem', { read: IgxChipComponent})
36+
public chips: QueryList<IgxChipComponent>;
37+
}
38+
1039
describe('IgxChipsArea', () => {
40+
const CHIP_ITEM_AREA = 'igx-chip__item chip-area';
41+
const CHIP_CONNECTOR = 'igx-chip__connecto';
42+
1143
beforeEach(async(() => {
1244
TestBed.configureTestingModule({
1345
declarations: [
46+
TestChipComponent
1447
],
15-
imports: []
48+
imports: [FormsModule, IgxIconModule, IgxChipsModule]
1649
}).compileComponents();
1750
}));
51+
52+
it('should add chips when adding data items ', () => {
53+
const fix = TestBed.createComponent(TestChipComponent);
54+
fix.detectChanges();
55+
56+
const chipArea = fix.debugElement.queryAll(By.directive(IgxChipsAreaComponent));
57+
const chipAreaComponent = fix.componentInstance;
58+
expect(chipArea[0].nativeElement.children.length).toEqual(2);
59+
60+
chipAreaComponent.chipList.push({ id: 'Town', text: 'Town', removable: true, selectable: true, draggable: true });
61+
62+
fix.detectChanges();
63+
64+
expect(chipArea[0].nativeElement.children.length).toEqual(3);
65+
});
66+
67+
it('should remove chips when removing data items ', () => {
68+
const fix = TestBed.createComponent(TestChipComponent);
69+
fix.detectChanges();
70+
71+
const chipArea = fix.debugElement.queryAll(By.directive(IgxChipsAreaComponent));
72+
const chipAreaComponent = fix.componentInstance;
73+
expect(chipArea[0].nativeElement.children.length).toEqual(2);
74+
75+
chipAreaComponent.chipList.pop();
76+
fix.detectChanges();
77+
78+
expect(chipArea[0].nativeElement.children.length).toEqual(1);
79+
});
80+
81+
it('should change data in chips when data item is changed', () => {
82+
const fix = TestBed.createComponent(TestChipComponent);
83+
fix.detectChanges();
84+
85+
const chipArea = fix.debugElement.queryAll(By.directive(IgxChipsAreaComponent));
86+
const chipAreaComponent = fix.componentInstance;
87+
88+
expect(chipArea[0].nativeElement.children[0].innerHTML).toContain('Country');
89+
90+
chipAreaComponent.chipList[0].text = 'New text';
91+
fix.detectChanges();
92+
93+
expect(chipArea[0].nativeElement.children[0].innerHTML).toContain('New text');
94+
});
1895
});

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@
391391
box-shadow: $grid-shadow;
392392
outline-style: none;
393393
overflow: hidden;
394+
395+
%cbx-display {
396+
min-width: rem(20px);
397+
}
394398
}
395399

396400
%grid-caption {

projects/igniteui-angular/src/lib/grid/groupby-row.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ng-container #defaultGroupRow (focus)="onFocus()" (blur)="onBlur()">
22
<div (click)="toggle()" igxRipple class="igx-grid__grouping-indicator" [tabIndex]="tabindex">
3-
<igx-icon *ngIf="!expanded" fontSet="material" name="expand_less"></igx-icon>
3+
<igx-icon *ngIf="!expanded" fontSet="material" name="chevron_right"></igx-icon>
44
<igx-icon *ngIf="expanded" fontSet="material" name="expand_more"></igx-icon>
55
</div>
66

0 commit comments

Comments
 (0)