open-vault/ui/tests/integration/components/toolbar-link-test.js
Jordan Reimer c1df15e790
Incorporate Ember Flight Icons (#12976)
* adds ember-flight-icons dependecy

* adds inline-json-import babel plugin

* adds flight icon styling

* updates Icon component to support flight icons

* updates Icon component usages to new api and updates name values to flight icon set when available

* fixes tests

* updates icon story with flight mappings and fixes issue with flight icons not rendering in storybook

* adds changelog

* fixes typo in sign action glyph name in transit-key model

* adds comments to icon-map

* updates Icon component to use only supported flight icon sizes

* adds icon transform codemod

* updates icon transform formatting to handle edge case

* runs icon transform on templates

* updates Icon usage in toolbar-filter md and story

* updates tests
2021-12-07 10:05:14 -07:00

55 lines
1.7 KiB
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, triggerEvent } from '@ember/test-helpers';
import { isPresent } from 'ember-cli-page-object';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | toolbar-link', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
await render(hbs`<ToolbarLink @params={{array '/secrets'}}>Link</ToolbarLink>`);
assert.dom(this.element).hasText('Link');
assert.ok(isPresent('.toolbar-link'));
assert.ok(isPresent('.icon'));
});
test('it should render icons', async function(assert) {
assert.expect(2);
await render(hbs`
<ToolbarLink
@params={{array '/secrets'}}
@type={{this.type}}
>
Test Link
</ToolbarLink>
`);
assert.dom('[data-test-icon="chevron-right"]').exists('Default chevron right icon renders');
this.set('type', 'add');
assert.dom('[data-test-icon="plus"]').exists('Icon can be overriden to show plus sign');
});
test('it should disable and show tooltip if provided', async function(assert) {
assert.expect(3);
await render(hbs`
<ToolbarLink
@params={{array '/secrets'}}
@disabled={{true}}
@disabledTooltip={{this.tooltip}}
>
Test Link
</ToolbarLink>
`);
assert.dom('a').hasClass('disabled', 'Link can be disabled');
assert.dom('[data-test-popup-menu-trigger]').doesNotExist('Tooltip is hidden when not provided');
this.set('tooltip', 'Test tooltip');
await triggerEvent('.ember-basic-dropdown-trigger', 'mouseenter');
assert.dom('[data-test-disabled-tooltip]').hasText(this.tooltip, 'Tooltip renders');
});
});