Skip to content

Commit 4ea5445

Browse files
committed
feat(*): adding toast and snackbar migrations
1 parent 17e095c commit 4ea5445

File tree

3 files changed

+151
-1
lines changed

3 files changed

+151
-1
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,68 @@ export class HGridMultiRowDragComponent {
15721572
const rowComp: this.grid1.gridAPI.get_row_by_index(0) as RowType;
15731573
const treeRowComp: this.gridAPI.get_row_by_index(0) as RowType;
15741574
}
1575+
}`);
1576+
});
1577+
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+
}
15751637
}`);
15761638
});
15771639
});

0 commit comments

Comments
 (0)