Skip to content

Commit 0ec7763

Browse files
authored
Merge branch 'master' into dkamburov/expose-totalItemCount
2 parents b3f47b4 + 2b866c1 commit 0ec7763

File tree

10 files changed

+1426
-2561
lines changed

10 files changed

+1426
-2561
lines changed

projects/igniteui-angular/src/lib/chips/chip.spec.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { IgxSuffixDirective } from './../directives/suffix/suffix.directive';
1515
import { DisplayDensity } from '../core/displayDensity';
1616
import { UIInteractions, wait } from '../test-utils/ui-interactions.spec';
1717
import { configureTestSuite } from '../test-utils/configure-suite';
18+
import { ControlsFunction } from '../test-utils/controls-functions.spec';
1819

1920
@Component({
2021
template: `
@@ -129,7 +130,7 @@ describe('IgxChip', () => {
129130

130131
it('should render remove button when enabled after the content inside the chip', () => {
131132
const chipElems = fix.debugElement.queryAll(By.directive(IgxChipComponent));
132-
const chipRemoveButton = HelperTestFunctions.getDeleteButton(fix);
133+
const chipRemoveButton = ControlsFunction.getChipRemoveButton(chipElems[1].nativeElement);
133134

134135
// For this second chip there are 3 elements. The prefix, content span and the remove button icon .
135136
expect(chipElems[1].nativeElement.children[0].children.length).toEqual(4);
@@ -241,10 +242,10 @@ describe('IgxChip', () => {
241242

242243
it('should delete chip when space button is pressed on delete button', () => {
243244
HelperTestFunctions.verifyChipsCount(fix, 4);
244-
245-
const deleteButtonElement = HelperTestFunctions.getDeleteButton(fix);
245+
const chipElems = fix.debugElement.queryAll(By.directive(IgxChipComponent));
246+
const deleteButtonElement = ControlsFunction.getChipRemoveButton(chipElems[1].nativeElement);
246247
// Removes chip with id City, because country chip is unremovable
247-
UIInteractions.triggerKeyDownEvtUponElem(' ', deleteButtonElement.nativeElement, true);
248+
UIInteractions.triggerKeyDownEvtUponElem(' ', deleteButtonElement, true);
248249
fix.detectChanges();
249250

250251
HelperTestFunctions.verifyChipsCount(fix, 3);
@@ -257,9 +258,10 @@ describe('IgxChip', () => {
257258
it('should delete chip when enter button is pressed on delete button', () => {
258259
HelperTestFunctions.verifyChipsCount(fix, 4);
259260

260-
const deleteButtonElement = HelperTestFunctions.getDeleteButton(fix);
261+
const chipElems = fix.debugElement.queryAll(By.directive(IgxChipComponent));
262+
const deleteButtonElement = ControlsFunction.getChipRemoveButton(chipElems[1].nativeElement);
261263
// Removes chip with id City, because country chip is unremovable
262-
UIInteractions.triggerKeyDownEvtUponElem('Enter', deleteButtonElement.nativeElement, true);
264+
UIInteractions.triggerKeyDownEvtUponElem('Enter', deleteButtonElement, true);
263265
fix.detectChanges();
264266

265267
HelperTestFunctions.verifyChipsCount(fix, 3);
@@ -360,7 +362,8 @@ describe('IgxChip', () => {
360362
spyOn(secondChipComp.onSelection, 'emit');
361363
spyOn(secondChipComp.onSelectionDone, 'emit');
362364

363-
const chipRemoveButton = HelperTestFunctions.getDeleteButton(fix).nativeElement;
365+
const chipRemoveButton = ControlsFunction.getChipRemoveButton(secondChipComp.chipArea.nativeElement);
366+
364367
const removeBtnTop = chipRemoveButton.getBoundingClientRect().top;
365368
const removeBtnLeft = chipRemoveButton.getBoundingClientRect().left;
366369

@@ -400,12 +403,6 @@ describe('IgxChip', () => {
400403
});
401404

402405
class HelperTestFunctions {
403-
public static CHIP_REMOVE_BUTTON = '.igx-chip__remove';
404-
405-
public static getDeleteButton(fix, index = 0) {
406-
return fix.debugElement.queryAll(By.css(HelperTestFunctions.CHIP_REMOVE_BUTTON))[index];
407-
}
408-
409406
public static verifyChipsCount(fix, count) {
410407
const chipComponents = fix.debugElement.queryAll(By.directive(IgxChipComponent));
411408
expect(chipComponents.length).toEqual(count);

projects/igniteui-angular/src/lib/core/styles/base/utilities/_mixins.scss

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,20 @@
170170
/// Generates CSS variables for a given palette.
171171
/// @access private
172172
/// @param {Map} $palette - The igx palette to use to generate css variables for.
173+
/// @param {Map} $contrast [false] - Specifies if contrast colors should be generated for each color in the palette.
173174
///
174175
/// @example scss Generate css variables for the `$default-palette`.
175176
/// @include css-vars-from-palette($default-palette);
176177
///
177-
@mixin css-vars-from-palette($palette) {
178+
@mixin css-vars-from-palette($palette, $contrast: false) {
178179
@each $palette-name, $sub-palette in $palette {
179180
@each $variant, $color in $sub-palette {
181+
@if($contrast) {
182+
$color: text-contrast($color);
183+
}
184+
180185
@if type-of($color) != 'map' {
181-
--igx-#{$palette-name}-#{$variant}: #{$color};
186+
--igx-#{$palette-name}-#{$variant}#{if($contrast, -contrast, null)}: #{$color};
182187
}
183188
}
184189
}
@@ -187,16 +192,21 @@
187192
/// Generates CSS variables for a given palette.
188193
/// @access public
189194
/// @param {Map} $palette - The igx palette to use to generate css variables for.
195+
/// @param {Map} $contrast [false] - Specifies if the mixin outputs contrast colors for each color in the palette.
190196
///
191197
/// @example scss Generate css variables for the `$default-palette`.
192198
/// @include css-vars-from-palette($default-palette);
193199
///
194200
/// @requires {mixin} css-vars-from-palette
195-
@mixin igx-palette-vars($palette) {
201+
@mixin igx-palette-vars($palette, $contrast: false) {
196202
$scope: if(is-root(), ':root', '&');
197203

198204
#{$scope} {
199205
@include css-vars-from-palette($palette);
206+
207+
@if($contrast) {
208+
@include css-vars-from-palette($palette, $contrast: true);
209+
}
200210
}
201211
}
202212

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-advanced.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
IgxGridExternalAdvancedFilteringComponent,
1919
IgxGridAdvancedFilteringBindingComponent
2020
} from '../../test-utils/grid-samples.spec';
21+
import { ControlsFunction } from '../../test-utils/controls-functions.spec';
2122

2223
const ADVANCED_FILTERING_OPERATOR_LINE_AND_CSS_CLASS = 'igx-filter-tree__line--and';
2324
const ADVANCED_FILTERING_OPERATOR_LINE_OR_CSS_CLASS = 'igx-filter-tree__line--or';
@@ -2441,7 +2442,7 @@ describe('IgxGrid - Advanced Filtering #grid', () => {
24412442

24422443
// Press 'Enter' on the remove icon of the second chip.
24432444
const chip = GridFunctions.getAdvancedFilteringTreeExpressionChip(fix, [1]);
2444-
const removeIcon = chip.querySelector('.igx-chip__remove');
2445+
const removeIcon = ControlsFunction.getChipRemoveButton(chip);
24452446
UIInteractions.simulateKeyDownEvent(removeIcon, 'Enter');
24462447
tick(200);
24472448
fix.detectChanges();

0 commit comments

Comments
 (0)