Skip to content

Commit

Permalink
ember-cli-update to 2.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaulagiri committed Nov 22, 2017
1 parent fb49ed3 commit a7c97f1
Show file tree
Hide file tree
Showing 43 changed files with 487 additions and 334 deletions.
30 changes: 19 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
---
language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "6"

sudo: false
dist: trusty

addons:
chrome: stable

cache:
yarn: true
Expand All @@ -12,25 +18,27 @@ cache:
- $HOME/.cache # includes bowers cache

env:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.4
- EMBER_TRY_SCENARIO=ember-lts-2.8
- EMBER_TRY_SCENARIO=ember-lts-2.12
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default
global:
# See https://git.io/vdao3 for details.
- JOBS=1
matrix:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.8
- EMBER_TRY_SCENARIO=ember-lts-2.12
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default

matrix:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- yarn add global bower phantomjs-prebuilt
- yarn add global bower
- bower --version
- phantomjs --version

install:
- yarn install --no-lockfile --non-interactive
Expand Down
15 changes: 8 additions & 7 deletions addon/components/x-option.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';

const { isArray } = Ember;
import { scheduleOnce } from '@ember/runloop';
import { computed } from '@ember/object';
import Component from '@ember/component';
import { isArray, A } from '@ember/array';

/**
* Used to wrap a native `<option>` tag and associate an object with
Expand All @@ -10,7 +11,7 @@ const { isArray } = Ember;
* @class Ember.XOptionComponent
* @extends Ember.Component
*/
export default Ember.Component.extend({
export default Component.extend({
tagName: 'option',
attributeBindings: ['selected', 'name', 'disabled', 'value', 'title'],
classNameBindings: [':x-option'],
Expand All @@ -35,9 +36,9 @@ export default Ember.Component.extend({
* @property selected
* @type Boolean
*/
selected: Ember.computed('value', 'select.value', 'select.multiple', function() {
selected: 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'));
let selectValue = A(this.get('select.value'));

return selectValue.includes(this.get('value'));
} else {
Expand Down Expand Up @@ -69,7 +70,7 @@ export default Ember.Component.extend({
didInsertElement() {
this._super.apply(this, arguments);

Ember.run.scheduleOnce('afterRender', () => {
scheduleOnce('afterRender', () => {
this.get('register')(this);
});
},
Expand Down
22 changes: 11 additions & 11 deletions addon/components/x-select.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Ember from 'ember';

const {
isArray,
computed,
} = Ember;
import { on } from '@ember/object/evented';
import { once } from '@ember/runloop';
import { warn } from '@ember/debug';
import Component from '@ember/component';
import { isArray, A } from '@ember/array';
import { computed, observer } from '@ember/object';

const isSelectedOption = (option) => option.$().is(':selected');

Expand All @@ -26,7 +26,7 @@ const isSelectedOption = (option) => option.$().is(':selected');
* @class Ember.XSelectComponent
* @extends Ember.Component
*/
export default Ember.Component.extend({
export default Component.extend({
tagName: "select",
classNameBindings: [":x-select"],
attributeBindings: ['disabled', 'tabindex', 'multiple', 'form', 'name', 'autofocus', 'required', 'size', 'title'],
Expand Down Expand Up @@ -59,7 +59,7 @@ export default Ember.Component.extend({
* @property options
*/
options: computed(function() {
return Ember.A([]);
return A([]);
}),

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ export default Ember.Component.extend({
let actionValue = this.get(action);

if(typeof actionValue === 'string') {
Ember.warn(`x-select: You must use the action helper for all actions. The try: ${action}=(action "${actionValue}") in your template`, false, {id: 'x-select-string-action'});
warn(`x-select: You must use the action helper for all actions. The try: ${action}=(action "${actionValue}") in your template`, false, {id: 'x-select-string-action'});
return;
}

Expand Down Expand Up @@ -201,7 +201,7 @@ export default Ember.Component.extend({
* @private
*/
_setDefaultValues: function() {
Ember.run.once(this, this.__setDefaultValues);
once(this, this.__setDefaultValues);
},

__setDefaultValues: function() {
Expand Down Expand Up @@ -244,7 +244,7 @@ export default Ember.Component.extend({
*
* @private
*/
ensureProperType: Ember.on('init', Ember.observer('value', function() {
ensureProperType: on('init', observer('value', function() {
let value = this.get('value');

if (value != null && this.get('multiple') && !isArray(value)) {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@
"test": "ember try:each"
},
"dependencies": {
"ember-cli-babel": "^6.6.0",
"ember-cli-babel": "^6.9.0",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-version-checker": "^1.2.0"
},
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"chai-jquery": "^2.0.0",
"ember-cli": "~2.14.1",
"ember-cli": "~2.16.2",
"ember-cli-chai": "^0.4.2",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-deploy": "0.5.1",
"ember-cli-document-title": "0.3.3",
"ember-cli-eslint": "^4.2.0",
"ember-cli-htmlbars-inline-precompile": "^0.4.3",
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-mocha": "^0.14.4",
"ember-cli-release": "^1.0.0-beta.2",
"ember-cli-shims": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-cli-uglify": "^2.0.0",
"ember-data": "^2.14.7",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.0.0",
"ember-sinon": "^0.7.0",
"ember-source": "~2.14.1",
"ember-source": "~2.16.0",
"eslint-plugin-prefer-let": "^0.1.0",
"fs-branding": "0.1.3",
"loader.js": "^4.2.3",
Expand Down
8 changes: 4 additions & 4 deletions test-support/helpers/x-select.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import { run } from '@ember/runloop';
import jQuery from 'jquery';

/**
Expand All @@ -9,17 +9,17 @@ import jQuery from 'jquery';
* @param {string} texts - text of the option you are picking
*/
export function select(selector, ...texts) {
let $select = selector instanceof jQuery ? selector : Ember.$(selector);
let $select = selector instanceof jQuery ? selector : jQuery(selector);
let $options = $select.find(`option`);

if (!$options.length) {
throw `No options found in ${selector}` ;
}

$options.each(function() {
let $option = Ember.$(this);
let $option = jQuery(this);

Ember.run(() => {
run(() => {
this.selected = texts.some((text) => {
// uppercase both texts so the helper isn't case sensastive.
let optionText = $option.text().trim().toUpperCase();
Expand Down
16 changes: 13 additions & 3 deletions testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
'PhantomJS'
'Chrome'
],
launch_in_dev: [
'PhantomJS',
'Chrome'
]
],
browser_args: {
Chrome: {
mode: 'ci',
args: [
'--disable-gpu',
'--headless',
'--remote-debugging-port=9222',
'--window-size=1440,900'
]
},
}
};
7 changes: 3 additions & 4 deletions tests/acceptance/default-values-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { run } from '@ember/runloop';
import $ from 'jquery';
import {
describe,
it,
Expand All @@ -6,11 +8,8 @@ import {
} from 'mocha';
import { expect } from 'chai';
import startApp from '../helpers/start-app';
import Ember from 'ember';
import { select } from 'dummy/tests/helpers/x-select';

const { $ } = Ember;

describe('XSelect: Default Values', function() {
let application;

Expand All @@ -19,7 +18,7 @@ describe('XSelect: Default Values', function() {
});

afterEach(function() {
Ember.run(application, 'destroy');
run(application, 'destroy');
});

describe('Initializing with default values', function(){
Expand Down
11 changes: 8 additions & 3 deletions tests/acceptance/ember-data-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { describe, it, beforeEach, afterEach } from 'mocha';
import { run } from '@ember/runloop';
import {
describe,
it,
beforeEach,
afterEach
} from 'mocha';
import { expect } from 'chai';
import { select } from 'dummy/tests/helpers/x-select';
import startApp from '../helpers/start-app';
import Ember from 'ember';

describe('Acceptance: EmberData', function() {
let application;
Expand All @@ -13,7 +18,7 @@ describe('Acceptance: EmberData', function() {
});

afterEach(function() {
Ember.run(application, 'destroy');
run(application, 'destroy');
});

it('can visit /ember-data', function() {
Expand Down
22 changes: 14 additions & 8 deletions tests/acceptance/events-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { describe, it, beforeEach, afterEach } from 'mocha';
import $ from 'jquery';
import { run } from '@ember/runloop';
import {
describe,
it,
beforeEach,
afterEach
} from 'mocha';
import { expect } from 'chai';
import startApp from '../helpers/start-app';
import Ember from 'ember';

describe('Acceptance: Events', function() {
let application;
Expand All @@ -12,7 +18,7 @@ describe('Acceptance: Events', function() {
});

afterEach(function() {
Ember.run(application, 'destroy');
run(application, 'destroy');
});

describe("visiting blur and triggering the blur event", function() {
Expand All @@ -21,11 +27,11 @@ describe('Acceptance: Events', function() {
});

beforeEach(function() {
Ember.$('.x-select').trigger('blur');
$('.x-select').trigger('blur');
});

it("fires the blur action", function() {
expect(Ember.$('.spec-event-type').text().trim()).to.equal('blur');
expect($('.spec-event-type').text().trim()).to.equal('blur');
});
});

Expand All @@ -36,7 +42,7 @@ describe('Acceptance: Events', function() {
});

it("fires the click action", function() {
expect(Ember.$('.spec-event-type').text().trim()).to.equal('click');
expect($('.spec-event-type').text().trim()).to.equal('click');
});
});

Expand All @@ -46,11 +52,11 @@ describe('Acceptance: Events', function() {
});

beforeEach(function() {
Ember.$('.x-select').trigger('focusout');
$('.x-select').trigger('focusout');
});

it("fires the focus-out action", function() {
expect(Ember.$('.spec-event-type').text().trim()).to.equal('focusout');
expect($('.spec-event-type').text().trim()).to.equal('focusout');
});
});

Expand Down
10 changes: 6 additions & 4 deletions tests/acceptance/x-select-multiple-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*global expect, getComponentById */
import Ember from 'ember';
import { run } from '@ember/runloop';

import $ from 'jquery';
import startApp from '../helpers/start-app';
import {
beforeEach,
Expand All @@ -18,7 +20,7 @@ describe('XSelect: Multiple Selection', function() {
visit("test-bed/multiple");
});
beforeEach(function() {
let el = Ember.$('select');
let el = $('select');
this.component = getComponentById(el.attr('id'));
this.$ = function() {
return this.component.$.apply(this.component, arguments);
Expand All @@ -27,7 +29,7 @@ describe('XSelect: Multiple Selection', function() {
});

afterEach(function() {
Ember.run(App, 'destroy');
run(App, 'destroy');
});

it("does not fire any actions on didInsertElement", function() {
Expand Down Expand Up @@ -75,7 +77,7 @@ describe('XSelect: Multiple Selection', function() {
describe.skip("trying to set the value to a non-array", function() {
beforeEach(function() {
try {
Ember.run(() => {
run(() => {
this.controller.set('selections', 'OHAI!');
});
} catch (e) {
Expand Down
Loading

0 comments on commit a7c97f1

Please sign in to comment.