3
3
const blueprintHelpers = require ( 'ember-cli-blueprint-test-helpers/helpers' ) ;
4
4
const setupTestHooks = blueprintHelpers . setupTestHooks ;
5
5
const emberNew = blueprintHelpers . emberNew ;
6
+ const emberGenerate = blueprintHelpers . emberGenerate ;
6
7
const emberGenerateDestroy = blueprintHelpers . emberGenerateDestroy ;
7
8
const modifyPackages = blueprintHelpers . modifyPackages ;
8
9
@@ -27,11 +28,6 @@ const templateOnlyContents = `import templateOnly from '@ember/component/templat
27
28
export default templateOnly();
28
29
` ;
29
30
30
- const templateTagContents = `<template>
31
- {{yield}}
32
- </template>
33
- ` ;
34
-
35
31
describe ( 'Blueprint: component' , function ( ) {
36
32
setupTestHooks ( this ) ;
37
33
@@ -278,9 +274,49 @@ describe('Blueprint: component', function () {
278
274
279
275
it ( 'component foo --strict' , function ( ) {
280
276
return emberGenerateDestroy ( [ 'component' , 'foo' , '--strict' ] , ( _file ) => {
281
- expect ( _file ( 'app/components/foo.gjs' ) ) . to . equal ( templateTagContents ) ;
277
+ expect ( _file ( 'app/components/foo.gjs' ) ) . to . equal (
278
+ fixture ( 'component/template-only-component.gjs' )
279
+ ) ;
280
+ } ) ;
281
+ } ) ;
282
+
283
+ it ( 'component foo --strict --component-class=@glimmer/component' , function ( ) {
284
+ return emberGenerateDestroy (
285
+ [ 'component' , 'foo' , '--strict' , '--component-class=@glimmer/component' ] ,
286
+ ( _file ) => {
287
+ expect ( _file ( 'app/components/foo.gjs' ) ) . to . equal (
288
+ fixture ( 'component/glimmer-component.gjs' )
289
+ ) ;
290
+ }
291
+ ) ;
292
+ } ) ;
293
+
294
+ it ( 'component foo --strict --component-class=@ember/component' , async function ( ) {
295
+ await expect (
296
+ emberGenerate ( [ 'component' , 'foo' , '--strict' , '--component-class=@ember/component' ] )
297
+ ) . to . be . rejectedWith (
298
+ 'The "@ember/component" component class cannot be used in combination with the "--strict" flag'
299
+ ) ;
300
+ } ) ;
301
+
302
+ it ( 'component foo --strict --typescript' , function ( ) {
303
+ return emberGenerateDestroy ( [ 'component' , 'foo' , '--strict' , '--typescript' ] , ( _file ) => {
304
+ expect ( _file ( 'app/components/foo.gts' ) ) . to . equal (
305
+ fixture ( 'component/template-only-component.gts' )
306
+ ) ;
282
307
} ) ;
283
308
} ) ;
309
+
310
+ it ( 'component foo --strict --component-class=@glimmer/component --typescript' , function ( ) {
311
+ return emberGenerateDestroy (
312
+ [ 'component' , 'foo' , '--strict' , '--component-class=@glimmer/component' , '--typescript' ] ,
313
+ ( _file ) => {
314
+ expect ( _file ( 'app/components/foo.gts' ) ) . to . equal (
315
+ fixture ( 'component/glimmer-component.gts' )
316
+ ) ;
317
+ }
318
+ ) ;
319
+ } ) ;
284
320
} ) ;
285
321
286
322
describe ( 'in addon' , function ( ) {
0 commit comments