@Raphael_Nunes wrote:
Hello, I want to know which is the right way to wait a template update based on a computed property on my test. If i use
settled
the test will wait the template being updated after the computed changed or i will have to use something else likewaitFor
?I will try to explain the test case in more detail:
- My component.js:
export default Component.extend({ showHello: gt('data.length', 0), actions: { buttonClick() { return this.getDataFromServer().then(data => set(this, 'data', data)); } } });
- My component.hbs
{{#if showHello}} <span data-test-hello>Hello</span> {{/if}} <button {{action "buttonClick"}} data-test-button>Button</button>
- My component-test.js (I mock the data so the
getDataFromServer
always return an array with two values.)module('Acceptance | component', function (hooks) { setupApplicationTest(hooks); test('Test component', async function (assert) { await visit(`/`); await click('[data-test-button]'); assert.dom('[data-test-hello]').exists('The hello exists'); }); });
Posts: 3
Participants: 2