Skip to content

Commit ca27590

Browse files
committed
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular into mkirkova/fix-9116-master
2 parents 0b18498 + 408d294 commit ca27590

File tree

5 files changed

+178
-23
lines changed

5 files changed

+178
-23
lines changed

projects/igniteui-angular/migrations/update-12_0_0/changes/members.json

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,62 @@
595595
"definedIn": [
596596
"IgxRangePickerComponent"
597597
]
598+
},
599+
{
600+
"member": "showing",
601+
"replaceWith": "onOpening",
602+
"definedIn": [
603+
"IgxToastComponent"
604+
]
605+
},
606+
{
607+
"member": "shown",
608+
"replaceWith": "onOpened",
609+
"definedIn": [
610+
"IgxToastComponent"
611+
]
612+
},
613+
{
614+
"member": "hiding",
615+
"replaceWith": "onClosing",
616+
"definedIn": [
617+
"IgxToastComponent"
618+
]
619+
},
620+
{
621+
"member": "hidden",
622+
"replaceWith": "onClosed",
623+
"definedIn": [
624+
"IgxToastComponent"
625+
]
626+
},
627+
{
628+
"member": "show",
629+
"replaceWith": "open",
630+
"definedIn": [
631+
"IgxToastComponent"
632+
]
633+
},
634+
{
635+
"member": "hide",
636+
"replaceWith": "close",
637+
"definedIn": [
638+
"IgxToastComponent"
639+
]
640+
},
641+
{
642+
"member": "show",
643+
"replaceWith": "open",
644+
"definedIn": [
645+
"IgxSnackbarComponent"
646+
]
647+
},
648+
{
649+
"member": "hide",
650+
"replaceWith": "close",
651+
"definedIn": [
652+
"IgxSnackbarComponent"
653+
]
598654
}
599655
]
600-
}
656+
}

projects/igniteui-angular/migrations/update-12_0_0/changes/outputs.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,38 @@
12001200
"selector": "igx-date-range-picker",
12011201
"type": "component"
12021202
}
1203+
},
1204+
{
1205+
"name": "showing",
1206+
"replaceWith": "onOpening",
1207+
"owner": {
1208+
"selector": "igx-toast",
1209+
"type": "component"
1210+
}
1211+
},
1212+
{
1213+
"name": "shown",
1214+
"replaceWith": "onOpened",
1215+
"owner": {
1216+
"selector": "igx-toast",
1217+
"type": "component"
1218+
}
1219+
},
1220+
{
1221+
"name": "hiding",
1222+
"replaceWith": "onClosing",
1223+
"owner": {
1224+
"selector": "igx-toast",
1225+
"type": "component"
1226+
}
1227+
},
1228+
{
1229+
"name": "hidden",
1230+
"replaceWith": "onClosed",
1231+
"owner": {
1232+
"selector": "igx-toast",
1233+
"type": "component"
1234+
}
12031235
}
12041236
]
12051237
}

projects/igniteui-angular/migrations/update-12_0_0/index.spec.ts

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,68 @@ export class HGridMultiRowDragComponent {
15751575
}`);
15761576
});
15771577

1578+
it('should replace output names in toast', async () => {
1579+
appTree.create(
1580+
`/testSrc/appPrefix/component/test.component.html`,
1581+
`
1582+
<igx-toast (showing)="method()" (shown)="method()" (hiding)="method()" (hidden)="method()"></igx-toast>
1583+
`
1584+
);
1585+
1586+
const tree = await schematicRunner
1587+
.runSchematicAsync(migrationName, {}, appTree)
1588+
.toPromise();
1589+
1590+
expect(
1591+
tree.readContent('/testSrc/appPrefix/component/test.component.html')
1592+
).toEqual(
1593+
`
1594+
<igx-toast (onOpening)="method()" (onOpened)="method()" (onClosing)="method()" (onClosed)="method()"></igx-toast>
1595+
`
1596+
);
1597+
});
1598+
1599+
it('Should update toast output subscriptions', async () => {
1600+
pending('set up tests for migrations through lang service');
1601+
appTree.create(
1602+
'/testSrc/appPrefix/component/toast.component.ts', `
1603+
import { IgxToastComponent } from 'igniteui-angular';
1604+
import { Component, OnInit, ViewChild } from '@angular/core';
1605+
export class SimpleComponent {
1606+
@ViewChild('toast', { static: true })
1607+
public toast: IgxToastComponent;
1608+
1609+
public ngOnInit() {
1610+
this.toast.showing.subscribe();
1611+
this.toast.shown.subscribe();
1612+
this.toast.hiding.subscribe();
1613+
this.toast.hidden.subscribe();
1614+
this.toast.show();
1615+
this.toast.hide();
1616+
}
1617+
}`);
1618+
const tree = await schematicRunner.runSchematicAsync('migration-20', {}, appTree)
1619+
.toPromise();
1620+
1621+
expect(tree.readContent('/testSrc/appPrefix/component/toast.component.ts'))
1622+
.toEqual(`
1623+
import { IgxToastComponent } from 'igniteui-angular';
1624+
import { Component, OnInit, ViewChild } from '@angular/core';
1625+
export class SimpleComponent {
1626+
@ViewChild('toast', { static: true })
1627+
public toast: IgxToastComponent;
1628+
1629+
public ngOnInit() {
1630+
this.toast.onOpening.subscribe();
1631+
this.toast.onOpened.subscribe();
1632+
this.toast.onClosing.subscribe();
1633+
this.toast.onClosed.subscribe();
1634+
this.toast.open();
1635+
this.toast.close();
1636+
}
1637+
}`);
1638+
});
1639+
15781640
it('should rename DataType to GridColumnDataType', async () => {
15791641
appTree.create(
15801642
'/testSrc/appPrefix/component/test.component.ts',
@@ -1590,7 +1652,6 @@ export class HGridMultiRowDragComponent {
15901652
public dataType: DataType = DataType.Boolean;
15911653
}
15921654
`);
1593-
15941655
const tree = await schematicRunner
15951656
.runSchematicAsync(migrationName, {}, appTree)
15961657
.toPromise();

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

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ describe('IgxToast', () => {
5050

5151
it('should auto hide after it\'s open', fakeAsync(() => {
5252
spyOn(toast.onClosing, 'emit');
53-
toast.displayTime = 1000;
53+
toast.displayTime = 100;
5454

5555
toast.open();
56-
tick(1000);
56+
tick(100);
5757
expect(toast.onClosing.emit).toHaveBeenCalled();
5858
}));
5959

6060
it('should not auto hide after it\'s open', fakeAsync(() => {
6161
spyOn(toast.onClosing, 'emit');
62-
toast.displayTime = 1000;
62+
toast.displayTime = 100;
6363
toast.autoHide = false;
6464

6565
toast.open();
66-
tick(1000);
66+
tick(100);
6767
expect(toast.onClosing.emit).not.toHaveBeenCalled();
6868
}));
6969

@@ -81,31 +81,49 @@ describe('IgxToast', () => {
8181
});
8282

8383
it('should emit onOpened when toast is opened', fakeAsync(() => {
84+
toast.displayTime = 100;
85+
toast.autoHide = false;
8486
spyOn(toast.onOpened, 'emit');
8587
toast.open();
86-
tick(4000);
88+
tick(100);
8789
expect(toast.onOpened.emit).toHaveBeenCalled();
8890
}));
8991

9092
it('should emit onClosed when toast is closed', fakeAsync(() => {
93+
toast.displayTime = 100;
94+
toast.autoHide = false;
9195
spyOn(toast.onClosed, 'emit');
9296
toast.open();
9397
toast.close();
94-
tick(4000);
98+
tick(100);
9599
expect(toast.onClosed.emit).toHaveBeenCalled();
96100
}));
97101

98-
it('visibility is updated by the toggle() method', () => {
102+
it('visibility is updated by the toggle() method and isVisible setter', fakeAsync(() => {
103+
toast.displayTime = 100;
104+
toast.autoHide = false;
105+
99106
expect(toast.isVisible).toBeFalse();
100107
toast.toggle();
101-
fixture.detectChanges();
102108
expect(toast.isVisible).toBeTrue();
103-
});
109+
toast.isVisible = false;
110+
// Opening happens in a RAF
111+
tick(100);
112+
expect(toast.collapsed).toBeTrue();
113+
toast.isVisible = true;
114+
// Opening happens in a RAF
115+
tick(100);
116+
expect(toast.collapsed).toBeFalse();
117+
}));
104118

105119
it('can set message through show method', fakeAsync(() => {
106120
toast.displayTime = 100;
107121
toast.autoHide = false;
108122

123+
toast.message = 'Message';
124+
expect(toast.toastMessage).toBe('Message');
125+
expect(toast.message).toBe('Message');
126+
109127
toast.open('Custom Message');
110128
tick(100);
111129
fixture.detectChanges();

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,6 @@ export class IgxToastComponent extends IgxToggleDirective
328328
super.close();
329329
}
330330

331-
/**
332-
* Toggles the visible state of the toast.
333-
* ```typescript
334-
* this.toast.toggle();
335-
* ```
336-
*
337-
* @memberof IgxToastComponent
338-
*/
339-
public toggle() {
340-
super.toggle();
341-
}
342-
343331
/**
344332
* @hidden
345333
*/

0 commit comments

Comments
 (0)