Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 4818a6c

Browse files
authored
test(dialog): Add test coverage for browser platform (#2119)
1 parent 8a89014 commit 4818a6c

12 files changed

Lines changed: 150 additions & 90 deletions

File tree

demos/src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const routes: Routes = [
2828
path: 'data-table-demo', loadChildren: () =>
2929
import('./components/data-table-demo/data-table.module').then(m => m.DataTableModule)
3030
},
31-
{path: 'dialog-demo', loadChildren: () => import('./components/dialog-demo/dialog.module').then(m => m.DialogModule)},
31+
{path: 'dialog-demo', loadChildren: () => import('./components/dialog/module').then(m => m.DialogModule)},
3232
{path: 'drawer-demo', loadChildren: () => import('./components/drawer-demo/drawer.module').then(m => m.DrawerModule)},
3333
{
3434
path: 'elevation-demo', loadChildren: () =>

demos/src/app/components/dialog-demo/dialog.module.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

demos/src/app/components/dialog-demo/routing.module.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

demos/src/app/components/dialog-demo/api.html renamed to demos/src/app/components/dialog/api.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,18 @@ <h4 mdcSubtitle2>MdcDialogConfig</h4>
7979
</tr>
8080
<tr>
8181
<td>autoFocus: boolean</td>
82-
<td>Whether the dialog should focus the first focusable element on open. (Default: true)</td>
82+
<td>Whether the dialog should focus the first focusable element on open.
83+
(Default: true)</td>
8384
</tr>
8485
<tr>
8586
<td>restoreFocus: boolean</td>
86-
<td>Whether the dialog should restore focus to the previously-focused element, after it's closed. (Default: true)</td>
87+
<td>Whether the dialog should restore focus to the previously-focused
88+
element, after it's closed. (Default: true)</td>
8789
</tr>
8890
<tr>
8991
<td>componentFactoryResolver?: ComponentFactoryResolver</td>
90-
<td>Allows for a different `ComponentFactoryResolver` to be passed in when creating a dialog.</td>
92+
<td>Allows for a different `ComponentFactoryResolver` to be passed in
93+
when creating a dialog.</td>
9194
</tr>
9295
<tr>
9396
<td>data: any</td>

demos/src/app/components/dialog-demo/dialog-form-demo.html renamed to demos/src/app/components/dialog/dialog-form-demo.html

File renamed without changes.

demos/src/app/components/dialog-demo/dialog-demo.ts renamed to demos/src/app/components/dialog/dialog.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Api {}
2020
export class Sass {}
2121

2222
@Component({template: '<component-viewer></component-viewer>'})
23-
export class DialogDemo implements OnInit {
23+
export class Dialog implements OnInit {
2424
@ViewChild(ComponentViewer, {static: true}) _componentViewer: ComponentViewer;
2525

2626
ngOnInit(): void {
@@ -84,7 +84,6 @@ export class Examples {
8484
const dialogRef = this.dialog.open(DialogConfirmation);
8585

8686
dialogRef.afterOpened().subscribe(() => {
87-
dialogRef.componentInstance.dialogComponent.layout();
8887
console.log('Dialog opened');
8988
});
9089

File renamed without changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {NgModule} from '@angular/core';
2+
3+
import {SharedModule} from '../../shared.module';
4+
import {RoutingModule, ROUTE_DECLARATIONS} from './routing.module';
5+
6+
import {
7+
DialogAlert,
8+
DialogConfirmation,
9+
DialogScrollable,
10+
DialogForm,
11+
DialogSimple
12+
} from './dialog';
13+
14+
@NgModule({
15+
imports: [
16+
RoutingModule,
17+
SharedModule
18+
],
19+
declarations: [
20+
ROUTE_DECLARATIONS,
21+
DialogAlert,
22+
DialogConfirmation,
23+
DialogForm,
24+
DialogScrollable,
25+
DialogSimple
26+
]
27+
})
28+
export class DialogModule {}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {NgModule} from '@angular/core';
2+
import {Routes, RouterModule} from '@angular/router';
3+
4+
import {Api, Examples, Usage, Sass, Dialog} from './dialog';
5+
6+
export const ROUTE_DECLARATIONS = [
7+
Api,
8+
Examples,
9+
Sass,
10+
Usage,
11+
Dialog
12+
];
13+
14+
const ROUTES: Routes = [
15+
{
16+
path: '', component: Dialog,
17+
children: [
18+
{path: '', redirectTo: 'usage'},
19+
{path: 'usage', component: Usage},
20+
{path: 'api', component: Api},
21+
{path: 'sass', component: Sass},
22+
{path: 'examples', component: Examples}
23+
]
24+
}
25+
];
26+
27+
@NgModule({
28+
imports: [RouterModule.forChild(ROUTES)],
29+
exports: [RouterModule]
30+
})
31+
export class RoutingModule {}
File renamed without changes.

0 commit comments

Comments
 (0)