Merge pull request #4334 from hashicorp/bugfix/gh-4304-mouse-paste

Use html5 oninput instead of onkeyup for native textual inputs
This commit is contained in:
John Cowen 2018-07-03 15:54:57 +01:00 committed by GitHub
commit 312e0273ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{{!<fieldset>}} {{!<fieldset>}}
<label class="type-search"> <label class="type-search">
<span>Search</span> <span>Search</span>
<input type="search" onsearch={{action onchange}} onkeyup={{action onchange}} name="s" value="{{value}}" placeholder="{{placeholder}}" autofocus="autofocus" /> <input type="search" onsearch={{action onchange}} oninput={{action onchange}} name="s" value="{{value}}" placeholder="{{placeholder}}" autofocus="autofocus" />
</label> </label>
{{!</fieldset>}} {{!</fieldset>}}

View File

@ -3,14 +3,14 @@
{{#if create }} {{#if create }}
<label class="type-text{{if item.error.Key ' has-error'}}"> <label class="type-text{{if item.error.Key ' has-error'}}">
<span>Key or folder</span> <span>Key or folder</span>
<input autofocus="autofocus" type="text" value={{left-trim item.Key parent.Key}} name="additional" onkeyup={{action 'change'}} placeholder="Key or folder" /> <input autofocus="autofocus" type="text" value={{left-trim item.Key parent.Key}} name="additional" oninput={{action 'change'}} placeholder="Key or folder" />
<em>To create a folder, end a key with <code>/</code></em> <em>To create a folder, end a key with <code>/</code></em>
</label> </label>
{{/if}} {{/if}}
{{#if (or (eq (left-trim item.Key parent.Key) '') (not-eq (last item.Key) '/')) }} {{#if (or (eq (left-trim item.Key parent.Key) '') (not-eq (last item.Key) '/')) }}
<div> <div>
<label class="type-toggle"> <label class="type-toggle">
<input type="checkbox" name="json" checked={{if json 'checked' }} onchange={{action 'change'}} /> <input type="checkbox" name="json" checked={{if json 'checked' }} oninput={{action 'change'}} />
<span>Code</span> <span>Code</span>
</label> </label>
<label class="type-text{{if item.error.Value ' has-error'}}"> <label class="type-text{{if item.error.Value ' has-error'}}">
@ -18,7 +18,7 @@
{{#if json}} {{#if json}}
{{ code-editor value=(atob item.Value) onkeyup=(action 'change') }} {{ code-editor value=(atob item.Value) onkeyup=(action 'change') }}
{{else}} {{else}}
<textarea autofocus={{not create}} name="value" onkeyup={{action 'change'}}>{{atob item.Value}}</textarea> <textarea autofocus={{not create}} name="value" oninput={{action 'change'}}>{{atob item.Value}}</textarea>
{{/if}} {{/if}}
</label> </label>
</div> </div>

View File

@ -25,12 +25,12 @@ Feature: dc / components /acl filter: Acl Filter
When I click all on the filter When I click all on the filter
Then I see allIsSelected on the filter Then I see allIsSelected on the filter
Then I type with yaml Then I fill in with yaml
--- ---
s: Anonymous Token s: Anonymous Token
--- ---
And I see 1 [Model] model with the name "Anonymous Token" And I see 1 [Model] model with the name "Anonymous Token"
Then I type with yaml Then I fill in with yaml
--- ---
s: secret s: secret
--- ---

View File

@ -47,7 +47,7 @@ Feature: components / catalog-filter
When I click all on the filter When I click all on the filter
And I see allIsSelected on the filter And I see allIsSelected on the filter
Then I type with yaml Then I fill in with yaml
--- ---
s: [Model]-0 s: [Model]-0
--- ---
@ -75,7 +75,7 @@ Feature: components / catalog-filter
When I click services on the tabs When I click services on the tabs
And I see servicesIsSelected on the tabs And I see servicesIsSelected on the tabs
Then I type with yaml Then I fill in with yaml
--- ---
s: 65535 s: 65535
--- ---

View File

@ -12,7 +12,7 @@ Feature: components / kv-filter
dc: dc-1 dc: dc-1
--- ---
Then the url should be [Url] Then the url should be [Url]
Then I type with yaml Then I fill in with yaml
--- ---
s: [Text] s: [Text]
--- ---

View File

@ -0,0 +1,21 @@
@setupApplicationTest
Feature: Text input
Background:
Given 1 datacenter model with the value "dc-1"
Scenario:
When I visit the [Page] page for yaml
---
dc: dc-1
---
Then the url should be [Url]
Then I fill in with json
---
[Data]
---
Then I see submitIsEnabled
Where:
--------------------------------------------------------------------------------
| Page | Url | Data |
| kv | /dc-1/kv/create | {"additional": "hi", "value": "there"} |
| acl | /dc-1/acls/create | {"name": "hi"} |
--------------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@ Feature: dc / acls / update: ACL Update
acl: key acl: key
--- ---
Then the url should be /datacenter/acls/key Then the url should be /datacenter/acls/key
Then I type with yaml Then I fill in with yaml
--- ---
name: [Name] name: [Name]
--- ---

View File

@ -12,7 +12,7 @@ Feature: dc / kvs / update: KV Update
kv: [Name] kv: [Name]
--- ---
Then the url should be /datacenter/kv/[Name]/edit Then the url should be /datacenter/kv/[Name]/edit
Then I type with yaml Then I fill in with yaml
--- ---
value: [Value] value: [Value]
--- ---

View File

@ -0,0 +1,10 @@
import steps from '../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -16,7 +16,7 @@ Feature: token headers
Given 1 datacenter model with the value "datacenter" Given 1 datacenter model with the value "datacenter"
When I visit the settings page When I visit the settings page
Then the url should be /settings Then the url should be /settings
Then I type with yaml Then I fill in with yaml
--- ---
token: [Token] token: [Token]
--- ---

View File

@ -1,4 +1,4 @@
import { create, clickable, triggerable } from 'ember-cli-page-object'; import { create, clickable, triggerable, is } from 'ember-cli-page-object';
import { visitable } from 'consul-ui/tests/lib/page-object/visitable'; import { visitable } from 'consul-ui/tests/lib/page-object/visitable';
export default create({ export default create({
@ -7,4 +7,5 @@ export default create({
// fillIn: fillable('input, textarea, [contenteditable]'), // fillIn: fillable('input, textarea, [contenteditable]'),
name: triggerable('keypress', '[name="name"]'), name: triggerable('keypress', '[name="name"]'),
submit: clickable('[type=submit]'), submit: clickable('[type=submit]'),
submitIsEnabled: is(':not(:disabled)', '[type=submit]'),
}); });

View File

@ -1,4 +1,4 @@
import { create, clickable } from 'ember-cli-page-object'; import { create, clickable, is } from 'ember-cli-page-object';
import { visitable } from 'consul-ui/tests/lib/page-object/visitable'; import { visitable } from 'consul-ui/tests/lib/page-object/visitable';
export default create({ export default create({
@ -7,4 +7,5 @@ export default create({
// fillIn: fillable('input, textarea, [contenteditable]'), // fillIn: fillable('input, textarea, [contenteditable]'),
// name: triggerable('keypress', '[name="additional"]'), // name: triggerable('keypress', '[name="additional"]'),
submit: clickable('[type=submit]'), submit: clickable('[type=submit]'),
submitIsEnabled: is(':not(:disabled)', '[type=submit]'),
}); });

View File

@ -335,7 +335,7 @@ export default function(assert) {
`Expected to not see ${property} on ${component}` `Expected to not see ${property} on ${component}`
); );
}) })
.then(['I see $property'], function(property, component) { .then(['I see $property'], function(property) {
assert.ok(currentPage[property], `Expected to see ${property}`); assert.ok(currentPage[property], `Expected to see ${property}`);
}) })
.then(['I see the text "$text" in "$selector"'], function(text, selector) { .then(['I see the text "$text" in "$selector"'], function(text, selector) {