diff --git a/app/components/input-modal.hbs b/app/components/input-modal.hbs index 2ef3c60..c5d22ba 100644 --- a/app/components/input-modal.hbs +++ b/app/components/input-modal.hbs @@ -1,7 +1,7 @@ {{!-- app/components/input-modal.hbs --}}
- diff --git a/app/components/open-modal-button.hbs b/app/components/open-modal-button.hbs index b464356..efc9545 100644 --- a/app/components/open-modal-button.hbs +++ b/app/components/open-modal-button.hbs @@ -1,5 +1,5 @@ {{!-- app/components/open-modal-button.hbs --}} - + {{#if this.isModalOpen}} {{/if}} diff --git a/app/components/user-info.hbs b/app/components/user-info.hbs index 1e2f902..50f6fe0 100644 --- a/app/components/user-info.hbs +++ b/app/components/user-info.hbs @@ -1,9 +1,9 @@
diff --git a/app/components/user-info.ts b/app/components/user-info.ts index dd31cdd..15e687a 100644 --- a/app/components/user-info.ts +++ b/app/components/user-info.ts @@ -31,7 +31,7 @@ export default class UserInfoComponent extends Component { setTimeout(() => { this.userDate = new Date(); const div = document.querySelector('.date-container') as HTMLDivElement; - div.innerHTML = `

${this.userDate}

`; + div.innerHTML = `

${this.userDate}

`; resolve(); }, 2000); }); diff --git a/tests/acceptance/application-test.ts b/tests/acceptance/application-test.ts new file mode 100644 index 0000000..c5cdfec --- /dev/null +++ b/tests/acceptance/application-test.ts @@ -0,0 +1,35 @@ +import { module, test } from 'qunit'; +import { setupApplicationTest } from 'ember-qunit'; +import { click, find, settled, visit, waitFor, waitUntil } from '@ember/test-helpers'; + +module('Acceptance | application | app', function (hooks) { + setupApplicationTest(hooks); + + test('I can fill form', async function (assert) { + await visit('/'); + await settled(); + + const h2 = find('h2') as HTMLElement; // get first h2 element + assert.deepEqual(h2.textContent, 'Welcome to DevCon 2024 Ember.js Test Demo'); + + assert.dom('[data-test-modal-btn]').exists(); // assert open modal button exists + + const hasUserName = await waitUntil(() => { + const div = find('.user-info') as HTMLDivElement; + return div?.textContent?.includes('Welcome John'); + }, { timeout: 3000 }); + + assert.strictEqual(hasUserName, true); // assert welcome user name exists + + await waitFor('.date', { timeout: 3000 }); + assert.dom('[data-test-date]').containsText(new Date() as unknown as string); // assert date exists + + await click('[data-test-modal-btn]'); + assert.dom('[data-test-modal]').exists(); // assert modal opens + assert.dom('[data-test-close-btn]').exists(); // assert close button exists + assert.dom('[data-test-save-btn]').exists(); // assert save button exists + + await click('[data-test-close-btn]'); + assert.dom('[data-test-modal]').doesNotExist(); // assert modal is closed + }); +});