Skip to content

Commit 1852432

Browse files
authored
Merge branch 'master' into mkirova/fix-6701-master
2 parents b30279f + fc1e564 commit 1852432

File tree

10 files changed

+823
-766
lines changed

10 files changed

+823
-766
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ All notable changes for each version of this project will be documented in this
122122
</igx-grid>
123123
```
124124
- `IgxSlider`:
125+
- **Breaking Change** - `isContinuous` - input has been deleted. The option is not supported anymore.
125126
- `primaryTicks` input was added. Which sets the number of primary ticks
126127
- `secondaryTicks` input was added. Which sets the number of secondary ticks.
127128
- `showTicks` input was added. Which show/hide all slider ticks and tick labels.
@@ -130,7 +131,6 @@ All notable changes for each version of this project will be documented in this
130131
- `ticksOrientation` input was added. Allows to change ticks orientation to top|bottom|mirror.
131132
- `tickLabelsOrientation` input was added. Allows you to change the rotation of all tick labels from horizontal to vertical(toptobottom, bottomtotop).
132133
- `igxSliderTickLabel` directive has been introduced. Allows you to set a custom template for all tick labels.
133-
- `isContinuous` - input has been deleted. The option is not supported anymore.
134134
- `onValueChanged` - new output has been exposed. This event is emitted at the end of every slide interaction.
135135

136136
- `IgxCarousel`:

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,13 @@ describe('IgxAutocomplete', () => {
682682
expect(dropDownAny.scrollContainer.getBoundingClientRect().width)
683683
.toEqual(group.element.nativeElement.getBoundingClientRect().width);
684684
});
685+
it('Should apply width to dropdown list if set', () => {
686+
UIInteractions.sendInput(input, 's', fixture);
687+
fixture.componentInstance.ddWidth = '600px';
688+
fixture.detectChanges();
689+
const dropDownAny = dropDown as any;
690+
expect(dropDownAny.scrollContainer.getBoundingClientRect().width).toEqual(600);
691+
});
685692
it('Should render aria attributes properly', fakeAsync(() => {
686693
expect(input.nativeElement.attributes['autocomplete'].value).toEqual('off');
687694
expect(input.nativeElement.attributes['role'].value).toEqual('combobox');
@@ -853,7 +860,7 @@ describe('IgxAutocomplete', () => {
853860
<label igxLabel for="towns">Towns</label>
854861
<igx-suffix igxRipple><igx-icon fontSet="material">clear</igx-icon> </igx-suffix>
855862
</igx-input-group>
856-
<igx-drop-down #townsPanel>
863+
<igx-drop-down #townsPanel [width]="ddWidth">
857864
<igx-drop-down-item *ngFor="let town of towns | startsWith:townSelected" [value]="town">
858865
{{town}}
859866
</igx-drop-down-item>
@@ -866,6 +873,7 @@ class AutocompleteComponent {
866873
@ViewChild(IgxDropDownComponent, { static: true }) public dropDown: IgxDropDownComponent;
867874
townSelected;
868875
public towns;
876+
public ddWidth = null;
869877
settings: AutocompleteOverlaySettings = null;
870878
onItemSelected(args) { }
871879

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
277277
if (this.disabled || !this.collapsed) {
278278
return;
279279
}
280-
this.target.width = this.parentElement.clientWidth + 'px';
280+
// if no drop-down width is set, the drop-down will be as wide as the autocomplete input;
281+
this.target.width = this.target.width || (this.parentElement.clientWidth + 'px');
281282
this.target.open(this.settings);
282283
this.target.onSelection.pipe(takeUntil(this.dropDownOpened$)).subscribe(this.select);
283284
this.target.onOpened.pipe(first()).subscribe(this.highlightFirstItem);

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-keyBoardNav.spec.ts

Lines changed: 730 additions & 582 deletions
Large diffs are not rendered by default.

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

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@ describe('IgxSlider', () => {
580580
fixture.detectChanges();
581581

582582
expect(sliderEl).toBeDefined();
583-
let activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-to--active'));
584-
expect(activeThumb).not.toBeNull();
583+
let activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-to--active'));
584+
expect(activeLabel).not.toBeNull();
585585

586586
sliderEl.triggerEventHandler('pointerup', {pointerId: 1, preventDefault: <any>((e: any) => {})});
587587
await wait(slider.thumbLabelVisibilityDuration + 10);
588588
fixture.detectChanges();
589589

590-
activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-to--active'));
591-
expect(activeThumb).toBeNull();
590+
activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-to--active'));
591+
expect(activeLabel).toBeNull();
592592
});
593593

594594
it('should be able to change thumbLabelVisibilityDuration', async() => {
@@ -599,20 +599,20 @@ describe('IgxSlider', () => {
599599
fixture.detectChanges();
600600

601601
expect(sliderEl).toBeDefined();
602-
let activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-to--active'));
603-
expect(activeThumb).not.toBeNull();
602+
let activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-to--active'));
603+
expect(activeLabel).not.toBeNull();
604604

605605
sliderEl.triggerEventHandler('pointerup', {pointerId: 1, preventDefault: <any>((e: any) => {})});
606606
await wait(750);
607607
fixture.detectChanges();
608608

609-
activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-to--active'));
610-
expect(activeThumb).not.toBeNull();
609+
activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-to--active'));
610+
expect(activeLabel).not.toBeNull();
611611

612612
await wait(300);
613613
fixture.detectChanges();
614-
activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-to--active'));
615-
expect(activeThumb).toBeNull();
614+
activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-to--active'));
615+
expect(activeLabel).toBeNull();
616616
});
617617

618618
it('rendering of the slider should corresponds to the set labels', () => {
@@ -846,20 +846,22 @@ describe('IgxSlider', () => {
846846

847847
it('labels should show/hide on pointer up/down', async() => {
848848
const sliderEl = fixture.debugElement.query(By.css(SLIDER_CLASS));
849+
fixture.detectChanges();
850+
849851
sliderEl.triggerEventHandler('pointerdown', { pointerId: 1, preventDefault: <any>((e: any) => {})});
850852
await wait(100);
851853
fixture.detectChanges();
852854

853855
expect(sliderEl).toBeDefined();
854-
let activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-from--active'));
855-
expect(activeThumb).not.toBeNull();
856+
let activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-from--active'));
857+
expect(activeLabel).not.toBeNull();
856858

857859
sliderEl.triggerEventHandler('pointerup', { pointerId: 1, preventDefault: <any>((e: any) => {})});
858860
await wait(slider.thumbLabelVisibilityDuration + 10);
859861
fixture.detectChanges();
860862

861-
activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-from--active'));
862-
expect(activeThumb).toBeNull();
863+
activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-from--active'));
864+
expect(activeLabel).toBeNull();
863865
});
864866

865867
it('should be able to change thumbLabelVisibilityDuration', async() => {
@@ -870,20 +872,20 @@ describe('IgxSlider', () => {
870872
fixture.detectChanges();
871873

872874
expect(sliderEl).toBeDefined();
873-
let activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-from--active'));
874-
expect(activeThumb).not.toBeNull();
875+
let activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-from--active'));
876+
expect(activeLabel).not.toBeNull();
875877

876878
sliderEl.dispatchEvent( new PointerEvent('pointerup', { pointerId: 1}));
877879
await wait(750);
878880
fixture.detectChanges();
879881

880-
activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-from--active'));
881-
expect(activeThumb).not.toBeNull();
882+
activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-from--active'));
883+
expect(activeLabel).not.toBeNull();
882884

883885
await wait(300);
884886
fixture.detectChanges();
885-
activeThumb = fixture.debugElement.query(By.css('.igx-slider__thumb-from--active'));
886-
expect(activeThumb).toBeNull();
887+
activeLabel = fixture.debugElement.query(By.css('.igx-slider__label-from--active'));
888+
expect(activeLabel).toBeNull();
887889
});
888890

889891
it('rendering of the slider should corresponds to the set labels', () => {
@@ -897,32 +899,32 @@ describe('IgxSlider', () => {
897899

898900
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', fromThumb.nativeElement, true);
899901
fixture.detectChanges();
900-
expect(fixture.componentInstance.label).toEqual({lower: 1, upper: 6});
902+
expect(fixture.componentInstance.slider.value).toEqual({lower: 1, upper: 6});
901903
expect(slider.lowerLabel).toEqual('Tuesday');
902904

903905
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', fromThumb.nativeElement, true);
904906
fixture.detectChanges();
905-
expect(fixture.componentInstance.label).toEqual({lower: 2, upper: 6});
907+
expect(fixture.componentInstance.slider.value).toEqual({lower: 2, upper: 6});
906908
expect(slider.lowerLabel).toEqual('Wednesday');
907909

908910
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', fromThumb.nativeElement, true);
909911
fixture.detectChanges();
910-
expect(fixture.componentInstance.label).toEqual({lower: 3, upper: 6});
912+
expect(fixture.componentInstance.slider.value).toEqual({lower: 3, upper: 6});
911913
expect(slider.lowerLabel).toEqual('Thursday');
912914

913915
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', fromThumb.nativeElement, true);
914916
fixture.detectChanges();
915-
expect(fixture.componentInstance.label).toEqual({lower: 4, upper: 6});
917+
expect(fixture.componentInstance.slider.value).toEqual({lower: 4, upper: 6});
916918
expect(slider.lowerLabel).toEqual('Friday');
917919

918920
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', toThumb.nativeElement, true);
919921
fixture.detectChanges();
920-
expect(fixture.componentInstance.label).toEqual({lower: 4, upper: 5});
922+
expect(fixture.componentInstance.slider.value).toEqual({lower: 4, upper: 5});
921923
expect(slider.upperLabel).toEqual('Saturday');
922924

923925
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', toThumb.nativeElement, true);
924926
fixture.detectChanges();
925-
expect(fixture.componentInstance.label).toEqual({lower: 4, upper: 4});
927+
expect(fixture.componentInstance.slider.value).toEqual({lower: 4, upper: 4});
926928
expect(slider.upperLabel).toEqual('Friday');
927929
});
928930

@@ -1743,19 +1745,21 @@ class SliderWithLabelsComponent {
17431745

17441746
@Component({
17451747
template: `
1746-
<igx-slider [(ngModel)]='label' [type]="type"
1747-
[labels]="['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']">
1748+
<igx-slider
1749+
[labels]="['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']"
1750+
[type]="type">
17481751
</igx-slider> `
17491752
})
17501753
class RangeSliderWithLabelsComponent {
1751-
@ViewChild(IgxSliderComponent, { read: IgxSliderComponent, static: true }) public slider: IgxSliderComponent;
1752-
public label;
1754+
@ViewChild(IgxSliderComponent, { read: IgxSliderComponent, static: true })
1755+
public slider: IgxSliderComponent;
1756+
17531757
public type = IgxSliderType.RANGE;
17541758
}
17551759

17561760
@Component({
17571761
template: `
1758-
<igx-slider [(ngModel)]='label' [type]="type"
1762+
<igx-slider [type]="type"
17591763
[labels]="['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']">
17601764
<ng-template igxSliderThumbFrom let-value let-labels="labels">
17611765
<span class="custom"> Lower {{ labels[value.lower] }}</span>

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

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
QueryList,
1212
ChangeDetectorRef,
1313
OnChanges,
14-
NgZone
14+
NgZone,
15+
AfterContentInit
1516
} from '@angular/core';
1617
import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
1718
import { EditorProvider } from '../core/edit-provider';
@@ -64,6 +65,7 @@ export class IgxSliderComponent implements
6465
EditorProvider,
6566
OnInit,
6667
AfterViewInit,
68+
AfterContentInit,
6769
OnChanges,
6870
OnDestroy {
6971

@@ -82,6 +84,7 @@ export class IgxSliderComponent implements
8284
private _continuous = false;
8385
private _disabled = false;
8486
private _step = 1;
87+
private _value: number | IRangeSliderValue = 0;
8588

8689
// ticks
8790
private _primaryTicks = 0;
@@ -616,18 +619,11 @@ export class IgxSliderComponent implements
616619
*/
617620
@Input()
618621
public set value(value: number | IRangeSliderValue) {
619-
if (!this.isRange) {
620-
this.upperValue = value as number - (value as number % this.step);
621-
} else {
622-
value = this.validateInitialValue(value as IRangeSliderValue);
623-
this.upperValue = (value as IRangeSliderValue).upper;
624-
this.lowerValue = (value as IRangeSliderValue).lower;
625-
}
626-
627-
this._onChangeCallback(this.value);
628-
629622
if (this._hasViewInit) {
623+
this.setValue(value);
630624
this.positionHandlersAndUpdateTrack();
625+
} else {
626+
this._value = value;
631627
}
632628
}
633629

@@ -992,6 +988,10 @@ export class IgxSliderComponent implements
992988
this._pMax = this.valueToFraction(this.upperBound) || 1;
993989
}
994990

991+
public ngAfterContentInit() {
992+
this.setValue(this._value);
993+
}
994+
995995
/**
996996
* @hidden
997997
*/
@@ -1413,6 +1413,18 @@ export class IgxSliderComponent implements
14131413
return isSliderWithDifferentValue || isRangeWithOneDifferentValue;
14141414
}
14151415

1416+
public setValue(value: number | IRangeSliderValue) {
1417+
if (!this.isRange) {
1418+
this.upperValue = value as number - (value as number % this.step);
1419+
} else {
1420+
value = this.validateInitialValue(value as IRangeSliderValue);
1421+
this.upperValue = (value as IRangeSliderValue).upper;
1422+
this.lowerValue = (value as IRangeSliderValue).lower;
1423+
}
1424+
1425+
this._onChangeCallback(this.value);
1426+
}
1427+
14161428
private emitValueChanged(oldValue: number | IRangeSliderValue) {
14171429
this.onValueChange.emit({ oldValue, value: this.value });
14181430
}

projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ export class GridFunctions {
17171717
}
17181718

17191719
public static simulateCellKeydown(cellComp: IgxGridCellComponent, keyName: string,
1720-
altKey = false, shiftKey = false, ctrlKey = false) {
1720+
altKey = false, shiftKey = false, ctrlKey = false) {
17211721
const keyboardEvent = new KeyboardEvent('keydown', {
17221722
key: keyName,
17231723
shiftKey: shiftKey,
@@ -1729,7 +1729,7 @@ export class GridFunctions {
17291729
}
17301730

17311731
public static simulateGroupRowKeydown(rowComp: IgxGridGroupByRowComponent, keyName: string,
1732-
altKey = false, shiftKey = false, ctrlKey = false) {
1732+
altKey = false, shiftKey = false, ctrlKey = false) {
17331733
const keyboardEvent = new KeyboardEvent('keydown', {
17341734
key: keyName,
17351735
shiftKey: shiftKey,

0 commit comments

Comments
 (0)