mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-14 18:47:01 +02:00
* replace confirm-action dropdown with button+modal * add modal frame to sidebar * fix weird paragraph indent * pass button text as arg * add warning color to rotate modals * update seal action and config ssh * cleanup confirm action * edit form * add dropdown arg * put back seal text * put back confirm button text * fix toolbar stylinggp * popup member group * move up title * finish popup- components * keymgmt * fix modal button logic * remaining app template components * add period for angel * vault cluster items * add button text assertion * remaining instances * remove arg for passing confirm text * contextual confirm action components * delete old components * update docs * ammend dropdown loading states, add getter for confirm button color * address feedback * remove @disabled arg and add @disabledMessage * add changelog; * mfa tests * update test selectors * lol cleanup selectors * start confirm action tests WIP * move dropdown class directly to component * add default color of isInDropdown * final cleanup * add tests * remove @buttonColor as arg for dropdown * update confirm action tests * updae modals with disabled message * refactor provider edit test
46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'vault/tests/helpers';
|
|
import { click, render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
import sinon from 'sinon';
|
|
|
|
const SEAL_WHEN_STANDBY_MSG = 'vault cannot seal when in standby mode; please restart instead';
|
|
|
|
module('Integration | Component | seal-action', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.sealSuccess = sinon.spy(() => new Promise((resolve) => resolve({})));
|
|
this.sealError = sinon.stub().throws({ message: SEAL_WHEN_STANDBY_MSG });
|
|
});
|
|
|
|
test('it handles success', async function (assert) {
|
|
this.set('handleSeal', this.sealSuccess);
|
|
await render(hbs`<SealAction @onSeal={{action this.handleSeal}} />`);
|
|
|
|
// attempt seal
|
|
await click('[data-test-seal]');
|
|
await click('[data-test-confirm-button]');
|
|
|
|
assert.ok(this.sealSuccess.calledOnce, 'called onSeal action');
|
|
assert.dom('[data-test-seal-error]').doesNotExist('Does not show error when successful');
|
|
});
|
|
|
|
test('it handles error', async function (assert) {
|
|
this.set('handleSeal', this.sealError);
|
|
await render(hbs`<SealAction @onSeal={{action this.handleSeal}} />`);
|
|
|
|
// attempt seal
|
|
await click('[data-test-seal]');
|
|
await click('[data-test-confirm-button]');
|
|
|
|
assert.ok(this.sealError.calledOnce, 'called onSeal action');
|
|
assert.dom('[data-test-seal-error]').includesText(SEAL_WHEN_STANDBY_MSG, 'Shows error returned from API');
|
|
});
|
|
});
|