@@ -41,18 +41,6 @@ describe('material-table-schematic', () => {
4141 expect ( componentContent ) . toContain ( 'FooDataSource' ) ;
4242 } ) ;
4343
44- it ( 'should support passing the style extension option' , ( ) => {
45- const tree = runner . runSchematic ( 'table' , { styleext : 'scss' , ...baseOptions } , createTestApp ( ) ) ;
46-
47- expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.scss' ) ;
48- } ) ;
49-
50- it ( 'should fallback to the default angular:component style extension' , ( ) => {
51- const tree = runner . runSchematic ( 'table' , baseOptions , createTestApp ( { style : 'less' } ) ) ;
52-
53- expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.less' ) ;
54- } ) ;
55-
5644 it ( 'should add table imports to module' , ( ) => {
5745 const tree = runner . runSchematic ( 'table' , baseOptions , createTestApp ( ) ) ;
5846 const moduleContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
@@ -65,4 +53,63 @@ describe('material-table-schematic', () => {
6553 `import { MatTableModule, MatPaginatorModule, MatSortModule } from '@angular/material';` ) ;
6654 } ) ;
6755
56+ describe ( 'styleext option' , ( ) => {
57+ it ( 'should respect the option value' , ( ) => {
58+ const tree = runner . runSchematic (
59+ 'table' , { styleext : 'scss' , ...baseOptions } , createTestApp ( ) ) ;
60+
61+ expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.scss' ) ;
62+ } ) ;
63+
64+ it ( 'should fallback to the @schematics/angular:component option value' , ( ) => {
65+ const tree = runner . runSchematic ( 'table' , baseOptions , createTestApp ( { style : 'less' } ) ) ;
66+
67+ expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.less' ) ;
68+ } ) ;
69+ } ) ;
70+
71+ describe ( 'inlineStyle option' , ( ) => {
72+ it ( 'should respect the option value' , ( ) => {
73+ const tree = runner . runSchematic (
74+ 'table' , { inlineStyle : true , ...baseOptions } , createTestApp ( ) ) ;
75+
76+ expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.css' ) ;
77+ } ) ;
78+
79+ it ( 'should fallback to the @schematics/angular:component option value' , ( ) => {
80+ const tree = runner . runSchematic ( 'table' , baseOptions , createTestApp ( { inlineStyle : true } ) ) ;
81+
82+ expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.css' ) ;
83+ } ) ;
84+ } ) ;
85+
86+ describe ( 'inlineTemplate option' , ( ) => {
87+ it ( 'should respect the option value' , ( ) => {
88+ const tree = runner . runSchematic (
89+ 'table' , { inlineTemplate : true , ...baseOptions } , createTestApp ( ) ) ;
90+
91+ expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.html' ) ;
92+ } ) ;
93+
94+ it ( 'should fallback to the @schematics/angular:component option value' , ( ) => {
95+ const tree = runner . runSchematic (
96+ 'table' , baseOptions , createTestApp ( { inlineTemplate : true } ) ) ;
97+
98+ expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.html' ) ;
99+ } ) ;
100+ } ) ;
101+
102+ describe ( 'spec option' , ( ) => {
103+ it ( 'should respect the option value' , ( ) => {
104+ const tree = runner . runSchematic ( 'table' , { spec : false , ...baseOptions } , createTestApp ( ) ) ;
105+
106+ expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.spec.ts' ) ;
107+ } ) ;
108+
109+ it ( 'should fallback to the @schematics/angular:component option value' , ( ) => {
110+ const tree = runner . runSchematic ( 'table' , baseOptions , createTestApp ( { skipTests : true } ) ) ;
111+
112+ expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.spec.ts' ) ;
113+ } ) ;
114+ } ) ;
68115} ) ;
0 commit comments