From 49902e0a3f56da2940f651aeb3623a571a02bf67 Mon Sep 17 00:00:00 2001 From: Asaf Shakarzy Date: Tue, 19 May 2015 17:41:20 +0300 Subject: [PATCH] Support latest Ember CLI 0.2.5 --- .editorconfig | 3 +- .npmignore | 14 +++++++ .travis.yml | 16 +++++++- Brocfile.js | 2 +- addon/tab-list.js | 23 +++++------ addon/tab-panel.js | 24 +++++------ addon/tab.js | 40 +++++++++---------- addon/tabs.js | 10 ++--- bower.json | 23 ++++++----- config/ember-try.js | 35 ++++++++++++++++ package.json | 55 +++++++++++++------------- testem.json | 3 +- tests/.jshintrc | 23 ----------- tests/dummy/app/app.js | 5 ++- tests/dummy/app/controllers/sidebar.js | 4 +- tests/dummy/config/environment.js | 6 +-- tests/dummy/public/.gitkeep | 0 tests/dummy/public/crossdomain.xml | 18 ++++----- tests/dummy/public/robots.txt | 1 + tests/helpers/start-app.js | 10 ++--- tests/index.html | 16 -------- tests/test-helper.js | 6 --- 22 files changed, 180 insertions(+), 157 deletions(-) create mode 100644 .npmignore create mode 100644 config/ember-try.js delete mode 100644 tests/dummy/public/.gitkeep diff --git a/.editorconfig b/.editorconfig index 5d5dea4..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 @@ -29,5 +30,5 @@ indent_size = 2 indent_style = space indent_size = 2 -[*.md] +[*.{diff,md}] trim_trailing_whitespace = false diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..49996f5 --- /dev/null +++ b/.npmignore @@ -0,0 +1,14 @@ +bower_components/ +tests/ +tmp/ +dist/ + +.bowerrc +.editorconfig +.ember-cli +.travis.yml +.npmignore +**/.gitkeep +bower.json +Brocfile.js +testem.json 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/Brocfile.js b/Brocfile.js index 3b1a8df..a0c97ed 100644 --- a/Brocfile.js +++ b/Brocfile.js @@ -30,4 +30,4 @@ var extraAssets = pickFiles('bower_components/fontawesome', { destDir: '/' }); -module.exports = mergeTrees([app.toTree(), extraAssets]) +module.exports = mergeTrees([app.toTree(), extraAssets]) \ No newline at end of file diff --git a/addon/tab-list.js b/addon/tab-list.js index 9017d11..e610a99 100644 --- a/addon/tab-list.js +++ b/addon/tab-list.js @@ -2,6 +2,7 @@ import Em from 'ember'; import WithConfigMixin from 'ember-idx-utils/mixin/with-config'; var computed = Em.computed; +var on = Em.on; /** * `{{em-tab-list}}` component. @@ -13,14 +14,14 @@ var computed = Em.computed; */ export default Em.Component.extend(WithConfigMixin, { - setTagName: (function() { + setTagName: on('init', function() { return this.set('tagName', this.get('config.tabs.tabListTag') || 'div'); - }).on('init'), + }), classNameBindings: ['styleClasses'], - styleClasses: (function() { + styleClasses: Em.computed(function() { var _ref; return (_ref = this.get('config.tabs.tabListClasses')) != null ? _ref.join(" ") : void 0; - }).property(), + }), /** * The ancestor `Tabs` component @@ -51,9 +52,9 @@ export default Em.Component.extend(WithConfigMixin, { * @property selectedIdx * @type Number */ - selectedIdx: (function() { + selectedIdx: computed('selected', function() { return this.get('tab_instances').indexOf(this.get('selected')); - }).property('selected'), + }), /** * Auto register this `TabList` in the ancestor tabs component. @@ -61,9 +62,9 @@ export default Em.Component.extend(WithConfigMixin, { * @method register * @private */ - register: (function() { + register: on('didInsertElement', function() { return this.get('tabs').setTabList(this); - }).on('didInsertElement'), + }), /** * Initialize an empty tabs array @@ -71,11 +72,11 @@ export default Em.Component.extend(WithConfigMixin, { * @method initTabs * @private */ - initTabs: (function() { + initTabs: on('init', function() { return this.set('tab_instances', Em.ArrayProxy.create({ - content: [] + content: Em.A() })); - }).on('init'), + }), /** * Add a tab to the tab list diff --git a/addon/tab-panel.js b/addon/tab-panel.js index 71b561a..5279bfa 100644 --- a/addon/tab-panel.js +++ b/addon/tab-panel.js @@ -7,10 +7,10 @@ var computed = Em.computed; export default Em.Component.extend(WithConfigMixin, StyleBindingsMixin, { classNameBindings: ['styleClasses'], - styleClasses: (function() { + styleClasses: Em.computed(function() { var _ref; return (_ref = this.get('config.tabs.tabPanelClasses')) != null ? _ref.join(" ") : void 0; - }).property(), + }), styleBindings: ['height'], attributeBindings: ['selected'], @@ -43,22 +43,22 @@ export default Em.Component.extend(WithConfigMixin, StyleBindingsMixin, { * @property tab * @type Tab */ - tab: (function() { + tab: Em.computed('panels.length', 'tabList.tab_instances.@each', function() { var index, tabs; index = this.get('panels').indexOf(this); tabs = this.get('tabList.tab_instances'); return tabs && tabs.objectAt(index); - }).property('panels.length', 'tabList.tab_instances.@each'), - selected: (function() { + }), + selected: Em.computed('tab', 'tab.selected', function() { return this.get('tab.selected'); - }).property('tab', 'tab.selected'), - changeVisibility: (function() { + }), + changeVisibility: Em.observer('selected', function() { return this.$().css('display', this.get('selected') ? "" : 'none'); - }).observes('selected'), - register: (function() { + }), + register: Em.on('didInsertElement', function() { return this.get('tabs').addTabPanel(this); - }).on('didInsertElement'), - unregister: (function() { + }), + unregister: Em.on('willDestroyElement', function() { return this.get('tabs').removeTabPanel(this); - }).on('willDestroyElement') + }) }); diff --git a/addon/tab.js b/addon/tab.js index f2ea603..e99dc95 100644 --- a/addon/tab.js +++ b/addon/tab.js @@ -10,9 +10,9 @@ var computed = Em.computed; * @class Tab */ export default Em.Component.extend(WithConfigMixin, { - setTagName: (function() { + setTagName: Em.on('init', function() { return this.set('tagName', this.get('config.tabs.tabTag') || 'div'); - }).on('init'), + }), /** * Bind the specified attributes to the DOM element @@ -23,19 +23,19 @@ export default Em.Component.extend(WithConfigMixin, { attributeBindings: ['active'], classNameBindings: ['styleClasses', 'selectedClass'], - styleClasses: (function() { + styleClasses: computed(function() { var _ref; return (_ref = this.get('config.tabs.tabClasses')) != null ? _ref.join(" ") : void 0; - }).property(), + }), - selectedClass: (function() { + selectedClass: computed('selected', function() { var _ref; if (this.get('selected')) { return (_ref = this.get('config.tabs.tabSelectedClasses')) != null ? _ref.join(" ") : void 0; } else { return null; } - }).property('selected'), + }), /** * A reference to the {{#crossLink "Tabs"}}Tabs{{/crossLink}} instance. @@ -59,21 +59,21 @@ export default Em.Component.extend(WithConfigMixin, { * @property selected * @type Boolean */ - selected: (function() { + selected: computed('tabs.selected', function() { return this.get('tabs.selected') === this; - }).property('tabs.selected'), + }), - active: (function() { + active: computed('selected', function() { if (this.get('selected')) { return "true"; } else { return null; } - }).property('selected'), + }), - index: (function() { + index: computed('tabList.tab_instances.@each', function() { return this.get('tabList.tab_instances').indexOf(this); - }).property('tabList.tab_instances.@each'), + }), /** * Select this tab. @@ -82,9 +82,9 @@ export default Em.Component.extend(WithConfigMixin, { * * @method select */ - select: (function() { + select: Em.on('click', function() { return this.get('tabs').select(this); - }).on('click'), + }), /** * Select this tab if it matches the {{#crossLink "Tabs/select:method"}}selected-idx{{/crossLink}} property set by the Tabs component. @@ -92,7 +92,7 @@ export default Em.Component.extend(WithConfigMixin, { * @method selectByTabsParam * @private */ - selectByTabsParam: (function() { + selectByTabsParam: Em.on('didInsertElement', Em.observer('tabs.selected-idx', function() { var idx; if ((this.get('tabs.selected') != null) === this) { return; @@ -101,7 +101,7 @@ export default Em.Component.extend(WithConfigMixin, { if (idx === this.get('index')) { return this.select(); } - }).observes('tabs.selected-idx').on('didInsertElement'), + })), /** * Register this tab in the {{#crossLink "TabList"}}{{/crossLink}} component instance. @@ -109,9 +109,9 @@ export default Em.Component.extend(WithConfigMixin, { * @method register * @private */ - register: (function() { + register: Em.on('didInsertElement', function() { return this.get('tabList').addTab(this); - }).on('didInsertElement'), + }), /** * Unregister this tab from the {{#crossLink "TabList"}}{{/crossLink}} component instance. @@ -119,7 +119,7 @@ export default Em.Component.extend(WithConfigMixin, { * @method unregister * @private */ - unregister: (function() { + unregister: Em.on('willDestroyElement', function() { return this.get('tabList').removeTab(this); - }).on('willDestroyElement') + }) }); \ No newline at end of file diff --git a/addon/tabs.js b/addon/tabs.js index a33d913..1d6b133 100644 --- a/addon/tabs.js +++ b/addon/tabs.js @@ -26,10 +26,10 @@ import StyleBindingsMixin from 'ember-idx-utils/mixin/style-bindings'; export default Em.Component.extend(WithConfigMixin, StyleBindingsMixin, { debug: false, classNameBindings: ['styleClasses'], - styleClasses: (function() { + styleClasses: Em.computed(function() { var _ref; return (_ref = this.get('config.tabs.tabsClasses')) != null ? _ref.join(" ") : void 0; - }).property(), + }), styleBindings: ['height'], /** @@ -92,11 +92,11 @@ export default Em.Component.extend(WithConfigMixin, StyleBindingsMixin, { * * @method initTabPanels */ - initTabPanels: (function() { + initTabPanels: Em.on('init', function() { return this.set('panels', Em.ArrayProxy.create({ - content: [] + content: Em.A() })); - }).on('init'), + }), /** * Set the specified `TabList` instance. diff --git a/bower.json b/bower.json index d876001..480a866 100644 --- a/bower.json +++ b/bower.json @@ -1,22 +1,21 @@ { "name": "ember-idx-tabs", "dependencies": { - "handlebars": "~1.3.0", + "ember": "1.12.0", + "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", + "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", + "ember-data": "1.0.0-beta.17", + "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", + "ember-qunit": "0.3.3", + "ember-qunit-notifications": "0.0.7", + "ember-resolver": "~0.1.15", "jquery": "^1.11.1", - "ember": "1.8.1", - "ember-data": "1.0.0-beta.12", - "ember-resolver": "~0.1.10", - "loader.js": "stefanpenner/loader.js#1.0.1", - "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3", - "ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4", - "ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2", - "ember-qunit": "0.1.8", - "ember-qunit-notifications": "0.0.4", - "qunit": "~1.15.0" + "loader.js": "ember-cli/loader.js#3.2.0", + "qunit": "~1.17.1" }, "devDependencies": { "bootstrap": "~3.3.1", "fontawesome": "~4.2.0", "highlightjs": "~8.4.0" } -} +} \ No newline at end of file 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 1a4903e..b3478c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "name": "ember-idx-tabs", - "version": "0.1.3", + "version": "0.1.4", + "description": "Ambitious Tabs Component for Ember.js", + "authors": [ + "Indexia Technologies, ltd." + ], "directories": { "doc": "doc", "test": "tests" @@ -8,44 +12,41 @@ "scripts": { "start": "ember server", "build": "ember build", - "test": "ember test" - }, - "repository": { - "url": "https://github.com/indexiatech/ember-idx-tabs" + "test": "ember try:testall" }, + "url": "https://github.com/indexiatech/ember-idx-tabs", "engines": { "node": ">= 0.10.0" }, - "author": "", "license": "APACHE2", "devDependencies": { - "broccoli-asset-rev": "^1.0.0", - "broccoli-ember-hbs-template-compiler": "^1.6.1", - "broccoli-merge-trees": "^0.2.1", - "broccoli-static-compiler": "^0.2.1", - "ember-cli": "0.1.4", - "ember-cli-content-security-policy": "0.3.0", - "ember-cli-dependency-checker": "0.0.6", - "ember-cli-esnext": "0.1.1", + "broccoli-asset-rev": "^2.0.2", + "ember-cli": "0.2.5", + "ember-cli-app-version": "0.3.3", + "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-qunit": "0.1.2", - "ember-data": "1.0.0-beta.12", - "ember-export-application-global": "^1.0.0", - "express": "^4.8.5", - "glob": "^4.0.5" + "ember-cli-qunit": "0.3.13", + "ember-cli-uglify": "^1.0.1", + "ember-data": "1.0.0-beta.17", + "ember-disable-proxy-controllers": "^0.7.0", + "ember-export-application-global": "^1.0.2", + "ember-disable-prototype-extensions": "^1.0.0", + "ember-try": "0.0.4", + "broccoli-merge-trees": "^0.2.1", + "broccoli-static-compiler": "^0.2.1", + "ember-idx-utils": "^0.2.3" }, - "description": "Ambitious Tabs Component for Ember.js", - "authors": [ - "Indexia Technologies, ltd." - ], "keywords": [ "ember-addon" ], - "ember-addon": { - "configPath": "tests/dummy/config" - }, "dependencies": { + "ember-cli-babel": "^5.0.0", "ember-idx-utils": "^0.2.2" + }, + "ember-addon": { + "configPath": "tests/dummy/config" } -} +} \ No newline at end of file diff --git a/testem.json b/testem.json index eff93f9..0f35392 100644 --- a/testem.json +++ b/testem.json @@ -1,6 +1,7 @@ { "framework": "qunit", - "test_page": "tests/index.html", + "test_page": "tests/index.html?hidepassed", + "disable_watching": true, "launch_in_ci": [ "PhantomJS" ], diff --git a/tests/.jshintrc b/tests/.jshintrc index 6ebf71a..ea8b88f 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -6,29 +6,8 @@ "setTimeout", "$", "-Promise", - "QUnit", "define", "console", - "equal", - "notEqual", - "notStrictEqual", - "test", - "asyncTest", - "testBoth", - "testWithDefault", - "raises", - "throws", - "deepEqual", - "start", - "stop", - "ok", - "strictEqual", - "module", - "moduleFor", - "moduleForComponent", - "moduleForModel", - "process", - "expect", "visit", "exists", "fillIn", @@ -39,8 +18,6 @@ "findWithAssert", "wait", "DS", - "isolatedContainer", - "startApp", "andThen", "currentURL", "currentPath", diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 757df38..037963b 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -3,11 +3,12 @@ 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/app/controllers/sidebar.js b/tests/dummy/app/controllers/sidebar.js index c4a224b..af38c8c 100644 --- a/tests/dummy/app/controllers/sidebar.js +++ b/tests/dummy/app/controllers/sidebar.js @@ -2,11 +2,11 @@ import Em from 'ember'; export default Em.ArrayController.extend({ needs: ['application'], - model: [ + model: Em.A([ {route: 'gettingstarted', text: 'Getting Started'}, {route: 'simple', text: 'Simple'}, {route: 'styles', text: 'Styles'}, {route: 'query_params', text: 'Query Params'}, {route: 'controller_per_tab', text: 'Controller Per Tab'} - ] + ]) }); \ No newline at end of file diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 2f593cb..2a73368 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -5,7 +5,7 @@ module.exports = function(environment) { modulePrefix: 'dummy', environment: environment, baseURL: '/ember-idx-tabs', - locationType: 'hash', + locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build @@ -21,10 +21,10 @@ module.exports = function(environment) { if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; - ENV.APP.LOG_ACTIVE_GENERATION = true; + // ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; - ENV.APP.LOG_VIEW_LOOKUPS = true; + // ENV.APP.LOG_VIEW_LOOKUPS = true; } if (environment === 'test') { diff --git a/tests/dummy/public/.gitkeep b/tests/dummy/public/.gitkeep deleted file mode 100644 index e69de29..0000000 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: diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index e087e48..16cc7c3 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -4,16 +4,16 @@ import Router from '../../router'; import config from '../../config/environment'; export default function startApp(attrs) { - var App; + var application; var attributes = Ember.merge({}, config.APP); attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; Ember.run(function() { - App = Application.create(attributes); - App.setupForTesting(); - App.injectTestHelpers(); + application = Application.create(attributes); + application.setupForTesting(); + application.injectTestHelpers(); }); - return App; + return application; } diff --git a/tests/index.html b/tests/index.html index 4112b61..8fea6fe 100644 --- a/tests/index.html +++ b/tests/index.html @@ -13,22 +13,6 @@ - {{content-for 'head-footer'}} {{content-for 'test-head-footer'}} diff --git a/tests/test-helper.js b/tests/test-helper.js index b5f6449..e6cfb70 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -4,9 +4,3 @@ import { } from 'ember-qunit'; setResolver(resolver); - -document.write('
'); - -QUnit.config.urlConfig.push({ id: 'nocontainer', label: 'Hide container'}); -var containerVisibility = QUnit.urlParams.nocontainer ? 'hidden' : 'visible'; -document.getElementById('ember-testing-container').style.visibility = containerVisibility;