diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 959e169..0000000 --- a/.bowerrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "directory": "bower_components", - "analytics": false -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..2873e2f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + extends: 'eslint:recommended', + env: { + browser: true + }, + rules: { + } +}; diff --git a/.gitignore b/.gitignore index 373de6a..8fa39a6 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,4 +14,10 @@ /coverage/* /libpeerconnection.log npm-debug.log* +yarn-error.log testem.log + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 08096ef..0000000 --- a/.jshintrc +++ /dev/null @@ -1,32 +0,0 @@ -{ - "predef": [ - "document", - "window", - "-Promise" - ], - "browser": true, - "boss": true, - "curly": true, - "debug": false, - "devel": true, - "eqeqeq": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "sub": true, - "strict": false, - "white": false, - "eqnull": true, - "esnext": true, - "unused": true -} diff --git a/.npmignore b/.npmignore index fa8b147..889b2bf 100644 --- a/.npmignore +++ b/.npmignore @@ -8,7 +8,7 @@ .editorconfig .ember-cli .gitignore -.jshintrc +.eslintrc.js .watchmanconfig .travis.yml bower.json diff --git a/.travis.yml b/.travis.yml index 6319ea9..d04ff8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,29 @@ --- 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 - "4" sudo: false +dist: trusty + +addons: + chrome: stable cache: directories: - - node_modules + - $HOME/.npm env: - - EMBER_TRY_SCENARIO=default - - EMBER_TRY_SCENARIO=ember-1.13 + # 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 @@ -23,16 +32,10 @@ matrix: before_install: - npm config set spin false - - npm install -g bower - - bower --version - - npm install phantomjs-prebuilt - - node_modules/phantomjs-prebuilt/bin/phantomjs --version - -install: - - npm install - - bower install + - npm install -g npm@4 + - npm --version script: - # Usually, it's okay to finish the test scenario without reverting - # to the addon's original dependency state, skipping "cleanup". - - ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup + # Usually, it's ok to finish the test scenario without reverting + # to the addon's original dependency state, skipping "cleanup". + - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup diff --git a/LICENSE.md b/LICENSE.md index 30af71e..36b7e6b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Kim Røen +Copyright (c) 2016 - 2017 Kim Røen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/bower.json b/bower.json deleted file mode 100644 index 594bd51..0000000 --- a/bower.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "ember-cli-document-title", - "dependencies": { - "ember": "~2.8.0", - "ember-cli-shims": "0.1.0" - } -} diff --git a/config/ember-try.js b/config/ember-try.js index 014f603..21f6079 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,20 +1,27 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { scenarios: [ { - name: 'default', - bower: { - dependencies: { } - } - }, - { - name: 'ember-1.13', + name: 'ember-lts-2.8', bower: { dependencies: { - 'ember': '~1.13.0' + 'ember': 'components/ember#lts-2-8' }, resolutions: { - 'ember': '~1.13.0' + 'ember': 'lts-2-8' + } + }, + npm: { + devDependencies: { + 'ember-source': null + } + } + }, + { + name: 'ember-lts-2.12', + npm: { + devDependencies: { + 'ember-source': '~2.12.0' } } }, @@ -27,6 +34,11 @@ module.exports = { resolutions: { 'ember': 'release' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -38,6 +50,11 @@ module.exports = { resolutions: { 'ember': 'beta' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -49,6 +66,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 4ac3913..156e23f 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,9 +1,10 @@ -/*jshint node:true*/ -/* global require, module */ -var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); +/* eslint-env node */ +'use strict'; + +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); module.exports = function(defaults) { - var app = new EmberAddon(defaults, { + let app = new EmberAddon(defaults, { // Add options here }); diff --git a/index.js b/index.js index a96e47c..898a522 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 b954bcf..90e1152 100644 --- a/package.json +++ b/package.json @@ -2,53 +2,53 @@ "name": "ember-cli-document-title", "version": "0.3.3", "description": "Adding document title functionality to your ember app", + "keywords": [ + "ember-addon" + ], + "homepage": "https://github.com/kimroen/ember-cli-document-title", + "bugs": { + "url": "https://github.com/kimroen/ember-cli-document-title/issues" + }, + "license": "MIT", + "author": "Kim Røen ", "main": "index.js", "directories": { "doc": "doc", "test": "tests" }, - "scripts": { - "build": "ember build", - "start": "ember server", - "test": "ember try:each" - }, "repository": { "type": "git", "url": "https://github.com/kimroen/ember-cli-document-title.git" }, - "engines": { - "node": ">= 0.10.0" + "scripts": { + "build": "ember build", + "start": "ember server", + "test": "ember try:each" }, - "author": "Kim Røen ", - "license": "MIT", - "bugs": { - "url": "https://github.com/kimroen/ember-cli-document-title/issues" + "dependencies": { + "ember-cli-babel": "^6.3.0" }, - "homepage": "https://github.com/kimroen/ember-cli-document-title", "devDependencies": { - "broccoli-asset-rev": "^2.4.2", - "ember-cli": "2.8.0", - "ember-cli-app-version": "^1.0.0", - "ember-cli-dependency-checker": "^1.2.0", - "ember-cli-htmlbars": "^1.0.3", - "ember-cli-htmlbars-inline-precompile": "^0.3.1", - "ember-cli-inject-live-reload": "^1.4.0", - "ember-cli-qunit": "^2.1.0", - "ember-cli-release": "^0.2.9", + "broccoli-asset-rev": "^2.4.5", + "ember-cli": "~2.14.2", + "ember-cli-dependency-checker": "^1.3.0", + "ember-cli-eslint": "^3.0.0", + "ember-cli-htmlbars": "^2.0.1", + "ember-cli-htmlbars-inline-precompile": "^0.4.3", + "ember-cli-inject-live-reload": "^1.4.1", + "ember-cli-qunit": "^4.0.0", + "ember-cli-shims": "^1.1.0", "ember-cli-sri": "^2.1.0", - "ember-cli-test-loader": "^1.1.0", "ember-cli-uglify": "^1.2.0", - "ember-disable-prototype-extensions": "^1.1.0", - "ember-export-application-global": "^1.0.5", - "ember-load-initializers": "^0.5.1", - "ember-resolver": "^2.0.3", - "loader.js": "^4.0.1" + "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-source": "~2.14.1", + "loader.js": "^4.2.3" }, - "keywords": [ - "ember-addon" - ], - "dependencies": { - "ember-cli-babel": "^5.1.6" + "engines": { + "node": "^4.5 || 6.* || >= 7.*" }, "ember-addon": { "configPath": "tests/dummy/config" diff --git a/testem.js b/testem.js index 26044b2..a40a530 100644 --- a/testem.js +++ b/testem.js @@ -1,13 +1,19 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { - "framework": "qunit", - "test_page": "tests/index.html?hidepassed", - "disable_watching": true, - "launch_in_ci": [ - "PhantomJS" + test_page: 'tests/index.html?hidepassed', + disable_watching: true, + launch_in_ci: [ + 'Chrome' ], - "launch_in_dev": [ - "PhantomJS", - "Chrome" - ] + launch_in_dev: [ + 'Chrome' + ], + browser_args: { + Chrome: [ + '--disable-gpu', + '--headless', + '--remote-debugging-port=9222', + '--window-size=1440,900' + ] + } }; 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/.jshintrc b/tests/.jshintrc deleted file mode 100644 index 6ec0b7c..0000000 --- a/tests/.jshintrc +++ /dev/null @@ -1,52 +0,0 @@ -{ - "predef": [ - "document", - "window", - "location", - "setTimeout", - "$", - "-Promise", - "define", - "console", - "visit", - "exists", - "fillIn", - "click", - "keyEvent", - "triggerEvent", - "find", - "findWithAssert", - "wait", - "DS", - "andThen", - "currentURL", - "currentPath", - "currentRouteName" - ], - "node": false, - "browser": false, - "boss": true, - "curly": true, - "debug": false, - "devel": false, - "eqeqeq": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "sub": true, - "strict": false, - "white": false, - "eqnull": true, - "esnext": true, - "unused": true -} diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 831ad61..c15f935 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -3,11 +3,7 @@ import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -let App; - -Ember.MODEL_FACTORY_INJECTIONS = true; - -App = Ember.Application.extend({ +const App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index a8dbf9c..1050bb1 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -9,16 +9,16 @@ {{content-for "head"}} - - + + {{content-for "head-footer"}} {{content-for "body"}} - - + + {{content-for "body-footer"}} diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index c59bcd5..f6b07ce 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,15 +1,20 @@ -/* jshint node: true */ +/* eslint-env node */ +'use strict'; module.exports = function(environment) { - var ENV = { + let ENV = { modulePrefix: 'dummy', - environment: environment, - baseURL: '/', + environment, + rootURL: '/', locationType: 'auto', EmberENV: { 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 } }, diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js new file mode 100644 index 0000000..df7664c --- /dev/null +++ b/tests/dummy/config/targets.js @@ -0,0 +1,9 @@ +/* eslint-env node */ +module.exports = { + browsers: [ + 'ie 9', + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' + ] +}; diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js index ed23003..4055bf7 100644 --- a/tests/helpers/module-for-acceptance.js +++ b/tests/helpers/module-for-acceptance.js @@ -1,7 +1,10 @@ +import Ember from 'ember'; import { module } from 'qunit'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; +const { RSVP: { resolve } } = Ember; + export default function(name, options = {}) { module(name, { beforeEach() { @@ -13,11 +16,8 @@ export default function(name, options = {}) { }, afterEach() { - destroyApp(this.application); - - if (options.afterEach) { - options.afterEach.apply(this, arguments); - } + let afterEach = options.afterEach && options.afterEach.apply(this, arguments); + return resolve(afterEach).then(() => destroyApp(this.application)); } }); } diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index e098f1d..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; - 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 64cb47e..762e12f 100644 --- a/tests/index.html +++ b/tests/index.html @@ -21,12 +21,11 @@ {{content-for "body"}} {{content-for "test-body"}} - - - - - - + + + + + {{content-for "body-footer"}} {{content-for "test-body-footer"}} diff --git a/tests/test-helper.js b/tests/test-helper.js index e6cfb70..f219659 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -2,5 +2,7 @@ import resolver from './helpers/resolver'; import { setResolver } from 'ember-qunit'; +import { start } from 'ember-cli-qunit'; setResolver(resolver); +start();