mirror of https://github.com/status-im/consul.git
ui: Move linting to the `node:test` script (#9385)
* Reconfigure linting to be a node-test * Fixup linting across the project
This commit is contained in:
parent
0c3db76c92
commit
d6f27c6564
|
@ -1,6 +1,7 @@
|
||||||
app/utils/dom/event-target/event-target-shim/event.js
|
app/utils/dom/event-target/event-target-shim/event.js
|
||||||
# unconventional js
|
# unconventional js
|
||||||
/blueprints/*/files/
|
/blueprints/*/files/
|
||||||
|
/blueprints/*/*-files/
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
||||||
# compiled output
|
# compiled output
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-env node */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"stories": [
|
"stories": [
|
||||||
"../app/**/*.stories.mdx"
|
"../app/**/*.stories.mdx"
|
||||||
|
|
|
@ -4,6 +4,7 @@ module.exports = {
|
||||||
extends: 'octane',
|
extends: 'octane',
|
||||||
rules: {
|
rules: {
|
||||||
'no-partial': false,
|
'no-partial': false,
|
||||||
|
'table-groups': false,
|
||||||
|
|
||||||
'no-invalid-interactive': false,
|
'no-invalid-interactive': false,
|
||||||
'simple-unless': false,
|
'simple-unless': false,
|
||||||
|
|
|
@ -69,10 +69,10 @@ test-parallel: deps
|
||||||
yarn run test:parallel
|
yarn run test:parallel
|
||||||
|
|
||||||
lint: deps
|
lint: deps
|
||||||
yarn run lint:hbs && yarn run lint:js
|
yarn run lint
|
||||||
|
|
||||||
format: deps
|
format: deps
|
||||||
yarn run format:js
|
yarn run format
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
yarn run steps:list
|
yarn run steps:list
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { get, set, computed } from '@ember/object';
|
import { get, set, computed } from '@ember/object';
|
||||||
import { alias, sort } from '@ember/object/computed';
|
import { alias } from '@ember/object/computed';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { set, get, computed } from '@ember/object';
|
import { set, get, computed } from '@ember/object';
|
||||||
import { schedule } from '@ember/runloop';
|
|
||||||
|
|
||||||
import { createRoute, getSplitters, getRoutes, getResolvers } from './utils';
|
import { createRoute, getSplitters, getRoutes, getResolvers } from './utils';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import Component from '@glimmer/component';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
import { sort } from '@ember/object/computed';
|
|
||||||
|
|
||||||
export default class ConsulIntentionList extends Component {
|
export default class ConsulIntentionList extends Component {
|
||||||
@service('repository/intention') repo;
|
@service('repository/intention') repo;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import { action } from '@ember/object';
|
|
||||||
|
|
||||||
export default class ConsulNspaceList extends Component {
|
export default class ConsulNspaceList extends Component {
|
||||||
isLinkable(item) {
|
isLinkable(item) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default class TomographyGraph extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
get distances() {
|
get distances() {
|
||||||
const distances = this.args.distances || [];
|
let distances = this.args.distances || [];
|
||||||
const max = distances.reduce((prev, d) => Math.max(prev, d.distance), this.max);
|
const max = distances.reduce((prev, d) => Math.max(prev, d.distance), this.max);
|
||||||
const len = distances.length;
|
const len = distances.length;
|
||||||
if (len > 360) {
|
if (len > 360) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class DataCollectionComponent extends Component {
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed('args.items', 'args.items.content')
|
@computed('args{items,.items.content}')
|
||||||
get content() {
|
get content() {
|
||||||
// TODO: Temporary little hack to ensure we detect DataSource proxy
|
// TODO: Temporary little hack to ensure we detect DataSource proxy
|
||||||
// objects but not any other special Ember Proxy object like ember-data
|
// objects but not any other special Ember Proxy object like ember-data
|
||||||
|
@ -53,7 +53,7 @@ export default class DataCollectionComponent extends Component {
|
||||||
|
|
||||||
@computed('type', 'filtered', 'args.filters.searchproperties', 'searchTerm')
|
@computed('type', 'filtered', 'args.filters.searchproperties', 'searchTerm')
|
||||||
get searched() {
|
get searched() {
|
||||||
if (typeof this.searchTerm === '') {
|
if (this.searchTerm === '') {
|
||||||
return this.filtered;
|
return this.filtered;
|
||||||
}
|
}
|
||||||
const predicate = this.searchService.predicate(this.type);
|
const predicate = this.searchService.predicate(this.type);
|
||||||
|
|
|
@ -37,13 +37,8 @@ export default Component.extend(Slotted, {
|
||||||
} else {
|
} else {
|
||||||
name = prop;
|
name = prop;
|
||||||
}
|
}
|
||||||
const form = this.form;
|
this.form.handleEvent(event, name);
|
||||||
try {
|
this.onchange({ target: this });
|
||||||
form.handleEvent(event, name);
|
|
||||||
this.onchange({ target: this });
|
|
||||||
} catch (err) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,6 @@ import Slotted from 'block-slots';
|
||||||
const formatItemStyle = PercentageColumns.prototype.formatItemStyle;
|
const formatItemStyle = PercentageColumns.prototype.formatItemStyle;
|
||||||
|
|
||||||
export default Component.extend(Slotted, {
|
export default Component.extend(Slotted, {
|
||||||
tagName: '',
|
|
||||||
dom: service('dom'),
|
dom: service('dom'),
|
||||||
tagName: '',
|
tagName: '',
|
||||||
height: 500,
|
height: 500,
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<button
|
<button
|
||||||
{{on 'click' (fn (optional this.popoverController.hide))}}
|
{{on 'click' (fn (optional this.popoverController.hide))}}
|
||||||
class="cancel"
|
class="cancel"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
<button
|
<button
|
||||||
{{on 'click' (fn (optional this.popoverController.hide))}}
|
{{on 'click' (fn (optional this.popoverController.hide))}}
|
||||||
class="cancel"
|
class="cancel"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
Close
|
Close
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import setHelpers from 'mnemonist/set';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
kinds: {
|
kinds: {
|
||||||
'global-management': (item, value) => item.isGlobalManagement,
|
'global-management': (item, value) => item.isGlobalManagement,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Model, { attr } from '@ember-data/model';
|
import { attr } from '@ember-data/model';
|
||||||
import ServiceInstanceModel from './service-instance';
|
import ServiceInstanceModel from './service-instance';
|
||||||
|
|
||||||
export const PRIMARY_KEY = 'uid';
|
export const PRIMARY_KEY = 'uid';
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default class ServiceInstance extends Model {
|
||||||
@alias('Service.Service') Name;
|
@alias('Service.Service') Name;
|
||||||
|
|
||||||
// If the ID is blank fallback to the Service.Service (the Name)
|
// If the ID is blank fallback to the Service.Service (the Name)
|
||||||
@or('Service.ID', 'Service.Service') ID;
|
@or('Service.{ID,Service}') ID;
|
||||||
@or('Service.Address', 'Node.Service') Address;
|
@or('Service.Address', 'Node.Service') Address;
|
||||||
|
|
||||||
@alias('Service.Tags') Tags;
|
@alias('Service.Tags') Tags;
|
||||||
|
@ -54,7 +54,7 @@ export default class ServiceInstance extends Model {
|
||||||
// MeshChecks are a concatenation of Checks for the Instance and Checks for
|
// MeshChecks are a concatenation of Checks for the Instance and Checks for
|
||||||
// the ProxyInstance. Checks is an ember-data-model-fragment, so we can't just
|
// the ProxyInstance. Checks is an ember-data-model-fragment, so we can't just
|
||||||
// concat it, we have to loop through all the items in order to merge
|
// concat it, we have to loop through all the items in order to merge
|
||||||
@computed('Checks', 'ProxyInstance.Checks', 'ProxyInstance.ServiceProxy.Expose.Checks')
|
@computed('Checks', 'ProxyInstance{Checks,ServiceProxy.Expose.Checks}')
|
||||||
get MeshChecks() {
|
get MeshChecks() {
|
||||||
return (get(this, 'Checks') || [])
|
return (get(this, 'Checks') || [])
|
||||||
.map(item => {
|
.map(item => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Model, { attr } from '@ember-data/model';
|
import Model, { attr } from '@ember-data/model';
|
||||||
import { computed, get } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
|
|
||||||
export const PRIMARY_KEY = 'uid';
|
export const PRIMARY_KEY = 'uid';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Route from 'consul-ui/routing/route';
|
import Route from 'consul-ui/routing/route';
|
||||||
import { get } from '@ember/object';
|
import { get } from '@ember/object';
|
||||||
import { action, setProperties } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
|
|
||||||
export default class ShowRoute extends Route {
|
export default class ShowRoute extends Route {
|
||||||
@service('data-source/service') data;
|
@service('data-source/service') data;
|
||||||
|
@ -10,7 +10,6 @@ export default class ShowRoute extends Route {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async createIntention(source, destination) {
|
async createIntention(source, destination) {
|
||||||
const intention = service.Intention;
|
|
||||||
const model = this.repo.create({
|
const model = this.repo.create({
|
||||||
Datacenter: source.Datacenter,
|
Datacenter: source.Datacenter,
|
||||||
SourceName: source.Name,
|
SourceName: source.Name,
|
||||||
|
|
|
@ -23,9 +23,10 @@ export default class NodeSerializer extends Serializer.extend(EmbeddedRecordsMix
|
||||||
};
|
};
|
||||||
|
|
||||||
transformHasManyResponse(store, relationship, item, parent = null) {
|
transformHasManyResponse(store, relationship, item, parent = null) {
|
||||||
|
let checks = {};
|
||||||
|
let serializer;
|
||||||
switch (relationship.key) {
|
switch (relationship.key) {
|
||||||
case 'Services':
|
case 'Services':
|
||||||
const checks = {};
|
|
||||||
(item.Checks || [])
|
(item.Checks || [])
|
||||||
.filter(item => {
|
.filter(item => {
|
||||||
return item.ServiceID !== '';
|
return item.ServiceID !== '';
|
||||||
|
@ -36,7 +37,7 @@ export default class NodeSerializer extends Serializer.extend(EmbeddedRecordsMix
|
||||||
}
|
}
|
||||||
checks[item.ServiceID].push(item);
|
checks[item.ServiceID].push(item);
|
||||||
});
|
});
|
||||||
const serializer = this.store.serializerFor(relationship.type);
|
serializer = this.store.serializerFor(relationship.type);
|
||||||
item.Services = item.Services.map(service =>
|
item.Services = item.Services.map(service =>
|
||||||
serializer.transformHasManyResponseFromNode(item, service, checks)
|
serializer.transformHasManyResponseFromNode(item, service, checks)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import RepositoryService from 'consul-ui/services/repository';
|
import RepositoryService from 'consul-ui/services/repository';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { set, get } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
|
|
||||||
const modelName = 'service-instance';
|
const modelName = 'service-instance';
|
||||||
export default class ServiceInstanceService extends RepositoryService {
|
export default class ServiceInstanceService extends RepositoryService {
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
const path = require('path');
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
|
|
||||||
const testInfo = require('ember-cli-test-info');
|
|
||||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||||
|
|
||||||
module.exports = useTestFrameworkDetector({
|
module.exports = useTestFrameworkDetector({
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/*eslint node/no-extraneous-require: "off"*/
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'Generates a Consul HTTP ember-data adapter',
|
description: 'Generates a Consul HTTP ember-data adapter',
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const path = require('path');
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
|
|
||||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||||
|
|
||||||
module.exports = useTestFrameworkDetector({
|
module.exports = useTestFrameworkDetector({
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/*eslint node/no-extraneous-require: "off"*/
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'Generates a Consul HTTP ember-data model',
|
description: 'Generates a Consul HTTP ember-data model',
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const path = require('path');
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
|
|
||||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||||
|
|
||||||
module.exports = useTestFrameworkDetector({
|
module.exports = useTestFrameworkDetector({
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const path = require('path');
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
|
|
||||||
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
|
||||||
|
|
||||||
module.exports = useTestFrameworkDetector({
|
module.exports = useTestFrameworkDetector({
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/*eslint node/no-extraneous-require: "off"*/
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'Generates a Consul HTTP ember-data serializer',
|
description: 'Generates a Consul HTTP ember-data serializer',
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Funnel = require('broccoli-funnel');
|
const Funnel = require('broccoli-funnel');
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
'use strict';
|
'use strict';
|
||||||
//
|
//
|
||||||
const $ = process.env;
|
const $ = process.env;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* eslint-env node */
|
||||||
|
|
||||||
const test = require('tape');
|
const test = require('tape');
|
||||||
|
|
||||||
const getEnvironment = require('../../config/environment.js');
|
const getEnvironment = require('../../config/environment.js');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* eslint-env node */
|
||||||
|
|
||||||
const test = require('tape');
|
const test = require('tape');
|
||||||
|
|
||||||
const utils = require('../../config/utils.js');
|
const utils = require('../../config/utils.js');
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"build:staging": "ember build --environment staging",
|
"build:staging": "ember build --environment staging",
|
||||||
"build:ci": "ember build --environment test",
|
"build:ci": "ember build --environment test",
|
||||||
"doc:toc": "doctoc README.md",
|
"doc:toc": "doctoc README.md",
|
||||||
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
|
"lint": "FORCE_COLOR=1 npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
|
||||||
"lint:hbs": "ember-template-lint .",
|
"lint:hbs": "ember-template-lint .",
|
||||||
"lint:js": "eslint .",
|
"lint:js": "eslint .",
|
||||||
"_lint:dev:js": "eslint -c .dev.eslintrc.js --fix ./*.js ./.*.js app config lib server tests",
|
"_lint:dev:js": "eslint -c .dev.eslintrc.js --fix ./*.js ./.*.js app config lib server tests",
|
||||||
|
@ -25,13 +25,14 @@
|
||||||
"start:consul": "ember serve --proxy=${CONSUL_HTTP_ADDR:-http://localhost:8500} --port=${EMBER_SERVE_PORT:-4200} --live-reload-port=${EMBER_LIVE_RELOAD_PORT:-7020}",
|
"start:consul": "ember serve --proxy=${CONSUL_HTTP_ADDR:-http://localhost:8500} --port=${EMBER_SERVE_PORT:-4200} --live-reload-port=${EMBER_LIVE_RELOAD_PORT:-7020}",
|
||||||
"start:api": "api-double --dir ./node_modules/@hashicorp/consul-api-double",
|
"start:api": "api-double --dir ./node_modules/@hashicorp/consul-api-double",
|
||||||
"test": "ember test --test-port=${EMBER_TEST_PORT:-7357}",
|
"test": "ember test --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
|
"test:lint": "yarn run lint",
|
||||||
"test:oss": "CONSUL_NSPACES_ENABLED=0 ember test --test-port=${EMBER_TEST_PORT:-7357}",
|
"test:oss": "CONSUL_NSPACES_ENABLED=0 ember test --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
"test:ci": "ember test --test-port=${EMBER_TEST_PORT:-7357} --path dist --silent --reporter xunit",
|
"test:ci": "ember test --test-port=${EMBER_TEST_PORT:-7357} --path dist --silent --reporter xunit",
|
||||||
"test:oss:ci": "CONSUL_NSPACES_ENABLED=0 ember test --test-port=${EMBER_TEST_PORT:-7357} --path dist --silent --reporter xunit",
|
"test:oss:ci": "CONSUL_NSPACES_ENABLED=0 ember test --test-port=${EMBER_TEST_PORT:-7357} --path dist --silent --reporter xunit",
|
||||||
"test:parallel": "EMBER_EXAM_PARALLEL=true ember exam --split=4 --parallel",
|
"test:parallel": "EMBER_EXAM_PARALLEL=true ember exam --split=4 --parallel",
|
||||||
"test:view": "ember test --server --test-port=${EMBER_TEST_PORT:-7357}",
|
"test:view": "ember test --server --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
"test:oss:view": "CONSUL_NSPACES_ENABLED=0 ember test --server --test-port=${EMBER_TEST_PORT:-7357}",
|
"test:oss:view": "CONSUL_NSPACES_ENABLED=0 ember test --server --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
"test:node": "tape ./node-tests/**/*.js",
|
"test:node": "yarn run test:lint && tape ./node-tests/**/*.js",
|
||||||
"test:coverage": "COVERAGE=true ember test --environment test --filter=Unit --test-port=${EMBER_TEST_PORT:-7357}",
|
"test:coverage": "COVERAGE=true ember test --environment test --filter=Unit --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
"test:coverage:ci": "COVERAGE=true ember test --environment test --filter=Unit --path dist --test-port=${EMBER_TEST_PORT:-7357}",
|
"test:coverage:ci": "COVERAGE=true ember test --environment test --filter=Unit --path dist --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
"test:coverage:view": "COVERAGE=true ember test --server --environment test --filter=Unit --test-port=${EMBER_TEST_PORT:-7357}",
|
"test:coverage:view": "COVERAGE=true ember test --server --environment test --filter=Unit --test-port=${EMBER_TEST_PORT:-7357}",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*eslint node/no-extraneous-require: "off"*/
|
||||||
'use strict';
|
'use strict';
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const promisify = require('util').promisify;
|
const promisify = require('util').promisify;
|
||||||
|
|
|
@ -49,17 +49,6 @@ module('Integration | Serializer | node', function(hooks) {
|
||||||
url: `/v1/internal/ui/node/${id}?dc=${dc}`,
|
url: `/v1/internal/ui/node/${id}?dc=${dc}`,
|
||||||
};
|
};
|
||||||
return get(request.url).then(function(payload) {
|
return get(request.url).then(function(payload) {
|
||||||
const expected = Object.assign({}, payload, {
|
|
||||||
Datacenter: dc,
|
|
||||||
[META]: {
|
|
||||||
[DC.toLowerCase()]: dc,
|
|
||||||
[NSPACE.toLowerCase()]: nspace,
|
|
||||||
},
|
|
||||||
// TODO: default isn't required here, once we've
|
|
||||||
// refactored out our Serializer this can go
|
|
||||||
Namespace: nspace,
|
|
||||||
uid: `["${nspace}","${dc}","${id}"]`,
|
|
||||||
});
|
|
||||||
const actual = serializer.respondForQueryRecord(
|
const actual = serializer.respondForQueryRecord(
|
||||||
function(cb) {
|
function(cb) {
|
||||||
const headers = {};
|
const headers = {};
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
export default function(scenario, assert, find, currentPage) {
|
export default function(scenario, assert, find, currentPage) {
|
||||||
scenario.then('I see the $property form with yaml\n$yaml', function(property, data) {
|
scenario.then('I see the $property form with yaml\n$yaml', function(property, data) {
|
||||||
|
let obj;
|
||||||
try {
|
try {
|
||||||
let obj;
|
obj = find(property);
|
||||||
try {
|
|
||||||
obj = find(property);
|
|
||||||
} catch (e) {
|
|
||||||
obj = currentPage();
|
|
||||||
}
|
|
||||||
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
|
||||||
const name = `${obj.prefix || property}[${item}]`;
|
|
||||||
const $el = document.querySelector(`[name="${name}"]`);
|
|
||||||
const actual = $el.value;
|
|
||||||
const expected = data[item];
|
|
||||||
assert.strictEqual(actual, expected, `Expected settings to be ${expected} was ${actual}`);
|
|
||||||
}, obj);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
obj = currentPage();
|
||||||
}
|
}
|
||||||
|
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
||||||
|
const name = `${obj.prefix || property}[${item}]`;
|
||||||
|
const $el = document.querySelector(`[name="${name}"]`);
|
||||||
|
const actual = $el.value;
|
||||||
|
const expected = data[item];
|
||||||
|
assert.strictEqual(actual, expected, `Expected settings to be ${expected} was ${actual}`);
|
||||||
|
}, obj);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,14 +189,12 @@ export default function(scenario, assert, find, currentPage, $) {
|
||||||
],
|
],
|
||||||
function(property, component, containsLike, value) {
|
function(property, component, containsLike, value) {
|
||||||
let target;
|
let target;
|
||||||
try {
|
|
||||||
if (typeof component === 'string') {
|
if (typeof component === 'string') {
|
||||||
property = `${component}.${property}`;
|
property = `${component}.${property}`;
|
||||||
}
|
|
||||||
target = find(property);
|
|
||||||
} catch (e) {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
target = find(property);
|
||||||
|
|
||||||
if (containsLike === 'like') {
|
if (containsLike === 'like') {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
target,
|
target,
|
||||||
|
|
|
@ -11,14 +11,10 @@ export default function(scenario, find, click) {
|
||||||
'I click $property on the $component component',
|
'I click $property on the $component component',
|
||||||
],
|
],
|
||||||
function(property, component, next) {
|
function(property, component, next) {
|
||||||
try {
|
if (typeof component === 'string') {
|
||||||
if (typeof component === 'string') {
|
property = `${component}.${property}`;
|
||||||
property = `${component}.${property}`;
|
|
||||||
}
|
|
||||||
return find(property)();
|
|
||||||
} catch (e) {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
return find(property)();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,41 +37,37 @@ export default function(scenario, find, fillIn, triggerKeyEvent, currentPage) {
|
||||||
`I${dont} fill in the $property on the $component component with yaml\n$yaml`,
|
`I${dont} fill in the $property on the $component component with yaml\n$yaml`,
|
||||||
],
|
],
|
||||||
function(negative, property, component, data, next) {
|
function(negative, property, component, data, next) {
|
||||||
try {
|
switch (true) {
|
||||||
switch (true) {
|
case typeof component === 'string':
|
||||||
case typeof component === 'string':
|
property = `${component}.${property}`;
|
||||||
property = `${component}.${property}`;
|
// fallthrough
|
||||||
// fallthrough
|
case typeof data === 'undefined':
|
||||||
case typeof data === 'undefined':
|
data = component;
|
||||||
data = component;
|
// // fallthrough
|
||||||
// // fallthrough
|
// case typeof property !== 'string':
|
||||||
// case typeof property !== 'string':
|
// data = property;
|
||||||
// data = property;
|
|
||||||
}
|
|
||||||
let obj;
|
|
||||||
try {
|
|
||||||
obj = find(property);
|
|
||||||
} catch (e) {
|
|
||||||
obj = currentPage();
|
|
||||||
}
|
|
||||||
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
|
||||||
const name = `${obj.prefix || property}[${item}]`;
|
|
||||||
if (negative) {
|
|
||||||
try {
|
|
||||||
fillInElement(prev, name, data[item]);
|
|
||||||
throw new TypeError(`${item} is editable`);
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return fillInElement(prev, name, data[item]);
|
|
||||||
}
|
|
||||||
}, obj);
|
|
||||||
} catch (e) {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
let obj;
|
||||||
|
try {
|
||||||
|
obj = find(property);
|
||||||
|
} catch (e) {
|
||||||
|
obj = currentPage();
|
||||||
|
}
|
||||||
|
return Object.keys(data).reduce(function(prev, item, i, arr) {
|
||||||
|
const name = `${obj.prefix || property}[${item}]`;
|
||||||
|
if (negative) {
|
||||||
|
try {
|
||||||
|
fillInElement(prev, name, data[item]);
|
||||||
|
throw new TypeError(`${item} is editable`);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof TypeError) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return fillInElement(prev, name, data[item]);
|
||||||
|
}
|
||||||
|
}, obj);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(['I type "$text" into "$selector"'], function(text, selector) {
|
.then(['I type "$text" into "$selector"'], function(text, selector) {
|
||||||
|
|
Loading…
Reference in New Issue