mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
KV Download Value Stringify Toggle (#23747)
* adds stringify toggle to masked-input download modal * updates stringify toggle copy and adds a test * adds changelog entry
This commit is contained in:
@@ -130,4 +130,37 @@ module('Integration | Component | masked input', function (hooks) {
|
||||
.dom('[data-test-icon="minus"]')
|
||||
.exists('shows minus icon when unmasked because value is empty string');
|
||||
});
|
||||
|
||||
test('it should render stringify toggle in download modal', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
// this looks wonky but need a new line in there to test stringify adding escape character
|
||||
this.value = `bar
|
||||
`;
|
||||
|
||||
const downloadStub = sinon.stub(this.owner.lookup('service:download'), 'miscExtension');
|
||||
downloadStub.callsFake((fileName, value) => {
|
||||
const firstCall = downloadStub.callCount === 1;
|
||||
const assertVal = firstCall ? this.value : JSON.stringify(this.value);
|
||||
assert.strictEqual(assertVal, value, `Value is ${firstCall ? 'not ' : ''}stringified`);
|
||||
return true;
|
||||
});
|
||||
|
||||
await render(hbs`
|
||||
<MaskedInput
|
||||
@name="key"
|
||||
@value={{this.value}}
|
||||
@displayOnly={{true}}
|
||||
@allowDownload={{true}}
|
||||
/>
|
||||
`);
|
||||
|
||||
await click('[data-test-download-icon]');
|
||||
assert.dom('[data-test-stringify-toggle]').isNotChecked('Stringify toggle off as default');
|
||||
await click('[data-test-download-button]');
|
||||
|
||||
await click('[data-test-download-icon]');
|
||||
await click('[data-test-stringify-toggle]');
|
||||
await click('[data-test-download-button]');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user