@@ -6,7 +6,7 @@ import { module, test } from 'qunit';
6
6
import { setupRenderingTest } from ' ember-qunit' ;
7
7
import { dependencySatisfies , importSync , macroCondition } from ' @embroider/macros' ;
8
8
9
- import { cell ,resource , use } from ' ember-resources' ;
9
+ import { cell , resource , resourceFactory , use } from ' ember-resources' ;
10
10
11
11
import type Owner from ' @ember/owner' ;
12
12
@@ -42,7 +42,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
42
42
43
43
let foo = new Test ();
44
44
45
- setOwner (foo , this .owner );
45
+ setOwner (foo , this .owner );
46
46
47
47
// reminder that destruction is async
48
48
let steps: string [] = [];
@@ -82,14 +82,32 @@ module('Utils | (function) resource | rendering', function (hooks) {
82
82
assert .verifySteps (steps );
83
83
});
84
84
85
+ test (' with named args' , async function (assert ) {
86
+ const resWithNamedArgs = resourceFactory ((options ) =>
87
+ resource (() => {
88
+ return options ;
89
+ })
90
+ );
91
+
92
+ await render (<template >
93
+ {{#let ( resWithNamedArgs givenName =" Luke" familyName =" Skywalker" ) as | out | }}
94
+ <output name =" givenName" >{{out.givenName }} </output >
95
+ <output name =" familyName" >{{out.familyName }} </output >
96
+ {{/let }}
97
+ </template >);
98
+
99
+ assert .dom (' output[name="givenName"]' ).hasText (' Luke' );
100
+ assert .dom (' output[name="familyName"]' ).hasText (' Skywalker' );
101
+ });
102
+
85
103
test (' with separate tracking frame' , async function (assert ) {
86
104
class Test {
87
105
@tracked num = 0 ;
88
106
}
89
107
90
108
let foo = new Test ();
91
109
92
- setOwner (foo , this .owner );
110
+ setOwner (foo , this .owner );
93
111
94
112
// reminder that destruction is async
95
113
let steps: string [] = [];
@@ -140,7 +158,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
140
158
let inc = 0 ;
141
159
let foo = new Test ();
142
160
143
- setOwner (foo , this .owner );
161
+ setOwner (foo , this .owner );
144
162
145
163
let theResource = resource (({ on }) => {
146
164
let i = inc ;
@@ -188,7 +206,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
188
206
189
207
let foo = new Test ();
190
208
191
- setOwner (foo , this .owner );
209
+ setOwner (foo , this .owner );
192
210
193
211
let theResource = resource (({ on }) => {
194
212
let i = foo .num ;
@@ -236,7 +254,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
236
254
237
255
let foo = new Test ();
238
256
239
- setOwner (foo , this .owner );
257
+ setOwner (foo , this .owner );
240
258
241
259
let theResource = (_num : number ) =>
242
260
resource (({ on }) => {
@@ -304,7 +322,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
304
322
305
323
let foo = new Test ();
306
324
307
- setOwner (foo , this .owner );
325
+ setOwner (foo , this .owner );
308
326
309
327
await render (<template ><out >{{foo.theResource }} </out ></template >);
310
328
@@ -349,7 +367,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
349
367
350
368
let foo = new Test ();
351
369
352
- setOwner (foo , this .owner );
370
+ setOwner (foo , this .owner );
353
371
354
372
await render (<template >
355
373
{{#if foo.show }}
@@ -407,7 +425,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
407
425
408
426
let foo = new Test ();
409
427
410
- setOwner (foo , this .owner );
428
+ setOwner (foo , this .owner );
411
429
412
430
await render (<template >
413
431
{{#if foo.show }}
@@ -458,7 +476,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
458
476
459
477
let foo = new Test ();
460
478
461
- setOwner (foo , this .owner );
479
+ setOwner (foo , this .owner );
462
480
463
481
await render (<template >
464
482
{{#let ( Wrapper foo.num ) as | state | }}
@@ -517,7 +535,7 @@ module('Utils | (function) resource | rendering', function (hooks) {
517
535
518
536
let testData = new Test ();
519
537
520
- setOwner (testData , this .owner );
538
+ setOwner (testData , this .owner );
521
539
522
540
setOwner (testData , this .owner );
523
541
0 commit comments