mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
PGP key list input fix (#13038)
* fixes issue with pgp list file input count not matching key shares number * adds changelog entry
This commit is contained in:
3
changelog/13038.txt
Normal file
3
changelog/13038.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
ui: Fixes issue with the number of PGP Key inputs not matching the key shares number in the initialization form on change
|
||||||
|
```
|
||||||
@@ -31,10 +31,7 @@ export default Component.extend({
|
|||||||
list = this.listData.slice(0, this.listLength);
|
list = this.listData.slice(0, this.listLength);
|
||||||
} else if (this.listLength > this.listData.length) {
|
} else if (this.listLength > this.listData.length) {
|
||||||
// add to the current list by creating a new list and copying over existing list
|
// add to the current list by creating a new list and copying over existing list
|
||||||
list = this.newList(this.listLength);
|
list = [...this.listData, ...this.newList(this.listLength - this.listData.length)];
|
||||||
if (this.listData.length) {
|
|
||||||
list.splice(0, this.listData.length, ...this.listData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.set('listData', list || this.listData);
|
this.set('listData', list || this.listData);
|
||||||
this.onDataUpdate((list || this.listData).compact().map(k => k.value));
|
this.onDataUpdate((list || this.listData).compact().map(k => k.value));
|
||||||
|
|||||||
@@ -128,4 +128,26 @@ module('Integration | Component | pgp list', function(hooks) {
|
|||||||
'lengthening the list with an array with one base64 converted files'
|
'lengthening the list with an array with one base64 converted files'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('it should render correct amount of file components on listLength change', async function(assert) {
|
||||||
|
assert.expect(4);
|
||||||
|
|
||||||
|
this.set('listLength', null);
|
||||||
|
|
||||||
|
await render(hbs`
|
||||||
|
<PgpList
|
||||||
|
@listLength={{this.listLength}}
|
||||||
|
/>
|
||||||
|
`);
|
||||||
|
[1, 5, 3, 0].forEach(count => {
|
||||||
|
this.set('listLength', count);
|
||||||
|
if (count) {
|
||||||
|
assert
|
||||||
|
.dom('[data-test-pgp-file]')
|
||||||
|
.exists({ count }, `Correct number of file inputs render when listLength is updated to ${count}`);
|
||||||
|
} else {
|
||||||
|
assert.dom('[data-test-empty-text]').exists('Placeholder renders when list length is zero');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user