Skip to content

Commit 3acf83d

Browse files
authored
Merge pull request #9040 from stopfstedt/6781_translate_ics_instructions
use translatable text for ICS copy button
2 parents 83ebf7b + b2e5290 commit 3acf83d

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

packages/ilios-common/addon-test-support/ilios-common/page-objects/components/copy-button.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { create } from 'ember-cli-page-object';
1+
import { attribute, create } from 'ember-cli-page-object';
22

33
const definition = {
44
scope: '[data-test-copy-button]',
5+
ariaLabel: attribute('aria-label'),
56
};
67

78
export default definition;

packages/ilios-common/addon-test-support/ilios-common/page-objects/components/dashboard/navigation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { attribute, create, hasClass } from 'ember-cli-page-object';
2+
import icsFeed from './../ics-feed';
23

34
const definition = {
45
scope: '[data-test-dashboard-navigation]',
@@ -17,6 +18,7 @@ const definition = {
1718
linkTarget: attribute('href'),
1819
isActive: hasClass('active'),
1920
},
21+
icsFeed,
2022
};
2123

2224
export default definition;

packages/ilios-common/addon/components/dashboard/navigation.gjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import IcsFeed from 'ilios-common/components/ics-feed';
99
export default class NavigationComponent extends Component {
1010
@service currentUser;
1111
@service iliosConfig;
12+
@service intl;
1213

1314
@tracked icsFeedUrl;
1415
@tracked icsInstructions;
@@ -25,7 +26,6 @@ export default class NavigationComponent extends Component {
2526
const loc = window.location.protocol + '//' + window.location.hostname;
2627
const server = apiHost ? apiHost : loc;
2728
this.icsFeedUrl = server + '/ics/' + icsFeedKey;
28-
this.icsInstructions = 'Copy My ICS Link';
2929
});
3030
<template>
3131
<nav
@@ -64,7 +64,7 @@ export default class NavigationComponent extends Component {
6464
>
6565
{{t "general.calendar"}}
6666
</LinkTo>
67-
<IcsFeed @url={{this.icsFeedUrl}} @instructions={{this.icsInstructions}} />
67+
<IcsFeed @url={{this.icsFeedUrl}} />
6868
</li>
6969
</ul>
7070
</nav>

packages/ilios-common/addon/components/ics-feed.gjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default class IcsFeedComponent extends Component {
4545
<CopyButton
4646
@getClipboardText={{this.getIcsFeedUrl}}
4747
@success={{perform this.textCopied}}
48-
aria-label={{if @instructions @instructions (t "general.copyIcsFeedUrl")}}
48+
aria-label={{t "general.copyIcsFeedUrl"}}
4949
class="link-button highlight"
5050
id={{this.copyButtonId}}
5151
{{mouseHoverToggle (set this "showTooltip")}}

packages/test-app/tests/integration/components/dashboard/navigation.gjs renamed to packages/test-app/tests/integration/components/dashboard/navigation-test.gjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
import { module, test } from 'qunit';
22
import { setupRenderingTest } from 'test-app/tests/helpers';
3+
import { setupMirage } from 'test-app/tests/test-support/mirage';
34
import { render } from '@ember/test-helpers';
45
import { component } from 'ilios-common/page-objects/components/dashboard/navigation';
56
import { a11yAudit } from 'ember-a11y-testing/test-support';
67
import Navigation from 'ilios-common/components/dashboard/navigation';
8+
import Service from '@ember/service';
79

810
module('Integration | Component | dashboard/navigation', function (hooks) {
911
setupRenderingTest(hooks);
12+
setupMirage(hooks);
13+
14+
hooks.beforeEach(async function () {
15+
const user = this.server.create('user', {
16+
id: 13,
17+
icsFeedKey: 'testkey',
18+
});
19+
const userModel = await this.owner.lookup('service:store').findRecord('user', user.id);
20+
21+
class CurrentUserMock extends Service {
22+
async getModel() {
23+
return userModel;
24+
}
25+
}
26+
27+
this.owner.register('service:current-user', CurrentUserMock);
28+
});
1029

1130
test('it renders and is accessible', async function (assert) {
1231
await render(<template><Navigation /></template>);
@@ -16,6 +35,7 @@ module('Integration | Component | dashboard/navigation', function (hooks) {
1635
assert.strictEqual(component.materials.linkTarget, '/dashboard/materials');
1736
assert.strictEqual(component.week.text, 'Week at a Glance');
1837
assert.strictEqual(component.week.linkTarget, '/dashboard/week');
38+
assert.strictEqual(component.icsFeed.copy.ariaLabel, 'Copy My ICS Link');
1939
await a11yAudit(this.element);
2040
assert.ok(true, 'no a11y errors found!');
2141
});

0 commit comments

Comments
 (0)