diff --git a/.eslintrc b/.eslintrc.js similarity index 60% rename from .eslintrc rename to .eslintrc.js index 68e59e96..1b252269 100644 --- a/.eslintrc +++ b/.eslintrc.js @@ -1,13 +1,10 @@ -{ - "extends": ["frost-standard"], - "globals": { - "URL": false - }, - "rules": { +module.exports = { + extends: 'frost-standard', + rules: { "ocd/sort-import-declarations": [ 2, { - "localPrefixes": [ + localPrefixes: [ "../", "./", "dummy/", diff --git a/.gitignore b/.gitignore index 59dc1a60..984f313c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. +# See https://help.github.com/ignore-files/ for more about ignoring files. # compiled output /dist @@ -14,7 +14,7 @@ /coverage/* /libpeerconnection.log coverage.json -npm-debug.log +npm-debug.log* testem.log .idea ge.json diff --git a/.npmignore b/.npmignore index dfcfbda5..09128522 100644 --- a/.npmignore +++ b/.npmignore @@ -1,10 +1,10 @@ -.travis/ -bower_components/ -coverage/ -dist/ -node_modules/ -tests/ -tmp/ +/.travis +/bower_components +/config/ember-try.js +/coverage +/dist +/tests +/tmp **/.gitkeep @@ -13,14 +13,15 @@ tmp/ .editorconfig .ember-cli .eslintignore -.eslintrc +.eslintrc.js +.gitignore .idea .npmignore .pullapprove.yml .remarkrc .sass-lint.yml .travis.yml +.watchmanconfig bower.json -Brocfile.js +ember-cli-build.js testem.js -testem.json diff --git a/.travis.yml b/.travis.yml index 88601eb7..8823f19c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ dist: trusty language: node_js node_js: - '6.9.1' - - '7.10.0' + - 'stable' addons: apt: sources: @@ -13,13 +13,10 @@ addons: - google-chrome-stable - g++-4.8 firefox: 'latest-esr' -cache: - directories: - - node_modules env: matrix: - EMBER_TRY_SCENARIO=ember-2-8 - - EMBER_TRY_SCENARIO=default + - EMBER_TRY_SCENARIO=ember-default global: - CXX=g++-4.8 - secure: UAeyuAKSROuXqFhNeMMMKhSTwyO7J1o/dyT7p/nVVlxagujCD2A4ggzREg+HBCWDurDqdmN5tVYTC+crVVgjmX9lIpukDGAomXR5wln8niSlu4H0rxqBdbjuCKFbS8EPKy56c/n50TNMjMCkCejAU8sdZLbJT8OMHpLMdl+WkyCGEzBgNiTbxUFu5AkuVAhhS0xBChiBh6uCLXqOku9B2UDIs9U9qYV99B0HLOeksZS/errOtVpaJr+qQOP0tm+cbtUxeI+Ub+uEnnuoKjbEtJwnzaToZPA2i9X+Xe9WR0sIXFmS/vF1syVYdvZE2z/fCCydjwczM93Td/Oq9KluFikwX+y807MmgjFiv1rSeBRLob8wKQBlNoEc+NydDsRdQjsFjOQWG0yc/C78Xqi7PHipZw/Wf5GzOgxmxqjOvM2s16VBI9UJPcMme7FykDeHwoROi4xCGvjFLyxJ3UjsthwY+uRS1YVmGIlqMUJEdSUquAeVevRaEaPmH4n6qdXsTjMw+75UPfw4SgBZuO0DFnC8Tgr4UZY6IkL7NQxWenZZje1pkjTkBHLy7SitNjugEYqukVf5SGUyC2mtMbbBDOlZBQML9/s7jbmGFENbAc2+EtvVq2Hu+u+DciN9IRSwZtmI06p8d1ifCwoU1NU7RCdchu22n0D8/EG6aDuOwDI= @@ -49,7 +46,7 @@ deploy: secure: ESPMbZwhsrfGfO/p+f5ykZFWImTxNHe8Wab2+EZge87P8ZojO0JhkpnpCM8p9mrHOz+gp2exzGViyjS1FoIRw8yr0kV2fbuCUhZy014nft9WtGnwGs/f9y7odFBOGIlRg4i23VtRjKtE9xsNdS6bOORtxg6IK/b9l25sd+dEhhPG29HkWmGGnjCeWFGTRum0jF7HMCRAp1FSKvELIdDegBs9qxMuv5yu5ozGRyjufwXRSkWd9o0FQDTweJPqGF+izkf5am8q0jbYRlZdUBCMw4Ew4bhtmx1oDOmUO+WgPUCPzfXirvwsMTQaaK2em5PIF78S2yQNh8PTziRcOOMmXGnKmZwcypsQ2Bd6GDOOG6vsXZ9cMpWpnCpPPx44bR2jwuwUrSfjSPv3OJgZIo4RP75NIPv46tST0JdFqth+kEBtCzHNgpQWyBUUFIyoqSjkTKk4WHA/JVHIrOamp0WoZnG/e9CwuC3IXh4fIlyjI6rTMjP9U82Z+rxNmk149WoQ9ilYqlcVv+xUjQsb4zRda7LGeHGzG5f4onwdv4Pg0BiHkKAwYLClwV1GAK6+oQsyw2jpyW4dRuR79zp0dw+cluad78x4mKhqJkf5HmqTsrwDdfAn27WzOW8YT12iaULnn/IE1xBfVNEp8AqMUAxPcEUjusOx3o+TAb4m9ale7cg= on: all_branches: true - condition: "$EMBER_TRY_SCENARIO = 'default'" + condition: "$EMBER_TRY_SCENARIO = 'ember-default'" node: '6.9.1' tags: true notifications: diff --git a/.travis/maybe-bump-version.sh b/.travis/maybe-bump-version.sh index 1b6137cf..963dda55 100755 --- a/.travis/maybe-bump-version.sh +++ b/.travis/maybe-bump-version.sh @@ -6,7 +6,7 @@ then exit 0 fi -if [ "$EMBER_TRY_SCENARIO" != "default" ] +if [ "$EMBER_TRY_SCENARIO" != "ember-default" ] then echo "Skipping version bump for EMBER_TRY_SCENARIO ${EMBER_TRY_SCENARIO}" exit 0 diff --git a/.travis/maybe-publish-coverage.sh b/.travis/maybe-publish-coverage.sh index bf74b411..0dc2b50e 100755 --- a/.travis/maybe-publish-coverage.sh +++ b/.travis/maybe-publish-coverage.sh @@ -14,7 +14,7 @@ then exit 0 fi -if [ "$EMBER_TRY_SCENARIO" != "default" ] +if [ "$EMBER_TRY_SCENARIO" != "ember-default" ] then echo "Skipping coverage publish for EMBER_TRY_SCENARIO ${EMBER_TRY_SCENARIO}" exit 0 diff --git a/addon/components/cell.js b/addon/components/cell.js index 97bacbd9..69dbab61 100644 --- a/addon/components/cell.js +++ b/addon/components/cell.js @@ -78,9 +78,10 @@ export default Component.extend(HookMixin, PropTypeMixin, { } }, /* eslint-disable complexity */ - didReceiveAttrs (attrs) { + didReceiveAttrs () { const valueChangeSet = this.get('valueChangeSet') - const oldCellConfig = get(attrs, 'oldAttrs.cellConfig.value') + + const oldCellConfig = this.get('_oldCellConfig.value') const newCellConfig = this.get('cellConfig') let isDirty = false @@ -110,6 +111,8 @@ export default Component.extend(HookMixin, PropTypeMixin, { if (!_.isEqual(newClassNames, oldClassNames)) { this.set('classNames', newClassNames) } + + this.set('_oldCellConfig', newCellConfig) }, /* eslint-enable complexity */ diff --git a/addon/components/detail.js b/addon/components/detail.js index ab44780e..47c4410c 100644 --- a/addon/components/detail.js +++ b/addon/components/detail.js @@ -19,7 +19,7 @@ const { const {getSubModel} = utils import Ember from 'ember' -const {A, Component, Logger, RSVP, get, getOwner, isEmpty, run, typeOf} = Ember +const {A, Component, Logger, RSVP, getOwner, isEmpty, run, typeOf} = Ember import computed, {readOnly} from 'ember-computed-decorators' import {HookMixin} from 'ember-hook' import PropTypeMixin, {PropTypes} from 'ember-prop-types' @@ -51,15 +51,6 @@ function getAlias (cell) { return Ember.String.capitalize(words) } -function getAttr (attrs, key) { - attrs = attrs || {} - - return ( - get(attrs, `${key}.value`) || - get(attrs, `options.value.${key}`) - ) -} - /** * Determine if an object is an Ember.Object or not * @param {Object|Ember.Object} object - object to check @@ -543,16 +534,13 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, { /* eslint-disable complexity */ /** * Determines if the any of the schema attrs has changed - * @param {String} schemaName - the name of the schema attribute - * @param {Object} oldAttrs - the old attributes - * @param {Object} newAttrs - the new attributes + * @param {Object} oldSchema - the old schema + * @param {Object} newSchema - the new schema * @returns {Object} the old and new schemas */ - getSchema (schemaName, oldAttrs, newAttrs) { - const newSchema = getAttr(newAttrs, schemaName) - const newSchemaPojo = isEmberObject(newSchema) ? deemberify(newSchema) : newSchema - const oldSchema = getAttr(oldAttrs, schemaName) + getSchema (oldSchema, newSchema) { const oldSchemaPojo = isEmberObject(oldSchema) ? deemberify(oldSchema) : oldSchema + const newSchemaPojo = isEmberObject(newSchema) ? deemberify(newSchema) : newSchema return { hasChanged: !_.isEqual(oldSchemaPojo, newSchemaPojo), @@ -617,19 +605,25 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, { /** * Keep value in sync with store and validate properties */ - didReceiveAttrs ({newAttrs, oldAttrs}) { + didReceiveAttrs () { this._super(...arguments) let dispatchValue + const oldAttrBunsenModel = this.get('_oldAttrBunsenModel') + const newAttrBunsenModel = this.get('bunsenModel') || this.get('options.bunsenModel') + + const oldAttrBunsenView = this.get('_oldAttrBunsenView') + const newAttrBunsenView = this.get('bunsenView') || this.get('options.bunsenView') + const reduxStore = this.get('reduxStore') const reduxStoreValue = reduxStore.getState().value const value = this.get('value') const plainObjectValue = isEmberObject(value) ? deemberify(value) : value const hasUserProvidedValue = [null, undefined].indexOf(plainObjectValue) === -1 const isReduxStoreValueEmpty = [null, undefined].indexOf(reduxStoreValue) !== -1 - const {hasChanged: hasModelChanged, newSchema: newBunsenModel} = this.getSchema('bunsenModel', oldAttrs, newAttrs) - const {hasChanged: hasViewChanged, newSchema: newView} = this.getSchema('bunsenView', oldAttrs, newAttrs) + const {hasChanged: hasModelChanged, newSchema: newBunsenModel} = this.getSchema(oldAttrBunsenModel, newAttrBunsenModel) // eslint-disable-line max-len + const {hasChanged: hasViewChanged, newSchema: newView} = this.getSchema(oldAttrBunsenView, newAttrBunsenView) const allValidators = this.getAllValidators() const mergeDefaults = this.get('mergeDefaults') @@ -674,6 +668,9 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, { } this.updateSelectedTab() + + this.set('_oldAttrBunsenModel', newAttrBunsenModel) + this.set('_oldAttrBunsenView', newAttrBunsenView) }, /* eslint-enable complexity */ diff --git a/config/ember-try.js b/config/ember-try.js index 34bb1569..df3f8f4c 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,121 +1,7 @@ +/* eslint-env node */ + module.exports = { scenarios: [ - { - name: 'default', - bower: { - dependencies: { } - } - }, - { - name: 'ember-1-12', - bower: { - dependencies: { - 'ember': '~1.12.0' - }, - resolutions: { - 'ember': '~1.12.0' - } - } - }, - { - name: 'ember-1-13', - bower: { - dependencies: { - 'ember': '~1.13.0' - }, - resolutions: { - 'ember': '~1.13.0' - } - } - }, - { - name: 'ember-2-0', - bower: { - dependencies: { - 'ember': '~2.0.0' - }, - resolutions: { - 'ember': '~2.0.0' - } - } - }, - { - name: 'ember-2-1', - bower: { - dependencies: { - 'ember': '~2.1.0' - }, - resolutions: { - 'ember': '~2.1.0' - } - } - }, - { - name: 'ember-2-2', - bower: { - dependencies: { - 'ember': '~2.2.0' - }, - resolutions: { - 'ember': '~2.2.0' - } - } - }, - { - name: 'ember-2-3', - bower: { - dependencies: { - 'ember': '~2.3.0' - }, - resolutions: { - 'ember': '~2.3.0' - } - } - }, - { - name: 'ember-2-4', - bower: { - dependencies: { - 'ember': '~2.4.0' - }, - resolutions: { - 'ember': '~2.4.0' - } - } - }, - { - name: 'ember-2-5', - bower: { - dependencies: { - 'ember': '~2.5.0' - }, - resolutions: { - 'ember': '~2.5.0' - } - } - }, - { - name: 'ember-2-6', - bower: { - dependencies: { - 'ember': '~2.6.0' - }, - resolutions: { - 'ember': '~2.6.0' - } - } - }, - { - name: 'ember-2-7', - bower: { - dependencies: { - 'ember': '~2.7.0' - }, - resolutions: { - 'ember': '~2.7.0' - } - } - }, { name: 'ember-2-8', bower: { @@ -125,16 +11,18 @@ module.exports = { resolutions: { 'ember': '~2.8.0' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { - name: 'ember-2-9', - bower: { - dependencies: { - 'ember': '~2.9.0' - }, - resolutions: { - 'ember': '~2.9.0' + name: 'ember-lts-2.12', + npm: { + devDependencies: { + 'ember-source': '~2.12.0' } } }, @@ -147,6 +35,11 @@ module.exports = { resolutions: { 'ember': 'release' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -158,6 +51,11 @@ module.exports = { resolutions: { 'ember': 'beta' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -169,6 +67,17 @@ module.exports = { resolutions: { 'ember': 'canary' } + }, + npm: { + devDependencies: { + 'ember-source': null + } + } + }, + { + name: 'ember-default', + npm: { + devDependencies: {} } } ] diff --git a/config/environment.js b/config/environment.js index b792ac26..db56903e 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,3 +1,4 @@ +/* eslint-env node */ 'use strict' module.exports = function (/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index d1c8b512..21ba6d73 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,5 +1,5 @@ -/* global require, module */ -var EmberAddon = require('ember-cli/lib/broccoli/ember-addon') +/* eslint-env node */ +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon') module.exports = function (defaults) { var app = new EmberAddon(defaults, { @@ -29,7 +29,8 @@ module.exports = function (defaults) { app.import('bower_components/sinonjs/sinon.js') // client-side template compilation for the abstract-input demo page - app.import('vendor/ember/ember-template-compiler.js') + app.import(app.project.addonPackages['ember-source'] + ? 'vendor/ember/ember-template-compiler.js' : 'bower_components/ember/ember-template-compiler.js') /* This build file specifes the options for the dummy test app of this diff --git a/index.js b/index.js index 7c733cf6..364117de 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ -/* globals module */ - +/* eslint-env node */ 'use strict' module.exports = { diff --git a/package.json b/package.json index 6569e4e3..b393ab0e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint": "lint-all-the-things", "start": "ember server", "test": "npm run lint && npm run test-addon", - "test-addon": "EMBER_TRY_SCENARIO=${EMBER_TRY_SCENARIO:=default} && ember try:one $EMBER_TRY_SCENARIO --- COVERAGE=true ember test" + "test-addon": "EMBER_TRY_SCENARIO=${EMBER_TRY_SCENARIO:=ember-default} && ember try:one $EMBER_TRY_SCENARIO --- COVERAGE=true ember test" }, "repository": { "type": "git", @@ -36,55 +36,51 @@ ], "license": "MIT", "devDependencies": { - "broccoli-asset-rev": "^2.5.0", + "broccoli-asset-rev": "^2.4.5", "chai-jquery": "^2.0.0", "ember-browserify": "1.1.13", - "ember-cli": "~2.11.0", - "ember-cli-app-version": "^2.0.1", + "ember-cli": "2.12.3", "ember-cli-chai": "^0.3.2", "ember-cli-code-coverage": "0.3.11", "ember-cli-dependency-checker": "^1.3.0", - "ember-cli-htmlbars-inline-precompile": "0.3.6", + "ember-cli-frost-blueprints": "^1.0.0", + "ember-cli-htmlbars-inline-precompile": "0.3.12", "ember-cli-inject-live-reload": "^1.4.1", "ember-cli-mirage": "0.2.4", "ember-cli-mocha": "0.13.2", "ember-cli-moment-shim": "^3.0.1", - "ember-cli-release": "^1.0.0-beta.2", "ember-cli-sass": "^6.1.1", "ember-cli-shims": "^1.0.2", "ember-cli-showdown": "^2.10.0", - "ember-cli-test-loader": "^1.1.1", "ember-cli-uglify": "^1.2.0", - "ember-computed-decorators": "0.3.0", - "ember-concurrency": "0.7.19", + "ember-computed-decorators": "~0.2.0", + "ember-concurrency": "~0.7.15", "ember-data": "~2.11.0", "ember-disable-prototype-extensions": "^1.1.0", - "ember-disable-proxy-controllers": "^1.0.1", - "ember-elsewhere": "0.4.1", - "ember-export-application-global": "^1.1.1", - "ember-frost-core": "1.14.3", + "ember-elsewhere": "~1.0.1", + "ember-export-application-global": "^1.0.5", "ember-frost-date-picker": "^7.1.0", - "ember-frost-demo-components": "^3.0.1", + "ember-frost-demo-components": "3.1.2", "ember-frost-fields": "^4.0.0", "ember-frost-table": "^1.0.0", "ember-frost-test": "1.0.1", "ember-get-config": "0.2.1", "ember-hook": "^1.4.1", - "ember-load-initializers": "0.6.3", - "ember-moment": "^7.3.0", + "ember-load-initializers": "^0.6.0", + "ember-moment": "~7.3.0", "ember-pikaday-shim": "0.1.0", "ember-prism": "0.0.8", - "ember-prop-types": "^3.11.0", - "ember-resolver": "^2.1.1", + "ember-resolver": "^2.0.3", "ember-simple-uuid": "0.1.4", "ember-sinon": "0.6.0", - "ember-source": "2.11.2", + "ember-source": "~2.12.0", "ember-test-utils": "^1.11.0", - "ember-truth-helpers": "^1.3.0", + "ember-truth-helpers": "^1.2.0", + "ember-try": "0.2.11", "eslint": "^3.13.1", "eslint-config-frost-standard": "^6.0.0", "ivy-codemirror": "^2.0.3", - "loader.js": "^4.1.0", + "loader.js": "^4.2.3", "pikaday": "^1.5.1", "sass-lint": "^1.10.2", "sinon-chai": "^2.8.0" @@ -103,7 +99,7 @@ "ember-bunsen-core": "^1.0.3", "ember-cli-babel": "^5.1.8", "ember-cli-htmlbars": "^1.0.3", - "ember-frost-core": "^1.12.0", + "ember-frost-core": "^1.23.6", "ember-frost-popover": "^4.0.0", "ember-frost-tabs": "^5.0.0", "ember-getowner-polyfill": "^1.0.0", @@ -112,7 +108,7 @@ "ember-redux-shim": "^1.0.0", "ember-redux-thunk-shim": "^1.0.0", "ember-sortable": "^1.0.0", - "ember-spread": "^1.0.0", + "ember-spread": "^1.1.1", "ember-symbol-observable": "0.1.2", "redux": "^3.0.0", "redux-thunk": "^2.0.0" @@ -123,4 +119,4 @@ "ember-frost-icon-pack": { "name": "frost-bunsen" } -} \ No newline at end of file +} diff --git a/test-support/helpers/ember-frost-bunsen/renderers/when.js b/test-support/helpers/ember-frost-bunsen/renderers/when.js index 970267f1..2745e615 100644 --- a/test-support/helpers/ember-frost-bunsen/renderers/when.js +++ b/test-support/helpers/ember-frost-bunsen/renderers/when.js @@ -2,6 +2,7 @@ import {expect} from 'chai' import Ember from 'ember' const {merge} = Ember import {$hook} from 'ember-hook' +import wait from 'ember-test-helpers/wait' import { expectBunsenInputNotToHaveError, @@ -135,6 +136,7 @@ export function expectWithState (bunsenId, state) { * Selects a radio button * @param {String} bunsenId - bunsen ID for property rendered as boolean * @param {Object} state - expected state of boolean renderer + * @returns {RSVP.Promise} - promise wait for all async operations * */ export function selectRadioButton (bunsenId, state) { @@ -153,4 +155,6 @@ export function selectRadioButton (bunsenId, state) { } else { $hook(radioButtonHook).last().trigger('click') } + + return wait() } diff --git a/testem.js b/testem.js index cfca56cc..8c032425 100644 --- a/testem.js +++ b/testem.js @@ -1,3 +1,4 @@ +/* eslint-env node */ var Reporter = require('ember-test-utils/reporter') module.exports = { diff --git a/tests/.eslintrc b/tests/.eslintrc deleted file mode 100644 index 4c13f451..00000000 --- a/tests/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "no-unused-expressions": 2 - } -} diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js new file mode 100644 index 00000000..cfdb0925 --- /dev/null +++ b/tests/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + env: { + embertest: true + } +} diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 8c943386..1180bce0 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,3 +1,5 @@ +/* eslint-env node */ + module.exports = function (environment) { var ENV = { modulePrefix: 'dummy', @@ -9,6 +11,10 @@ module.exports = function (environment) { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true + }, + EXTEND_PROTOTYPES: { + // Prevent Ember Data from overriding Date.parse. + Date: false } }, @@ -23,8 +29,7 @@ module.exports = function (environment) { 'ember-prop-types': { spreadProperty: 'options', - throwErrors: true, - validateOnUpdate: true + throwErrors: true } } @@ -38,7 +43,6 @@ module.exports = function (environment) { if (environment === 'test') { // Testem prefers this... - ENV.rootURL = '/' ENV.locationType = 'none' // keep test console output quieter diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index 491fd813..95307ff2 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -5,16 +5,13 @@ import Application from '../../app' import config from '../../config/environment' export default function startApp (attrs) { - let application - let attributes = merge({}, config.APP) - attributes = merge(attributes, attrs) // use defaults, but you can override + attributes = merge(attributes, attrs) // use defaults, but you can override; - run(() => { - application = Application.create(attributes) + return run(() => { + let application = Application.create(attributes) application.setupForTesting() application.injectTestHelpers() + return application }) - - return application } diff --git a/tests/index.html b/tests/index.html index f7ff6521..5209b852 100644 --- a/tests/index.html +++ b/tests/index.html @@ -21,7 +21,7 @@ {{content-for "body"}} {{content-for "test-body"}} - + diff --git a/tests/integration/components/frost-bunsen-form/renderers/button-group-test.js b/tests/integration/components/frost-bunsen-form/renderers/button-group-test.js index 6c9a063c..ed6c28b5 100644 --- a/tests/integration/components/frost-bunsen-form/renderers/button-group-test.js +++ b/tests/integration/components/frost-bunsen-form/renderers/button-group-test.js @@ -3,6 +3,8 @@ import Ember from 'ember' import wait from 'ember-test-helpers/wait' import {beforeEach, describe, it} from 'mocha' +const {Test} = Ember + import { expectBunsenButtonGroupRendererWithState, expectCollapsibleHandles, @@ -12,6 +14,15 @@ import { import selectors from 'dummy/tests/helpers/selectors' import {setupFormComponentTest} from 'dummy/tests/helpers/utils' +// @quincyle 2017-07-31 +// Hack to fix test failing when using `throw` +// Issue introduced by https://github.com/emberjs/ember.js/pull/14898 +Test.adapter = Test.MochaAdapter.extend({ + exception (error) { + throw error + } +}).create() + /** * Get button labels for bunsenModel's enum options * @param {BunsenModel} bunsenModel - bunsen mode diff --git a/tests/integration/components/frost-bunsen-form/renderers/when-test.js b/tests/integration/components/frost-bunsen-form/renderers/when-test.js index 80b33293..fb6a1596 100644 --- a/tests/integration/components/frost-bunsen-form/renderers/when-test.js +++ b/tests/integration/components/frost-bunsen-form/renderers/when-test.js @@ -1,5 +1,6 @@ import {expect} from 'chai' import {$hook} from 'ember-hook' +import wait from 'ember-test-helpers/wait' import {beforeEach, describe, it} from 'mocha' import { @@ -78,6 +79,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -103,6 +106,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -128,6 +133,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -153,6 +160,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -178,6 +187,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -203,6 +214,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -230,25 +243,35 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) - it('enables the date-time-picker', function () { - expectCollapsibleHandles(0) - selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 2}) - expectBunsenWhenRendererWithState('foo', { - label: 'Foo', - selectedButton: 'second' + describe('when nothing is set', function () { + beforeEach(function () { + selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 2}) + }) + + it('enables the date-time-picker', function () { + expectCollapsibleHandles(0) + expectBunsenWhenRendererWithState('foo', { + label: 'Foo', + selectedButton: 'second' + }) + expectOnValidationState(ctx, {count: 3}) }) - expectOnValidationState(ctx, {count: 3}) }) describe('when date is set', function () { beforeEach(function () { ctx.props.onValidation.reset() selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 2}) - const interactor = openDatepickerBunsenDatetimeRenderer('bunsenForm-foo-radio-button-date-picker-input') - interactor.selectDate(new Date(2017, 0, 24)) - closePikaday(this) + + return wait().then(() => { + const interactor = openDatepickerBunsenDatetimeRenderer('bunsenForm-foo-radio-button-date-picker-input') + interactor.selectDate(new Date(2017, 0, 24)) + closePikaday(this) + }) }) it('functions as expected', function () { @@ -262,6 +285,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio beforeEach(function () { ctx.props.onValidation.reset() selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 2}) + + return wait() }) it('functions as expected', function () { @@ -285,18 +310,29 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 2}) + + return wait() }) - it('disables the date-time-picker', function () { + it('enables the date-time-picker', function () { expectCollapsibleHandles(0) - selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 2}) expectBunsenWhenRendererWithState('foo', { label: 'Foo', selectedButton: 'second' }) - selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 1}) - expectBunsenWhenRendererWithState('foo', {label: 'Foo'}) - expectOnValidationState(ctx, {count: 4}) + }) + + describe('when user clicks first', function () { + beforeEach(function () { + selectRadioButtonBunsenWhenRenderer('foo', {buttonNumber: 1}) + }) + + it('disables the date-time-picker', function () { + expectBunsenWhenRendererWithState('foo', {label: 'Foo'}) + expectOnValidationState(ctx, {count: 4}) + }) }) }) @@ -316,6 +352,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -344,6 +382,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders as expected', function () { @@ -372,6 +412,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders using provided dateFormat', function () { @@ -400,6 +442,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders using provided timeFormat', function () { @@ -427,6 +471,8 @@ describe('Integration: Component / frost-bunsen-form / renderer / when', functio type: 'form', version: '2.0' }) + + return wait() }) it('renders using provided value', function () { diff --git a/tests/unit/components/inputs/select-test.js b/tests/unit/components/inputs/select-test.js index 31070b5c..0e3c1d64 100644 --- a/tests/unit/components/inputs/select-test.js +++ b/tests/unit/components/inputs/select-test.js @@ -11,7 +11,8 @@ const {run} = Ember describe('Unit: frost-bunsen-input-select', function () { setupComponentTest('frost-bunsen-input-select', { - unit: true + unit: true, + needs: ['service:ajax'] }) let component, sandbox