Fix linting typo, caused the selection of future services to break

This commit is contained in:
John Cowen 2018-06-15 12:47:12 +01:00 committed by Jack Pearkes
parent e3cbbf4eed
commit 2f56c6e1be
8 changed files with 64 additions and 6 deletions

View File

@ -39,8 +39,8 @@ export default Controller.extend({
change: function(e, value, _target) {
// normalize back to standard event
const target = e.target || { ..._target, ...{ name: e, value: value } };
let name,
selected = target.value;
let name, selected;
name = selected = target.value;
// TODO:
// linter needs this here?
let match;

View File

@ -1,6 +1,6 @@
<form>
<fieldset>
<label class="type-text{{if item.error.SourceName ' has-error'}}">
<label data-test-source-element class="type-text{{if item.error.SourceName ' has-error'}}">
<span>Source Service</span>
{{#power-select-with-create
options=items
@ -20,7 +20,7 @@
{{/power-select-with-create}}
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
</label>
<label class="type-text{{if item.error.DestinationName ' has-error'}}">
<label data-test-destination-element class="type-text{{if item.error.DestinationName ' has-error'}}">
<span>Destination Service</span>
{{#power-select-with-create
options=items

View File

@ -0,0 +1,23 @@
@setupApplicationTest
Feature: dc / intentions / form select: Intention Service Select Dropdowns
In order to set future Consul services as intention sources and destinations
As a user
I want to type into the autocomplete and select what I've typed to use it as the future service
Scenario: Selecting a future Consul Service in to [Name]
Given 1 datacenter model with the value "datacenter"
When I visit the intention page for yaml
---
dc: datacenter
intention: intention
---
Then the url should be /datacenter/intentions/intention
And I click "[data-test-[Name]-element] .ember-power-select-trigger"
And I type "something" into ".ember-power-select-search-input"
And I click ".ember-power-select-option:first-child"
Then I see "something" in "[data-test-[Name]-element] .ember-power-select-selected-item"
Where:
---------------
| Name |
| source |
| destination |
---------------

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

@ -17,6 +17,9 @@ export default function(type, count, obj) {
key = 'CONSUL_ACL_COUNT';
obj['CONSUL_ENABLE_ACLS'] = 1;
break;
case 'intention':
key = 'CONSUL_INTENTION_COUNT';
break;
}
if (key) {
obj[key] = count;

View File

@ -8,6 +8,7 @@ import kvs from 'consul-ui/tests/pages/dc/kv/index';
import kv from 'consul-ui/tests/pages/dc/kv/edit';
import acls from 'consul-ui/tests/pages/dc/acls/index';
import acl from 'consul-ui/tests/pages/dc/acls/edit';
import intention from 'consul-ui/tests/pages/dc/intentions/edit';
export default {
index,
@ -20,4 +21,5 @@ export default {
kv,
acls,
acl,
intention,
};

View File

@ -0,0 +1,8 @@
import { create, clickable } from 'ember-cli-page-object';
import { visitable } from 'consul-ui/tests/lib/page-object/visitable';
export default create({
// custom visitable
visit: visitable(['/:dc/intentions/:intention', '/:dc/intentions/create']),
submit: clickable('[type=submit]'),
});

View File

@ -1,6 +1,6 @@
/* eslint no-console: "off" */
import yadda from './helpers/yadda';
import { currentURL, click, triggerKeyEvent } from '@ember/test-helpers';
import { currentURL, click, triggerKeyEvent, fillIn, find } from '@ember/test-helpers';
import getDictionary from '@hashicorp/ember-cli-api-double/dictionary';
import pages from 'consul-ui/tests/pages';
import api from 'consul-ui/tests/helpers/api';
@ -33,6 +33,9 @@ export default function(assert) {
case 'acls':
model = 'acl';
break;
case 'intentions':
model = 'intention';
break;
}
cb(null, model);
}, yadda)
@ -100,6 +103,9 @@ export default function(assert) {
return prev.fillIn(item, data[item]);
}, currentPage);
})
.then(['I type "$text" into "$selector"'], function(text, selector) {
return fillIn(selector, text);
})
.then(['I type with yaml\n$yaml'], function(data) {
const keys = Object.keys(data);
return keys
@ -109,7 +115,7 @@ export default function(assert) {
.then(function() {
return Promise.all(
keys.map(function(item) {
return triggerKeyEvent(`[name="${item}"]`, 'keyup', 83);
return triggerKeyEvent(`[name="${item}"]`, 'keyup', 83); // TODO: This is 's', be more generic
})
);
});
@ -273,6 +279,12 @@ export default function(assert) {
.then(['I see $property'], function(property, component) {
assert.ok(currentPage[property], `Expected to see ${property}`);
})
.then(['I see "$text" in "$selector"'], function(text, selector) {
assert.ok(
find(selector).textContent.indexOf(text) !== -1,
`Expected to see ${text} in ${selector}`
);
})
.then('ok', function() {
assert.ok(true);
})