@@ -208,6 +208,30 @@ describe('Component Schematic', () => {
208208 ) . toBeRejectedWithError ( 'Selector "app-1-one" is invalid.' ) ;
209209 } ) ;
210210
211+ it ( 'should allow dash in selector before a number' , async ( ) => {
212+ const options = { ...defaultOptions , name : 'one-1' } ;
213+
214+ const tree = await schematicRunner . runSchematic ( 'component' , options , appTree ) ;
215+ const content = tree . readContent ( '/projects/bar/src/app/one-1/one-1.component.ts' ) ;
216+ expect ( content ) . toMatch ( / s e l e c t o r : ' a p p - o n e - 1 ' / ) ;
217+ } ) ;
218+
219+ it ( 'should allow dash in selector before a number and with a custom prefix' , async ( ) => {
220+ const options = { ...defaultOptions , name : 'one-1' , prefix : 'pre' } ;
221+
222+ const tree = await schematicRunner . runSchematic ( 'component' , options , appTree ) ;
223+ const content = tree . readContent ( '/projects/bar/src/app/one-1/one-1.component.ts' ) ;
224+ expect ( content ) . toMatch ( / s e l e c t o r : ' p r e - o n e - 1 ' / ) ;
225+ } ) ;
226+
227+ it ( 'should allow dash in selector before a number and without a prefix' , async ( ) => {
228+ const options = { ...defaultOptions , name : 'one-2' , selector : 'one-2' } ;
229+
230+ const tree = await schematicRunner . runSchematic ( 'component' , options , appTree ) ;
231+ const content = tree . readContent ( '/projects/bar/src/app/one-2/one-2.component.ts' ) ;
232+ expect ( content ) . toMatch ( / s e l e c t o r : ' o n e - 2 ' / ) ;
233+ } ) ;
234+
211235 it ( 'should use the default project prefix if none is passed' , async ( ) => {
212236 const options = { ...defaultOptions , prefix : undefined } ;
213237
0 commit comments