Skip to content

Commit

Permalink
Merge pull request #8010 from michaelchadwick/frontend-5612-user-guid…
Browse files Browse the repository at this point in the history
…e-link-test-page-obj

convert UserGuideLink test to use page object
  • Loading branch information
stopfstedt authored Jul 26, 2024
2 parents 440ba22 + fe6e9a5 commit 57ed1de
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ import { setupRenderingTest } from 'frontend/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setLocale, setupIntl } from 'ember-intl/test-support';
import { component } from 'frontend/tests/pages/components/user-guide-link';

module('Integration | Component | user-guide-link', function (hooks) {
setupRenderingTest(hooks);
setupIntl(hooks, 'en-us');

test('it renders', async function (assert) {
this.intl = this.owner.lookup('service:intl');

await render(hbs`<UserGuideLink />`);

assert.dom('[data-test-user-guide-link]').exists();
assert.dom('[data-test-user-guide-link-icon]').exists();
assert.dom('[data-test-user-guide-link-icon]').hasText('Ilios User Guide');
assert.ok(component);
assert.ok(component.icon);
assert.strictEqual(component.icon.title, this.intl.t('general.iliosUserGuide'));

await setLocale('es');

assert.dom('[data-test-user-guide-link-icon]').hasText('Ilios Guía de usuario');
assert.strictEqual(component.icon.title, this.intl.t('general.iliosUserGuide'));

await setLocale('fr');

assert.dom('[data-test-user-guide-link-icon]').hasText("Ilios Guide d'utilisation");
assert.strictEqual(component.icon.title, this.intl.t('general.iliosUserGuide'));
});
});
12 changes: 12 additions & 0 deletions packages/frontend/tests/pages/components/user-guide-link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { create, text } from 'ember-cli-page-object';

const definition = {
scope: '[data-test-user-guide-link]',
icon: {
scope: '[data-test-user-guide-link-icon]',
title: text('title'),
},
};

export default definition;
export const component = create(definition);

0 comments on commit 57ed1de

Please sign in to comment.