File tree Expand file tree Collapse file tree 3 files changed +76
-0
lines changed
__testfixtures__/ember-qunit-codemod Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ import { module } from 'qunit' ;
2+ import { moduleFor , moduleForComponent , test } from 'ember-qunit' ;
3+ import hbs from 'htmlbars-inline-precompile' ;
4+ import engineResolverFor from 'ember-engines/test-support/engine-resolver-for' ;
5+
6+ const resolver = engineResolverFor ( 'appointments-manager' ) ;
7+
8+ moduleForComponent ( 'date-picker' , 'Integration | Component | Date picker' , {
9+ integration : true ,
10+ resolver
11+ } ) ;
12+
13+ test ( 'renders text' , function ( assert ) {
14+ this . render ( hbs `{{date-picker}}` ) ;
15+ assert . equal ( this . $ ( ) . text ( ) . trim ( ) , 'una fecha' ) ;
16+ } ) ;
17+
18+ moduleFor ( 'service:foo' , {
19+ resolver
20+ } ) ;
21+
22+ test ( 'can resolve from custom resolver' , function ( assert ) {
23+ assert . ok ( this . container . lookup ( 'service:foo' ) ) ;
24+ } ) ;
25+
26+ module ( 'non-ember-qunit module' , {
27+ resolver
28+ } ) ;
29+
30+ test ( 'custom resolver property means nothing, and ends up in `beforeEach`' , function ( assert ) {
31+ assert . ok ( this . container . lookup ( 'service:foo' ) ) ;
32+ } ) ;
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupTest , setupRenderingTest } from 'ember-qunit' ;
3+ import { render } from 'ember-test-helpers' ;
4+ import hbs from 'htmlbars-inline-precompile' ;
5+ import engineResolverFor from 'ember-engines/test-support/engine-resolver-for' ;
6+
7+ const resolver = engineResolverFor ( 'appointments-manager' ) ;
8+
9+ module ( 'Integration | Component | Date picker' , function ( hooks ) {
10+ setupRenderingTest ( hooks , {
11+ resolver
12+ } ) ;
13+
14+ test ( 'renders text' , async function ( assert ) {
15+ await render ( hbs `{{date-picker}}` ) ;
16+ assert . equal ( this . $ ( ) . text ( ) . trim ( ) , 'una fecha' ) ;
17+ } ) ;
18+ } ) ;
19+
20+ module ( 'service:foo' , function ( hooks ) {
21+ setupTest ( hooks , {
22+ resolver
23+ } ) ;
24+
25+ test ( 'can resolve from custom resolver' , function ( assert ) {
26+ assert . ok ( this . owner . lookup ( 'service:foo' ) ) ;
27+ } ) ;
28+ } ) ;
29+
30+ module ( 'non-ember-qunit module' , function ( hooks ) {
31+ hooks . beforeEach ( function ( ) {
32+ this . resolver = resolver ;
33+ } ) ;
34+
35+ test ( 'custom resolver property means nothing, and ends up in `beforeEach`' , function ( assert ) {
36+ assert . ok ( this . owner . lookup ( 'service:foo' ) ) ;
37+ } ) ;
38+ } ) ;
Original file line number Diff line number Diff line change @@ -309,6 +309,12 @@ module.exports = function(file, api) {
309309 updateRegisterCalls ( expressionCollection ) ;
310310 updateInjectCalls ( expressionCollection ) ;
311311 updateOnCalls ( expressionCollection , moduleInfo ) ;
312+
313+ if ( j . match ( property , { key : { name : 'resolver' } } ) ) {
314+ let setupExpression = moduleInfo . moduleSetupExpression ;
315+ setupExpression . expression . arguments . push ( j . objectExpression ( [ property ] ) ) ;
316+ return ;
317+ }
312318 }
313319
314320 if ( isLifecycleHook ( property ) ) {
You can’t perform that action at this time.
0 commit comments