From b445df39bbce32528fa065021fc119dd7f74f869 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Tue, 3 Jul 2018 15:40:15 +0100 Subject: [PATCH] Use html5 oninput instead of onkeyup for native textual inputs This enables people to enter things using the mouse to paste for example, plus possible other things. As an aside it also answers my query regarding `fillIn` for testing, nothing needs to be actually _typed_ anymore! Doh --- .../templates/components/freetext-filter.hbs | 2 +- ui-v2/app/templates/dc/kv/-form.hbs | 6 +++--- .../acceptance/components/acl-filter.feature | 4 ++-- .../components/catalog-filter.feature | 4 ++-- .../acceptance/components/kv-filter.feature | 2 +- .../acceptance/components/text-input.feature | 21 +++++++++++++++++++ ui-v2/tests/acceptance/dc/acls/update.feature | 2 +- ui-v2/tests/acceptance/dc/kvs/update.feature | 2 +- .../steps/components/text-input-steps.js | 10 +++++++++ ui-v2/tests/acceptance/token-header.feature | 2 +- ui-v2/tests/pages/dc/acls/edit.js | 3 ++- ui-v2/tests/pages/dc/kv/edit.js | 3 ++- ui-v2/tests/steps.js | 2 +- 13 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 ui-v2/tests/acceptance/components/text-input.feature create mode 100644 ui-v2/tests/acceptance/steps/components/text-input-steps.js diff --git a/ui-v2/app/templates/components/freetext-filter.hbs b/ui-v2/app/templates/components/freetext-filter.hbs index 590726e08c..417a3787d2 100644 --- a/ui-v2/app/templates/components/freetext-filter.hbs +++ b/ui-v2/app/templates/components/freetext-filter.hbs @@ -1,6 +1,6 @@ {{!
}} {{!
}} \ No newline at end of file diff --git a/ui-v2/app/templates/dc/kv/-form.hbs b/ui-v2/app/templates/dc/kv/-form.hbs index 6303969045..9b859c5a19 100644 --- a/ui-v2/app/templates/dc/kv/-form.hbs +++ b/ui-v2/app/templates/dc/kv/-form.hbs @@ -3,14 +3,14 @@ {{#if create }} {{/if}} {{#if (or (eq (left-trim item.Key parent.Key) '') (not-eq (last item.Key) '/')) }}
diff --git a/ui-v2/tests/acceptance/components/acl-filter.feature b/ui-v2/tests/acceptance/components/acl-filter.feature index 0d88655225..15ffad0a2c 100644 --- a/ui-v2/tests/acceptance/components/acl-filter.feature +++ b/ui-v2/tests/acceptance/components/acl-filter.feature @@ -25,12 +25,12 @@ Feature: dc / components /acl filter: Acl Filter When I click all on the filter Then I see allIsSelected on the filter - Then I type with yaml + Then I fill in with yaml --- s: 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 --- diff --git a/ui-v2/tests/acceptance/components/catalog-filter.feature b/ui-v2/tests/acceptance/components/catalog-filter.feature index 2635228002..9db4e0ee7c 100644 --- a/ui-v2/tests/acceptance/components/catalog-filter.feature +++ b/ui-v2/tests/acceptance/components/catalog-filter.feature @@ -47,7 +47,7 @@ Feature: components / catalog-filter When I click all on the filter And I see allIsSelected on the filter - Then I type with yaml + Then I fill in with yaml --- s: [Model]-0 --- @@ -75,7 +75,7 @@ Feature: components / catalog-filter When I click services on the tabs And I see servicesIsSelected on the tabs - Then I type with yaml + Then I fill in with yaml --- s: 65535 --- diff --git a/ui-v2/tests/acceptance/components/kv-filter.feature b/ui-v2/tests/acceptance/components/kv-filter.feature index ebe740c466..f2cedbddbd 100644 --- a/ui-v2/tests/acceptance/components/kv-filter.feature +++ b/ui-v2/tests/acceptance/components/kv-filter.feature @@ -12,7 +12,7 @@ Feature: components / kv-filter dc: dc-1 --- Then the url should be [Url] - Then I type with yaml + Then I fill in with yaml --- s: [Text] --- diff --git a/ui-v2/tests/acceptance/components/text-input.feature b/ui-v2/tests/acceptance/components/text-input.feature new file mode 100644 index 0000000000..02bc044138 --- /dev/null +++ b/ui-v2/tests/acceptance/components/text-input.feature @@ -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"} | + -------------------------------------------------------------------------------- diff --git a/ui-v2/tests/acceptance/dc/acls/update.feature b/ui-v2/tests/acceptance/dc/acls/update.feature index 77c6417fd7..f79d637c70 100644 --- a/ui-v2/tests/acceptance/dc/acls/update.feature +++ b/ui-v2/tests/acceptance/dc/acls/update.feature @@ -12,7 +12,7 @@ Feature: dc / acls / update: ACL Update acl: key --- Then the url should be /datacenter/acls/key - Then I type with yaml + Then I fill in with yaml --- name: [Name] --- diff --git a/ui-v2/tests/acceptance/dc/kvs/update.feature b/ui-v2/tests/acceptance/dc/kvs/update.feature index b6a880c8dc..1f00f7c257 100644 --- a/ui-v2/tests/acceptance/dc/kvs/update.feature +++ b/ui-v2/tests/acceptance/dc/kvs/update.feature @@ -12,7 +12,7 @@ Feature: dc / kvs / update: KV Update kv: [Name] --- Then the url should be /datacenter/kv/[Name]/edit - Then I type with yaml + Then I fill in with yaml --- value: [Value] --- diff --git a/ui-v2/tests/acceptance/steps/components/text-input-steps.js b/ui-v2/tests/acceptance/steps/components/text-input-steps.js new file mode 100644 index 0000000000..960cdf533d --- /dev/null +++ b/ui-v2/tests/acceptance/steps/components/text-input-steps.js @@ -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); + }); +} diff --git a/ui-v2/tests/acceptance/token-header.feature b/ui-v2/tests/acceptance/token-header.feature index 750a3fe745..6ca14431c8 100644 --- a/ui-v2/tests/acceptance/token-header.feature +++ b/ui-v2/tests/acceptance/token-header.feature @@ -16,7 +16,7 @@ Feature: token headers Given 1 datacenter model with the value "datacenter" When I visit the settings page Then the url should be /settings - Then I type with yaml + Then I fill in with yaml --- token: [Token] --- diff --git a/ui-v2/tests/pages/dc/acls/edit.js b/ui-v2/tests/pages/dc/acls/edit.js index d15301ef46..7056072201 100644 --- a/ui-v2/tests/pages/dc/acls/edit.js +++ b/ui-v2/tests/pages/dc/acls/edit.js @@ -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'; export default create({ @@ -7,4 +7,5 @@ export default create({ // fillIn: fillable('input, textarea, [contenteditable]'), name: triggerable('keypress', '[name="name"]'), submit: clickable('[type=submit]'), + submitIsEnabled: is(':not(:disabled)', '[type=submit]'), }); diff --git a/ui-v2/tests/pages/dc/kv/edit.js b/ui-v2/tests/pages/dc/kv/edit.js index c8af7bae0f..df07d0df5b 100644 --- a/ui-v2/tests/pages/dc/kv/edit.js +++ b/ui-v2/tests/pages/dc/kv/edit.js @@ -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'; export default create({ @@ -7,4 +7,5 @@ export default create({ // fillIn: fillable('input, textarea, [contenteditable]'), // name: triggerable('keypress', '[name="additional"]'), submit: clickable('[type=submit]'), + submitIsEnabled: is(':not(:disabled)', '[type=submit]'), }); diff --git a/ui-v2/tests/steps.js b/ui-v2/tests/steps.js index 383dc4bf7c..901843bd12 100644 --- a/ui-v2/tests/steps.js +++ b/ui-v2/tests/steps.js @@ -335,7 +335,7 @@ export default function(assert) { `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}`); }) .then(['I see the text "$text" in "$selector"'], function(text, selector) {