feat: 🎸 add tooltip to config tags in table (#2375)
* feat: 🎸 add tooltip to config tags in table ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14331 * Update addons/core/translations/resources/en-us.yaml Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com> * test: 💍 fix translation in test ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14331 --------- Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>
This commit is contained in:
1 parent
fd5143286f
commit
87f84e0c24
5 files changed
+38
-6
No files matched your search
@@ -4,7 +4,10 @@
|
||||
*/
|
||||
|
||||
import Controller, { inject as controller } from '@ember/controller';
|
||||
import { TAG_TYPE_CONFIG } from 'api/models/worker';
|
||||
|
||||
export default class ScopesScopeWorkersWorkerTagsController extends Controller {
|
||||
@controller('scopes/scope/workers/index') workers;
|
||||
|
||||
tagTypeConfig = TAG_TYPE_CONFIG;
|
||||
}
|
||||
@@ -50,7 +50,16 @@
|
||||
<Hds::Text::Code @tag='pre'>{{B.data.value}}</Hds::Text::Code>
|
||||
</B.Td>
|
||||
<B.Td>
|
||||
<Hds::Badge @text={{B.data.type}} />
|
||||
{{#if (eq B.data.type this.tagTypeConfig)}}
|
||||
<Hds::TooltipButton
|
||||
@text={{t 'resources.worker.tooltip'}}
|
||||
@offset={{array -50 8}}
|
||||
>
|
||||
<Hds::Badge @text={{B.data.type}} />
|
||||
</Hds::TooltipButton>
|
||||
{{else}}
|
||||
<Hds::Badge @text={{B.data.type}} />
|
||||
{{/if}}
|
||||
</B.Td>
|
||||
</B.Tr>
|
||||
</:body>
|
||||
|
||||
@@ -4,16 +4,21 @@
|
||||
*/
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, findAll } from '@ember/test-helpers';
|
||||
import { visit, currentURL, click, focus } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Acceptance | workers | tags', function (hooks) {
|
||||
module('Acceptance | workers | worker | tags', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
const CONFIG_TAG_TOOLTIP_SELECTOR =
|
||||
'tbody tr:first-child td:nth-child(3) button';
|
||||
const CONFIG_TAG_TOOLTIP_TEXT_SELECTOR =
|
||||
'tbody tr:first-child td:nth-child(3) > div';
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
@@ -42,6 +47,17 @@ module('Acceptance | workers | tags', function (hooks) {
|
||||
await a11yAudit();
|
||||
|
||||
assert.strictEqual(currentURL(), urls.tags);
|
||||
assert.strictEqual(findAll('tbody tr').length, 11);
|
||||
assert.dom('tbody tr').exists({ count: 11 });
|
||||
});
|
||||
|
||||
test('config tags display a tooltip', async function (assert) {
|
||||
await visit(urls.tags);
|
||||
await a11yAudit();
|
||||
|
||||
await focus(CONFIG_TAG_TOOLTIP_SELECTOR);
|
||||
|
||||
assert
|
||||
.dom(CONFIG_TAG_TOOLTIP_TEXT_SELECTOR)
|
||||
.hasText('To edit config tags, edit them in your worker config file.');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user