Skip to content

Commit b488d80

Browse files
committed
test: add potential failing test for universal-ember#110
1 parent a843d7d commit b488d80

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/test-app/tests/utils/function/rendering-test.gts

+45
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,49 @@ module('Utils | trackedFunction | rendering', function (hooks) {
234234
await settled();
235235
assert.dom('out').containsText('12.206');
236236
});
237+
238+
test('failing case', async function (assert) {
239+
class TestCase {
240+
items = trackedFunction(this, async () => {
241+
const items = await Promise.resolve([3, 4, 5]);
242+
243+
return items;
244+
})
245+
246+
get firstItem() {
247+
return this.items.value?.[0];
248+
}
249+
250+
stringArray = trackedFunction(this, async () => {
251+
if (!this.firstItem) return [];
252+
253+
const stringArray = await Promise.resolve(Array.from({ length: this.firstItem }, () => 'item'));
254+
255+
return stringArray;
256+
})
257+
258+
get endResult() {
259+
return this.stringArray.value?.join(',') ?? [].join('')
260+
}
261+
}
262+
263+
class TestComponent extends Component {
264+
@tracked testCase?: TestCase;
265+
266+
setTestCase = () => this.testCase = new TestCase();
267+
268+
<template>
269+
<out>{{this.testCase.endResult}}</out>
270+
<button type="button" {{on "click" this.setTestCase}}></button>
271+
</template>
272+
}
273+
274+
await render(<template><TestComponent /></template>);
275+
276+
assert.dom('out').doesNotIncludeText('item')
277+
278+
await click('button')
279+
280+
assert.dom('out').hasText('item,item,item')
281+
})
237282
});

0 commit comments

Comments
 (0)