mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
* converts secret-v2-version model to native class -- fixes issues with cached values for deleted prop * adds changelog entry * adds disabled state to ToolbarLink component and disables create new version action when users cannot read metadata * updates secret-edit acceptance test
55 lines
1.7 KiB
JavaScript
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-plain"]').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');
|
|
});
|
|
});
|