Skip to content

Commit 993dfb1

Browse files
committed
test: add potential failing test for universal-ember#110
1 parent 6bcf17d commit 993dfb1

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
@@ -226,4 +226,49 @@ module('Utils | trackedFunction | rendering', function (hooks) {
226226
await settled();
227227
assert.dom('out').containsText('12.206');
228228
});
229+
230+
test('failing case', async function (assert) {
231+
class TestCase {
232+
items = trackedFunction(this, async () => {
233+
const items = await Promise.resolve([3, 4, 5]);
234+
235+
return items;
236+
})
237+
238+
get firstItem() {
239+
return this.items.value?.[0];
240+
}
241+
242+
stringArray = trackedFunction(this, async () => {
243+
if (!this.firstItem) return [];
244+
245+
const stringArray = await Promise.resolve(Array.from({ length: this.firstItem }, () => 'item'));
246+
247+
return stringArray;
248+
})
249+
250+
get endResult() {
251+
return this.stringArray.value?.join(',') ?? [].join('')
252+
}
253+
}
254+
255+
class TestComponent extends Component {
256+
@tracked testCase?: TestCase;
257+
258+
setTestCase = () => this.testCase = new TestCase();
259+
260+
<template>
261+
<out>{{this.testCase.endResult}}</out>
262+
<button type="button" {{on "click" this.setTestCase}}></button>
263+
</template>
264+
}
265+
266+
await render(<template><TestComponent /></template>);
267+
268+
assert.dom('out').doesNotIncludeText('item')
269+
270+
await click('button')
271+
272+
assert.dom('out').hasText('item,item,item')
273+
})
229274
});

0 commit comments

Comments
 (0)