Skip to content

Commit 95efc8b

Browse files
authored
Merge branch '15.1.x' into iminchev/fix-header-autosize-15.1.x
2 parents e8d958c + c07454b commit 95efc8b

File tree

5 files changed

+14
-52
lines changed

5 files changed

+14
-52
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 15.1.33
6+
7+
### General
8+
- `IgxButtonGroup`:
9+
- Reverted cancellable on `selected` and `deselected` events (added in 15.1.24) as it was breaking firing order and related handling.
10+
511
## 15.1.0
612

713
### New Features

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { IgxRippleModule } from '../directives/ripple/ripple.directive';
2323
import { IgxIconModule } from '../icon/public_api';
2424
import { takeUntil } from 'rxjs/operators';
2525
import { DisplayDensityBase, DisplayDensityToken, IDisplayDensityOptions } from '../core/density';
26-
import { CancelableEventArgs, IBaseEventArgs } from '../core/utils';
26+
import { IBaseEventArgs } from '../core/utils';
2727
import { mkenum } from '../core/utils';
2828

2929
/**
@@ -442,31 +442,27 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
442442
*/
443443
public _clickHandler(index: number) {
444444
const button = this.buttons[index];
445-
const args: IButtonGroupEventArgs = { cancel: false, button, index };
445+
const args: IButtonGroupEventArgs = { button, index };
446446

447447
if (!this.multiSelection) {
448448
this.buttons.forEach((b, i) => {
449449
if (i !== index && this.selectedIndexes.indexOf(i) !== -1) {
450-
this.deselected.emit({ cancel: false, button: b, index: i });
450+
this.deselected.emit({ button: b, index: i });
451451
}
452452
});
453453
}
454454

455455
if (this.selectedIndexes.indexOf(index) === -1) {
456+
this.selectButton(index);
456457
this.selected.emit(args);
457-
if(!args.cancel){
458-
this.selectButton(index);
459-
}
460458
} else {
459+
this.deselectButton(index);
461460
this.deselected.emit(args);
462-
if(!args.cancel){
463-
this.deselectButton(index);
464-
}
465461
}
466462
}
467463
}
468464

469-
export interface IButtonGroupEventArgs extends IBaseEventArgs, CancelableEventArgs {
465+
export interface IButtonGroupEventArgs extends IBaseEventArgs {
470466
button: IgxButtonDirective;
471467
index: number;
472468
}

projects/igniteui-angular/src/lib/buttonGroup/buttongroup.component.spec.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -146,47 +146,6 @@ describe('IgxButtonGroup', () => {
146146
expect(btnGroupInstance.deselected.emit).toHaveBeenCalled();
147147
});
148148

149-
it('should not select the button on click if event is canceled ', () => {
150-
const fixture = TestBed.createComponent(ButtonGroupWithSelectedButtonComponent);
151-
fixture.detectChanges();
152-
153-
const btnGroupInstance = fixture.componentInstance.buttonGroup;
154-
fixture.detectChanges();
155-
156-
btnGroupInstance.buttons[1].select();
157-
fixture.detectChanges();
158-
159-
btnGroupInstance.selected.subscribe((e) => {
160-
e.cancel = true;
161-
});
162-
fixture.detectChanges();
163-
164-
const button = fixture.debugElement.nativeElement.querySelector('button');
165-
button.click();
166-
fixture.detectChanges();
167-
168-
expect(btnGroupInstance.buttons[0].selected).toBe(false);
169-
});
170-
171-
it('should not deselect the button on click if event is canceled ', () => {
172-
const fixture = TestBed.createComponent(ButtonGroupWithSelectedButtonComponent);
173-
fixture.detectChanges();
174-
175-
const btnGroupInstance = fixture.componentInstance.buttonGroup;
176-
fixture.detectChanges();
177-
178-
btnGroupInstance.deselected.subscribe((e) => {
179-
e.cancel = true;
180-
});
181-
fixture.detectChanges();
182-
183-
const button = fixture.debugElement.nativeElement.querySelector('button');
184-
button.click();
185-
fixture.detectChanges();
186-
187-
expect(btnGroupInstance.buttons[0].selected).toBe(true);
188-
});
189-
190149
it('Button Group single selection', () => {
191150
const fixture = TestBed.createComponent(InitButtonGroupComponent);
192151
fixture.detectChanges();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ describe('IgxDateRangePicker', () => {
133133
mockDocument = {
134134
body: mockElement,
135135
defaultView: mockElement,
136+
documentElement: document.documentElement,
136137
createElement: () => mockElement,
137138
appendChild: () => { },
138139
// eslint-disable-next-line @typescript-eslint/no-unused-vars

projects/igniteui-angular/src/lib/services/overlay/overlay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ export class IgxOverlayService implements OnDestroy {
436436
info.settings.positionStrategy.position(
437437
info.elementRef.nativeElement.parentElement,
438438
{ width: info.initialSize.width, height: info.initialSize.height },
439-
document,
439+
this._document,
440440
true,
441441
info.settings.target);
442442
this.addModalClasses(info);

0 commit comments

Comments
 (0)