From 7f3c00f17b6860e7eb7c9e5e32e25fed931e04c4 Mon Sep 17 00:00:00 2001 From: Derek Gavey Date: Wed, 29 Mar 2017 15:04:00 -0700 Subject: [PATCH] Update to Ember 2.12 --- .eslintrc.js | 14 +++++ .gitignore | 2 +- .npmignore | 1 + .travis.yml | 8 ++- bower.json | 5 +- config/ember-try.js | 60 ++++++++++++------- config/environment.js | 2 +- ember-cli-build.js | 7 +-- index.js | 2 +- package.json | 29 +++++---- testem.js | 3 +- tests/.eslintrc.js | 5 ++ tests/helpers/assertions.js | 1 + tests/helpers/start-app.js | 13 ++-- tests/index.html | 2 +- tests/integration/components/helpers-test.js | 2 +- .../components/sortable-objects-test.js | 16 ++--- todo.md | 6 +- 18 files changed, 103 insertions(+), 75 deletions(-) create mode 100644 .eslintrc.js create mode 100644 tests/.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..2665f3f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,14 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 6, + sourceType: 'module' + }, + extends: 'eslint:recommended', + env: { + browser: true + }, + rules: { + "no-console": 0 +} +}; diff --git a/.gitignore b/.gitignore index 5913261..8febcdb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,6 @@ /connect.lock /coverage/* /libpeerconnection.log -npm-debug.log +npm-debug.log* testem.log .idea/ diff --git a/.npmignore b/.npmignore index fa8b147..cf23bab 100644 --- a/.npmignore +++ b/.npmignore @@ -8,6 +8,7 @@ .editorconfig .ember-cli .gitignore +.eslintrc.js .jshintrc .watchmanconfig .travis.yml diff --git a/.travis.yml b/.travis.yml index 7180485..a2cadd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,12 @@ cache: env: - EMBER_TRY_SCENARIO=default - - EMBER_TRY_SCENARIO=ember-2.8 + - EMBER_TRY_SCENARIO=ember-lts-2.4 + - EMBER_TRY_SCENARIO=ember-lts-2.8 - EMBER_TRY_SCENARIO=ember-release - EMBER_TRY_SCENARIO=ember-beta - EMBER_TRY_SCENARIO=ember-canary + - EMBER_TRY_SCENARIO=ember-default matrix: fast_finish: true @@ -26,8 +28,8 @@ before_install: - npm config set spin false - npm install -g bower - bower --version - - npm install phantomjs-prebuilt - - node_modules/phantomjs-prebuilt/bin/phantomjs --version + - npm install -g bower phantomjs-prebuilt + - phantomjs --version install: - npm install diff --git a/bower.json b/bower.json index 5df680e..f07e22c 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,4 @@ { "name": "ember-drag-drop", - "dependencies": { - "ember": "~2.10.0", - "ember-cli-shims": "0.1.3" - } + "dependencies": {} } diff --git a/config/ember-try.js b/config/ember-try.js index 59b7d2f..a070124 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,42 +1,35 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { scenarios: [ { - name: 'default', - bower: { - dependencies: { } - } - }, - { - name: 'ember-1.13', + name: 'ember-lts-2.4', bower: { dependencies: { - 'ember': '~1.13.0' + 'ember': 'components/ember#lts-2-4' }, resolutions: { - 'ember': '~1.13.0' + 'ember': 'lts-2-4' } - } - }, - { - name: 'ember-2.4', - bower: { - dependencies: { - 'ember': '~2.4' - }, - resolutions: { - 'ember': '~2.4' + }, + npm: { + devDependencies: { + 'ember-source': null } } }, { - name: 'ember-2.8', + name: 'ember-lts-2.8', bower: { dependencies: { - 'ember': '~2.8' + 'ember': 'components/ember#lts-2-8' }, resolutions: { - 'ember': '~2.8' + 'ember': 'lts-2-8' + } + }, + npm: { + devDependencies: { + 'ember-source': null } } }, @@ -49,6 +42,11 @@ module.exports = { resolutions: { 'ember': 'release' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -60,6 +58,11 @@ module.exports = { resolutions: { 'ember': 'beta' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -71,6 +74,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 28a787b..012a412 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,4 +1,4 @@ -/*jshint node:true*/ +/* eslint-env node */ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index c8c48f8..5e6f037 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,6 +1,5 @@ -/*jshint node:true*/ -/* 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, { @@ -8,7 +7,7 @@ module.exports = function(defaults) { }); /* - This build file specifes the options for the dummy test app of this + This build file specifies the options for the dummy test app of this addon, located in `/tests/dummy` This build file does *not* influence how the addon or the app using it behave. You most likely want to be modifying `./index.js` or app's build file diff --git a/index.js b/index.js index 02ad5d2..a1b48ce 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -/* jshint node: true */ +/* eslint-env node */ 'use strict'; module.exports = { diff --git a/package.json b/package.json index b62cd09..9de3de2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-drag-drop", - "version": "0.4.2", + "version": "0.4.3", "description": "Addon for Ember CLI to do drag and drop", "directories": { "doc": "doc", @@ -23,32 +23,31 @@ "devDependencies": { "broccoli-asset-rev": "^2.4.5", "ember-ajax": "^2.4.1", - "ember-cli": "2.8.0", - "ember-cli-app-version": "^2.0.0", + "ember-cli": "^2.12.1", "ember-cli-dependency-checker": "^1.3.0", - "ember-cli-htmlbars": "^1.0.10", - "ember-cli-htmlbars-inline-precompile": "^0.3.3", + "ember-cli-github-pages": "0.1.2", + "ember-cli-eslint": "^3.0.0", + "ember-cli-htmlbars": "^1.1.1", + "ember-cli-htmlbars-inline-precompile": "^0.3.6", "ember-cli-inject-live-reload": "^1.4.1", - "ember-cli-jshint": "^2.0.1", - "ember-cli-qunit": "^3.0.1", - "ember-cli-release": "^0.2.9", + "ember-cli-qunit": "^3.1.0", + "ember-cli-shims": "^1.0.2", "ember-cli-sri": "^2.1.0", - "ember-cli-test-loader": "^1.1.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "^2.10.0", + "ember-data": "^2.12.0", "ember-disable-prototype-extensions": "^1.1.0", "ember-export-application-global": "^1.0.5", - "ember-load-initializers": "^0.5.1", + "ember-load-initializers": "^0.6.0", "ember-resolver": "^2.0.3", - "ember-welcome-page": "^1.0.1", - "loader.js": "^4.0.1", - "ember-cli-github-pages": "0.1.2" + "ember-source": "~2.12.0", + "ember-welcome-page": "^2.0.2", + "loader.js": "^4.2.3" }, "keywords": [ "ember-addon" ], "dependencies": { - "ember-cli-babel": "^5.1.7" + "ember-cli-babel": "^5.2.4" }, "ember-addon": { "configPath": "tests/dummy/config", diff --git a/testem.js b/testem.js index 26044b2..b234048 100644 --- a/testem.js +++ b/testem.js @@ -1,6 +1,5 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { - "framework": "qunit", "test_page": "tests/index.html?hidepassed", "disable_watching": true, "launch_in_ci": [ diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js new file mode 100644 index 0000000..fbf2555 --- /dev/null +++ b/tests/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + env: { + embertest: true + } +}; diff --git a/tests/helpers/assertions.js b/tests/helpers/assertions.js index 41d83b3..94c10c5 100644 --- a/tests/helpers/assertions.js +++ b/tests/helpers/assertions.js @@ -1,5 +1,6 @@ /* global equal*/ import Ember from 'ember'; +const $ = this.$; var f = function() { Ember.Test.registerAsyncHelper('hasActivePage', function(app, num, context) { diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index 54c33c1..9a605eb 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -3,16 +3,13 @@ import Application from '../../app'; import config from '../../config/environment'; export default function startApp(attrs) { - let application; + let attributes = Ember.merge({}, config.APP); + attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; - // use defaults, but you can override - let attributes = Ember.assign({}, config.APP, attrs); - - Ember.run(() => { - application = Application.create(attributes); + return Ember.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 f7ff652..5209b85 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/helpers-test.js b/tests/integration/components/helpers-test.js index e30b10a..9e90c31 100644 --- a/tests/integration/components/helpers-test.js +++ b/tests/integration/components/helpers-test.js @@ -50,7 +50,7 @@ test('drag helper drags to a draggable object target and calls the action upon d test('drag helper allows a callback to be called before dropping', function(assert) { assert.expect(3); - + const $ = this.$; let coordinator = Coordinator.create(); coordinator.on('objectMoved', function(ops) { diff --git a/tests/integration/components/sortable-objects-test.js b/tests/integration/components/sortable-objects-test.js index a95fbaf..806cad2 100644 --- a/tests/integration/components/sortable-objects-test.js +++ b/tests/integration/components/sortable-objects-test.js @@ -59,10 +59,10 @@ test('sortable object renders draggable objects', function(assert) { this.on('sortEndAction', function() { const pojoObj = self.get('pojoData'); //make sure object is in the right order - assert.equal(pojoObj[0].id, 2); - assert.equal(pojoObj[1].id, 1); - assert.equal(pojoObj[2].id, 3); - assert.equal(pojoObj[3].id, 4); + assert.equal(pojoObj[0].id, 2, 'Pojo item one is correct'); + assert.equal(pojoObj[1].id, 1, 'Pojo item two is correct'); + assert.equal(pojoObj[2].id, 3, 'Pojo item three is correct'); + assert.equal(pojoObj[3].id, 4, 'Pojo item four is correct'); }); this.render(hbs` @@ -143,10 +143,10 @@ test('sortable object renders draggable objects using shift algorithm', function this.on('sortEndAction', function() { const pojoObj = self.get('pojoData'); //make sure object is in the right order - assert.equal(pojoObj[0].id, 2); - assert.equal(pojoObj[1].id, 3); - assert.equal(pojoObj[2].id, 1); - assert.equal(pojoObj[3].id, 4); + assert.equal(pojoObj[0].id, 2, 'Pojo item one is correct'); + assert.equal(pojoObj[1].id, 3, 'Pojo item two is correct'); + assert.equal(pojoObj[2].id, 1, 'Pojo item three is correct'); + assert.equal(pojoObj[3].id, 4, 'Pojo item four is correct'); }); this.render(hbs` diff --git a/todo.md b/todo.md index 41d1e8e..df437ce 100644 --- a/todo.md +++ b/todo.md @@ -1,4 +1,4 @@ 1. Get X axis working for detecting if drag object is active -2. Test Ember 2.9 and fix it on glimmer2 -3. Restore beta testing to travis -4. Make issue for future plans for the re-write of the library +2. Make issue for future plans for the re-write of the library +3. Get sort container to accept drop when nothing is in it. +4. Add docs for the onMouse events from PR 80