From fa884273440814265b1d60375e56411f82aa4891 Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Thu, 2 Jul 2015 14:20:20 -0500 Subject: [PATCH 1/6] Update Ember CLI Mocah --- bower.json | 3 +-- package.json | 3 +-- tests/acceptance/x-select-multiple-blockless-test.js | 2 +- tests/acceptance/x-select-multiple-test.js | 2 +- .../acceptance/x-select-single-blockless-option-value-test.js | 2 +- tests/acceptance/x-select-single-blockless-test.js | 2 +- tests/acceptance/x-select-single-test.js | 2 +- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index 5641ec5..3495518 100644 --- a/bower.json +++ b/bower.json @@ -3,13 +3,12 @@ "dependencies": { "jquery": "^1.11.1", "ember": "1.13.2", - "ember-data": "1.0.0-beta.15", "ember-resolver": "~0.1.12", "loader.js": "ember-cli/loader.js#3.2.0", "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", "ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2", - "ember-mocha": "~0.5.2" + "ember-mocha": "~0.8.0" }, "devDependencies": { "chai-jquery": "~2.0.0" diff --git a/package.json b/package.json index 30fbe92..335002f 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,8 @@ "ember-cli-htmlbars": "0.7.4", "ember-cli-ic-ajax": "0.1.1", "ember-cli-inject-live-reload": "^1.3.0", - "ember-cli-mocha": "0.5.0", + "ember-cli-mocha": "0.8.0", "ember-cli-uglify": "1.0.1", - "ember-data": "1.0.0-beta.15", "ember-export-application-global": "^1.0.2" }, "dependencies": { diff --git a/tests/acceptance/x-select-multiple-blockless-test.js b/tests/acceptance/x-select-multiple-blockless-test.js index 383da0d..8c824f5 100644 --- a/tests/acceptance/x-select-multiple-blockless-test.js +++ b/tests/acceptance/x-select-multiple-blockless-test.js @@ -29,7 +29,7 @@ describe('XSelect: Multiple Selection Blockless', function() { }); it("does not fire any actions on didInsertElement", function() { - expect(this.controller.get('changedSelections')).not.to.be.ok(); + expect(this.controller.get('changedSelections')).not.to.be.ok; }); it('marks all selected values', function() { diff --git a/tests/acceptance/x-select-multiple-test.js b/tests/acceptance/x-select-multiple-test.js index 7989716..474f88e 100644 --- a/tests/acceptance/x-select-multiple-test.js +++ b/tests/acceptance/x-select-multiple-test.js @@ -29,7 +29,7 @@ describe('XSelect: Multiple Selection', function() { }); it("does not fire any actions on didInsertElement", function() { - expect(this.controller.get('changedSelections')).not.to.be.ok(); + expect(this.controller.get('changedSelections')).not.to.be.ok; }); it('marks all selected values', function() { diff --git a/tests/acceptance/x-select-single-blockless-option-value-test.js b/tests/acceptance/x-select-single-blockless-option-value-test.js index 375a7d8..a34d401 100644 --- a/tests/acceptance/x-select-single-blockless-option-value-test.js +++ b/tests/acceptance/x-select-single-blockless-option-value-test.js @@ -29,7 +29,7 @@ describe('XSelect: Single Selection Blockless w/ Option Value', function() { }); it("does not fire any actions on didInsertElement", function() { - expect(controller.get('tagged')).not.to.be.ok(); + expect(controller.get('tagged')).not.to.be.ok; }); it('is enabled by default', function() { diff --git a/tests/acceptance/x-select-single-blockless-test.js b/tests/acceptance/x-select-single-blockless-test.js index a4e661d..22e6ed8 100644 --- a/tests/acceptance/x-select-single-blockless-test.js +++ b/tests/acceptance/x-select-single-blockless-test.js @@ -29,7 +29,7 @@ describe('XSelect: Single Selection Blockless', function() { }); it("does not fire any actions on didInsertElement", function() { - expect(this.controller.get('tagged')).not.to.be.ok(); + expect(this.controller.get('tagged')).not.to.be.ok; }); it('is enabled by default', function() { diff --git a/tests/acceptance/x-select-single-test.js b/tests/acceptance/x-select-single-test.js index 00d69c5..a027a99 100644 --- a/tests/acceptance/x-select-single-test.js +++ b/tests/acceptance/x-select-single-test.js @@ -29,7 +29,7 @@ describe('XSelect: Single Selection', function() { }); it("does not fire any actions on didInsertElement", function() { - expect(this.controller.get('tagged')).not.to.be.ok(); + expect(this.controller.get('tagged')).not.to.be.ok; }); it('is enabled by default', function() { From d0c30a5beed022b8b3006c9f6e7b88cf541d46fc Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Thu, 2 Jul 2015 15:05:22 -0500 Subject: [PATCH 2/6] WIP: upgrading CLI --- .editorconfig | 1 + .travis.yml | 16 +++++++++++++- .watchmanconfig | 3 +++ Brocfile.js | 22 ++++++------------- addon/components/x-option.js | 4 +++- addon/components/x-select.js | 7 ++++-- bower.json | 4 ++-- config/ember-try.js | 35 ++++++++++++++++++++++++++++++ package.json | 10 +++++---- testem.json | 1 + tests/dummy/app/app.js | 4 +++- tests/dummy/public/crossdomain.xml | 18 +++++++-------- tests/dummy/public/robots.txt | 1 + 13 files changed, 91 insertions(+), 35 deletions(-) create mode 100644 .watchmanconfig create mode 100644 config/ember-try.js diff --git a/.editorconfig b/.editorconfig index 2fe4874..47c5438 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,6 +18,7 @@ indent_style = space indent_size = 2 [*.hbs] +insert_final_newline = false indent_style = space indent_size = 2 diff --git a/.travis.yml b/.travis.yml index cf23938..8197d31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ --- language: node_js +node_js: + - "0.12" sudo: false @@ -7,7 +9,19 @@ cache: directories: - node_modules +env: + - EMBER_TRY_SCENARIO=default + - EMBER_TRY_SCENARIO=ember-release + - EMBER_TRY_SCENARIO=ember-beta + - EMBER_TRY_SCENARIO=ember-canary + +matrix: + fast_finish: true + allow_failures: + - env: EMBER_TRY_SCENARIO=ember-canary + before_install: + - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH - "npm config set spin false" - "npm install -g npm@^2" @@ -17,4 +31,4 @@ install: - bower install script: - - npm test + - ember try $EMBER_TRY_SCENARIO test diff --git a/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000..5e9462c --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1,3 @@ +{ + "ignore_dirs": ["tmp"] +} diff --git a/Brocfile.js b/Brocfile.js index a878951..2a682c0 100644 --- a/Brocfile.js +++ b/Brocfile.js @@ -3,22 +3,14 @@ var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); -var app = new EmberAddon(); - -// Use `app.import` to add additional libraries to the generated -// output files. +/* + This Brocfile specifes the options for the dummy test app of this + addon, located in `/tests/dummy` -app.import('bower_components/chai-jquery/chai-jquery.js', {type: 'test'}); + This Brocfile does *not* influence how the addon or the app using it + behave. You most likely want to be modifying `./index.js` or app's Brocfile +*/ -// -// If you need to use different assets in different -// environments, specify an object as the first parameter. That -// object's keys should be the environment name and the values -// should be the asset to use in that environment. -// -// If the library that you are including contains AMD or ES6 -// modules that you would like to import into your application -// please specify an object with the list of modules as keys -// along with the exports of each module as its value. +var app = new EmberAddon(); module.exports = app.toTree(); diff --git a/addon/components/x-option.js b/addon/components/x-option.js index 53fe347..fe622b0 100644 --- a/addon/components/x-option.js +++ b/addon/components/x-option.js @@ -37,7 +37,9 @@ export default Ember.Component.extend({ * @type Boolean */ selected: Ember.computed('value', 'select.value', 'select.multiple', function() { - if (this.get('select.multiple') && isArray(this.get('select.value'))) { + let selectValue = Ember.A(this.get('select.value')); + + if (this.get('select.multiple') && isArray(selectValue)) { return this.get('select.value').contains(this.get('value')); } else { return this.get('value') === this.get('select.value'); diff --git a/addon/components/x-select.js b/addon/components/x-select.js index f460a9b..87940b2 100644 --- a/addon/components/x-select.js +++ b/addon/components/x-select.js @@ -192,6 +192,8 @@ export default Ember.Component.extend({ return option.$().is(':selected'); }); + Ember.A(options); + var newValues = options.mapBy('value'); if (isArray(this.get('value'))) { @@ -217,12 +219,13 @@ export default Ember.Component.extend({ * * @private */ - ensureProperType: Ember.observer('value', function() { + ensureProperType: Ember.on('init', Ember.observer('value', function() { var value = this.get('value'); + if (value != null && this.get('multiple') && !isArray(value)) { throw new Error('x-select multiple=true was set, but value "' + value + '" is not enumerable.'); } - }).on('init'), + })), /** * @private diff --git a/bower.json b/bower.json index 3495518..f073ae5 100644 --- a/bower.json +++ b/bower.json @@ -3,11 +3,11 @@ "dependencies": { "jquery": "^1.11.1", "ember": "1.13.2", - "ember-resolver": "~0.1.12", + "ember-resolver": "~0.1.15", "loader.js": "ember-cli/loader.js#3.2.0", "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", - "ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2", + "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", "ember-mocha": "~0.8.0" }, "devDependencies": { diff --git a/config/ember-try.js b/config/ember-try.js new file mode 100644 index 0000000..83dab0f --- /dev/null +++ b/config/ember-try.js @@ -0,0 +1,35 @@ +module.exports = { + scenarios: [ + { + name: 'default', + dependencies: { } + }, + { + name: 'ember-release', + dependencies: { + 'ember': 'components/ember#release' + }, + resolutions: { + 'ember': 'release' + } + }, + { + name: 'ember-beta', + dependencies: { + 'ember': 'components/ember#beta' + }, + resolutions: { + 'ember': 'beta' + } + }, + { + name: 'ember-canary', + dependencies: { + 'ember': 'components/ember#canary' + }, + resolutions: { + 'ember': 'canary' + } + } + ] +}; diff --git a/package.json b/package.json index 335002f..b6d8707 100644 --- a/package.json +++ b/package.json @@ -21,14 +21,16 @@ "broccoli-asset-rev": "2.0.6", "ember-cli": "0.2.7", "ember-cli-app-version": "0.4.0", - "ember-cli-content-security-policy": "0.3.0", - "ember-cli-dependency-checker": "0.0.8", - "ember-cli-htmlbars": "0.7.4", + "ember-cli-content-security-policy": "0.4.0", + "ember-cli-dependency-checker": "^1.0.0", + "ember-cli-htmlbars": "0.7.6", "ember-cli-ic-ajax": "0.1.1", "ember-cli-inject-live-reload": "^1.3.0", "ember-cli-mocha": "0.8.0", "ember-cli-uglify": "1.0.1", - "ember-export-application-global": "^1.0.2" + "ember-export-application-global": "^1.0.2", + "ember-disable-proxy-controllers": "^1.0.0", + "ember-try": "0.0.6" }, "dependencies": { "ember-cli-babel": "^5.0.0" diff --git a/testem.json b/testem.json index 42a4ddb..0f35392 100644 --- a/testem.json +++ b/testem.json @@ -1,6 +1,7 @@ { "framework": "qunit", "test_page": "tests/index.html?hidepassed", + "disable_watching": true, "launch_in_ci": [ "PhantomJS" ], diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 757df38..8d66b95 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -3,9 +3,11 @@ import Resolver from 'ember/resolver'; import loadInitializers from 'ember/load-initializers'; import config from './config/environment'; +var App; + Ember.MODEL_FACTORY_INJECTIONS = true; -var App = Ember.Application.extend({ +App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver: Resolver diff --git a/tests/dummy/public/crossdomain.xml b/tests/dummy/public/crossdomain.xml index 29a035d..0c16a7a 100644 --- a/tests/dummy/public/crossdomain.xml +++ b/tests/dummy/public/crossdomain.xml @@ -1,15 +1,15 @@ - + - - + + - - + + diff --git a/tests/dummy/public/robots.txt b/tests/dummy/public/robots.txt index 5debfa4..f591645 100644 --- a/tests/dummy/public/robots.txt +++ b/tests/dummy/public/robots.txt @@ -1,2 +1,3 @@ # http://www.robotstxt.org User-agent: * +Disallow: From 2a70e27d8e8f5f5a5e838a47cce395d47e3e56c9 Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Thu, 2 Jul 2015 22:43:04 -0500 Subject: [PATCH 3/6] Passing tests! --- Brocfile.js | 2 ++ addon/components/x-option.js | 6 +++--- package.json | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Brocfile.js b/Brocfile.js index 2a682c0..077489a 100644 --- a/Brocfile.js +++ b/Brocfile.js @@ -13,4 +13,6 @@ var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); var app = new EmberAddon(); +app.import('bower_components/chai-jquery/chai-jquery.js', {type: 'test'}); + module.exports = app.toTree(); diff --git a/addon/components/x-option.js b/addon/components/x-option.js index fe622b0..89bb26f 100644 --- a/addon/components/x-option.js +++ b/addon/components/x-option.js @@ -37,10 +37,10 @@ export default Ember.Component.extend({ * @type Boolean */ selected: Ember.computed('value', 'select.value', 'select.multiple', function() { - let selectValue = Ember.A(this.get('select.value')); + if (this.get('select.multiple') && isArray(this.get('select.value'))) { + let selectValue = Ember.A(this.get('select.value')); - if (this.get('select.multiple') && isArray(selectValue)) { - return this.get('select.value').contains(this.get('value')); + return selectValue.contains(this.get('value')); } else { return this.get('value') === this.get('select.value'); } diff --git a/package.json b/package.json index b6d8707..58eb3bd 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "ember-cli-uglify": "1.0.1", "ember-export-application-global": "^1.0.2", "ember-disable-proxy-controllers": "^1.0.0", + "ember-disable-prototype-extensions": "^1.0.0", "ember-try": "0.0.6" }, "dependencies": { From c9a70618646c4dd942c2844064d2497ad53a4e44 Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Thu, 2 Jul 2015 22:55:31 -0500 Subject: [PATCH 4/6] Add github pages addon for demo page --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 58eb3bd..004a5a6 100644 --- a/package.json +++ b/package.json @@ -23,14 +23,15 @@ "ember-cli-app-version": "0.4.0", "ember-cli-content-security-policy": "0.4.0", "ember-cli-dependency-checker": "^1.0.0", + "ember-cli-github-pages": "0.0.6", "ember-cli-htmlbars": "0.7.6", "ember-cli-ic-ajax": "0.1.1", "ember-cli-inject-live-reload": "^1.3.0", "ember-cli-mocha": "0.8.0", "ember-cli-uglify": "1.0.1", - "ember-export-application-global": "^1.0.2", - "ember-disable-proxy-controllers": "^1.0.0", "ember-disable-prototype-extensions": "^1.0.0", + "ember-disable-proxy-controllers": "^1.0.0", + "ember-export-application-global": "^1.0.2", "ember-try": "0.0.6" }, "dependencies": { From 7c05755dfa8acb4a6e151dd04f8f94b0071ba66a Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Thu, 2 Jul 2015 23:01:58 -0500 Subject: [PATCH 5/6] Update config file for gh-pages assests path --- tests/dummy/config/environment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index c59bcd5..436ed7f 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -40,7 +40,7 @@ module.exports = function(environment) { } if (environment === 'production') { - + ENV.baseURL = '/emberx-select' } return ENV; From 73a72ff87ad1cca3da78ad340b8f572218c6c63d Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Thu, 2 Jul 2015 23:10:43 -0500 Subject: [PATCH 6/6] Add demo page to package.json. Fixes #39 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 004a5a6..72f204f 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "select" ], "ember-addon": { - "configPath": "tests/dummy/config" + "configPath": "tests/dummy/config", + "demoURL": "https://thefrontside.github.io/emberx-select" } }