mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 20:36:26 +02:00
change input to textarea and use autosize on them (#7254)
* change input to textarea and use autosize on them * fix some tests
This commit is contained in:
parent
d158f26c97
commit
0bf1dad278
@ -1,6 +1,7 @@
|
||||
import ArrayProxy from '@ember/array/proxy';
|
||||
import Component from '@ember/component';
|
||||
import { set, computed } from '@ember/object';
|
||||
import autosize from 'autosize';
|
||||
import layout from '../templates/components/string-list';
|
||||
|
||||
export default Component.extend({
|
||||
@ -85,6 +86,16 @@ export default Component.extend({
|
||||
this.send('addInput');
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
autosize(this.element.querySelector('textarea'));
|
||||
},
|
||||
|
||||
didUpdate() {
|
||||
this._super(...arguments);
|
||||
autosize.update(this.element.querySelector('textarea'));
|
||||
},
|
||||
|
||||
setType() {
|
||||
const list = this.inputList;
|
||||
if (!list) {
|
||||
|
||||
@ -12,9 +12,8 @@
|
||||
{{#each inputList as |data index|}}
|
||||
<div class="field is-grouped" data-test-string-list-row="{{index}}">
|
||||
<div class="control is-expanded">
|
||||
{{input
|
||||
{{textarea
|
||||
data-test-string-list-input=index
|
||||
type="text"
|
||||
class="input"
|
||||
value=data.value
|
||||
name=(concat elementId "-" index)
|
||||
|
||||
@ -20,7 +20,7 @@ module('Acceptance | settings/configure/secrets/pki/urls', function(hooks) {
|
||||
|
||||
await page.form.fields
|
||||
.objectAt(0)
|
||||
.input('foo')
|
||||
.textarea('foo')
|
||||
.change();
|
||||
await page.form.submit();
|
||||
|
||||
@ -28,7 +28,7 @@ module('Acceptance | settings/configure/secrets/pki/urls', function(hooks) {
|
||||
|
||||
await page.form.fields
|
||||
.objectAt(0)
|
||||
.input('foo.example.com')
|
||||
.textarea('foo.example.com')
|
||||
.change();
|
||||
await page.form.submit();
|
||||
assert.equal(page.lastMessage, 'The urls config for this backend has been updated.');
|
||||
|
||||
@ -123,7 +123,7 @@ module('Integration | Component | form field', function(hooks) {
|
||||
|
||||
await component.fields
|
||||
.objectAt(0)
|
||||
.input('array')
|
||||
.textarea('array')
|
||||
.change();
|
||||
assert.deepEqual(model.get('foo'), ['array'], 'sets the value on the model');
|
||||
assert.deepEqual(spy.args[0], ['foo', ['array']], 'onChange called with correct args');
|
||||
|
||||
@ -32,7 +32,7 @@ export default {
|
||||
input: fillable('input'),
|
||||
select: fillable('select'),
|
||||
textarea: fillable('textarea'),
|
||||
change: triggerable('keyup', 'input'),
|
||||
change: triggerable('keyup', '.input'),
|
||||
inputValue: value('input'),
|
||||
textareaValue: value('textarea'),
|
||||
inputChecked: attribute('checked', 'input[type=checkbox]'),
|
||||
|
||||
@ -9,7 +9,7 @@ export default create({
|
||||
toggleOptions: clickable('[data-test-toggle-group="Options"]'),
|
||||
name: fillable('[data-test-input="name"]'),
|
||||
allowAnyName: clickable('[data-test-input="allowAnyName"]'),
|
||||
allowedDomains: fillable('[data-test-input="allowedDomains"] input'),
|
||||
allowedDomains: fillable('[data-test-input="allowedDomains"] .input'),
|
||||
save: clickable('[data-test-role-create]'),
|
||||
|
||||
createRole(name, allowedDomains) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user