@@ -157,6 +157,30 @@ describe('Component Schematic', () => {
157
157
) . toBeRejectedWithError ( 'Selector "app-1-one" is invalid.' ) ;
158
158
} ) ;
159
159
160
+ it ( 'should allow dash in selector before a number' , async ( ) => {
161
+ const options = { ...defaultOptions , name : 'one-1' } ;
162
+
163
+ const tree = await schematicRunner . runSchematic ( 'component' , options , appTree ) ;
164
+ const content = tree . readContent ( '/projects/bar/src/app/one-1/one-1.component.ts' ) ;
165
+ expect ( content ) . toMatch ( / s e l e c t o r : ' a p p - o n e - 1 ' / ) ;
166
+ } ) ;
167
+
168
+ it ( 'should allow dash in selector before a number and with a custom prefix' , async ( ) => {
169
+ const options = { ...defaultOptions , name : 'one-1' , prefix : 'pre' } ;
170
+
171
+ const tree = await schematicRunner . runSchematic ( 'component' , options , appTree ) ;
172
+ const content = tree . readContent ( '/projects/bar/src/app/one-1/one-1.component.ts' ) ;
173
+ expect ( content ) . toMatch ( / s e l e c t o r : ' p r e - o n e - 1 ' / ) ;
174
+ } ) ;
175
+
176
+ it ( 'should allow dash in selector before a number and without a prefix' , async ( ) => {
177
+ const options = { ...defaultOptions , name : 'one-2' , selector : 'one-2' } ;
178
+
179
+ const tree = await schematicRunner . runSchematic ( 'component' , options , appTree ) ;
180
+ const content = tree . readContent ( '/projects/bar/src/app/one-2/one-2.component.ts' ) ;
181
+ expect ( content ) . toMatch ( / s e l e c t o r : ' o n e - 2 ' / ) ;
182
+ } ) ;
183
+
160
184
it ( 'should use the default project prefix if none is passed' , async ( ) => {
161
185
const options = { ...defaultOptions , prefix : undefined } ;
162
186
0 commit comments