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/.editorconfig b/.editorconfig index 5d5dea4..403fa6b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,10 +13,6 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.js] -indent_style = space -indent_size = 2 - [*.hbs] indent_style = space indent_size = 2 @@ -28,6 +24,7 @@ indent_size = 2 [*.html] indent_style = space indent_size = 2 +insert_final_newline = false [*.md] trim_trailing_whitespace = false diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..1dc3939 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,48 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + plugins: [ + 'ember' + ], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended' + ], + env: { + browser: true + }, + rules: { + }, + overrides: [ + // node files + { + files: [ + 'index.js', + 'testem.js', + 'ember-cli-build.js', + 'config/**/*.js', + 'tests/dummy/config/**/*.js' + ], + excludedFiles: [ + 'app/**', + 'addon/**', + 'tests/dummy/app/**' + ], + parserOptions: { + sourceType: 'script', + ecmaVersion: 2015 + }, + env: { + browser: false, + node: true + }, + plugins: ['node'], + rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { + // add your custom rules and overrides for node files here + }) + } + ] +}; diff --git a/.gitignore b/.gitignore index 86fceae..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 @@ -13,5 +13,11 @@ /connect.lock /coverage/* /libpeerconnection.log -npm-debug.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 8c6099b..bf7560d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,15 +1,22 @@ -bower_components/ -tests/ -tmp/ -dist/ - +/bower_components +/config/ember-try.js +/dist +/tests +/tmp +**/.gitkeep .bowerrc .editorconfig .ember-cli +.eslintrc.js +.gitignore +.watchmanconfig .travis.yml -.npmignore -**/.gitkeep bower.json -Brocfile.js -testem.json CHANGELOG.md +ember-cli-build.js +testem.js + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/.travis.yml b/.travis.yml index 750e825..c9db7e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,47 @@ --- 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 -before_install: - - "npm config set spin false" - - "npm install -g npm@^2" +env: + 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.12 + - EMBER_TRY_SCENARIO=ember-lts-2.16 + - EMBER_TRY_SCENARIO=ember-lts-2.18 + - EMBER_TRY_SCENARIO=ember-release + - EMBER_TRY_SCENARIO=ember-beta + - EMBER_TRY_SCENARIO=ember-canary + - EMBER_TRY_SCENARIO=ember-default -install: - - npm install -g bower - - npm install - - bower install +matrix: + fast_finish: true + allow_failures: + - env: EMBER_TRY_SCENARIO=ember-canary + +before_install: + - npm config set spin false + - npm install -g npm@4 + - npm --version script: - - npm test + - npm run lint:js + # 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/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000..e7834e3 --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1,3 @@ +{ + "ignore_dirs": ["tmp", "dist"] +} diff --git a/LICENSE.md b/LICENSE.md index b6c71bd..198f6da 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 +Copyright (c) 2018 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/config/ember-try.js b/config/ember-try.js new file mode 100644 index 0000000..08e0dd9 --- /dev/null +++ b/config/ember-try.js @@ -0,0 +1,70 @@ +'use strict'; + +const getChannelURL = require('ember-source-channel-url'); + +module.exports = function() { + return Promise.all([ + getChannelURL('release'), + getChannelURL('beta'), + getChannelURL('canary'), + ]).then((urls) => { + return { + scenarios: [ + { + name: 'ember-lts-2.12', + npm: { + devDependencies: { + 'ember-source': '~2.12.0' + } + } + }, + { + name: 'ember-lts-2.16', + npm: { + devDependencies: { + 'ember-source': '~2.16.0' + } + } + }, + { + name: 'ember-lts-2.18', + npm: { + devDependencies: { + 'ember-source': '~2.18.0' + } + } + }, + { + name: 'ember-release', + npm: { + devDependencies: { + 'ember-source': urls[0] + } + } + }, + { + name: 'ember-beta', + npm: { + devDependencies: { + 'ember-source': urls[1] + } + } + }, + { + name: 'ember-canary', + npm: { + devDependencies: { + 'ember-source': urls[2] + } + } + }, + { + name: 'ember-default', + npm: { + devDependencies: {} + } + } + ] + }; + }); +}; diff --git a/ember-cli-build.js b/ember-cli-build.js new file mode 100644 index 0000000..8668696 --- /dev/null +++ b/ember-cli-build.js @@ -0,0 +1,30 @@ +'use strict'; + +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); +const mergeTrees = require('broccoli-merge-trees'); +const pickFiles = require('broccoli-static-compiler'); + +module.exports = function(defaults) { + let app = new EmberAddon(defaults, { + // Add options here + }); + + /* + 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 + */ + + app.import('bower_components/bootstrap/dist/css/bootstrap.css'); + //app.import('bower_components/bootstrap/dist/js/bootstrap.js'); + + // Copy glyphicon fonts + let fonts = pickFiles('bower_components/bootstrap/dist/fonts', { + srcDir: '/', + files: ['**/*'], + destDir: '/fonts' + }); + + return mergeTrees([app.toTree(), fonts]) +}; diff --git a/index.js b/index.js index 48458a3..4b0b8e5 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,3 @@ -/* jshint node: true */ 'use strict'; module.exports = { diff --git a/package.json b/package.json index 29ceb7c..88f5d48 100644 --- a/package.json +++ b/package.json @@ -1,61 +1,72 @@ { "name": "pagination-pager", "version": "3.1.0", + "bugs": { + "url": "https://github.com/knownasilya/pagination-pager/issues" + }, + "homepage": "https://github.com/knownasilya/pagination-pager", + "description": "{{pagination-pager}} - Ember.js Component for Bootstrap 3 pagination & pager components", + "keywords": [ + "ember-addon", + "pagination", + "pager", + "bootstrap", + "bs3", + "component", + "ember", + "emberjs" + ], + "license": "MIT", + "author": "Ilya Radchenko ", "directories": { "doc": "doc", "test": "tests" }, - "scripts": { - "start": "ember server", - "build": "ember build", - "test": "ember test", - "release": "standard-version" - }, "repository": { "type": "git", "url": "git@github.com:knownasilya/pagination-pager.git" }, - "bugs": { - "url": "https://github.com/knownasilya/pagination-pager/issues" - }, - "homepage": "https://github.com/knownasilya/pagination-pager", - "engines": { - "node": ">= 0.10.0" + "scripts": { + "build": "ember build", + "lint:js": "eslint ./*.js addon addon-test-support app config lib server test-support tests", + "start": "ember serve", + "test": "ember try:each", + "release": "standard-version" }, - "author": "Ilya Radchenko ", - "license": "MIT", "dependencies": { - "ember-cli-babel": "^5.1.7" + "ember-cli-babel": "^6.6.0" }, "devDependencies": { - "broccoli-asset-rev": "^2.0.2", + "broccoli-asset-rev": "^2.4.5", "broccoli-merge-trees": "^0.2.4", "broccoli-static-compiler": "^0.2.2", - "ember-cli": "0.2.7", - "ember-cli-app-version": "0.3.3", - "ember-cli-content-security-policy": "0.4.0", - "ember-cli-dependency-checker": "^1.0.0", + "ember-ajax": "^3.0.0", + "ember-cli": "~3.0.2", + "ember-cli-dependency-checker": "^2.0.0", + "ember-cli-eslint": "^4.2.1", "ember-cli-github-pages": "0.1.2", - "ember-cli-htmlbars": "0.7.6", - "ember-cli-inject-live-reload": "^1.3.0", - "ember-cli-qunit": "0.3.13", - "ember-cli-uglify": "^1.0.1", - "ember-disable-prototype-extensions": "^1.0.0", - "ember-disable-proxy-controllers": "^1.0.0", - "ember-export-application-global": "^1.0.2", + "ember-cli-htmlbars": "^2.0.1", + "ember-cli-htmlbars-inline-precompile": "^1.0.0", + "ember-cli-inject-live-reload": "^1.4.1", + "ember-cli-qunit": "^4.1.1", + "ember-cli-shims": "^1.2.0", + "ember-cli-sri": "^2.1.0", + "ember-cli-uglify": "^2.0.0", + "ember-disable-prototype-extensions": "^1.1.2", + "ember-export-application-global": "^2.0.0", + "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", + "ember-resolver": "^4.0.0", + "ember-source": "~3.0.0", + "ember-source-channel-url": "^1.0.1", + "eslint-plugin-ember": "^5.0.0", + "eslint-plugin-node": "^5.2.1", + "loader.js": "^4.2.3", "standard-version": "^4.0.0" }, - "description": "{{pagination-pager}} - Ember.js Component for Bootstrap 3 pagination & pager components", - "keywords": [ - "ember-addon", - "pagination", - "pager", - "bootstrap", - "bs3", - "component", - "ember", - "emberjs" - ], + "engines": { + "node": "^4.5 || 6.* || >= 7.*" + }, "ember-addon": { "configPath": "tests/dummy/config", "demoURL": "http://knownasilya.github.io/pagination-pager/" diff --git a/testem.js b/testem.js new file mode 100644 index 0000000..d1755a4 --- /dev/null +++ b/testem.js @@ -0,0 +1,24 @@ +module.exports = { + test_page: 'tests/index.html?hidepassed', + disable_watching: true, + launch_in_ci: [ + 'Chrome' + ], + launch_in_dev: [ + 'Chrome' + ], + browser_args: { + Chrome: { + mode: 'ci', + args: [ + // --no-sandbox is needed when running Chrome inside a container + process.env.TRAVIS ? '--no-sandbox' : null, + + '--disable-gpu', + '--headless', + '--remote-debugging-port=0', + '--window-size=1440,900' + ].filter(Boolean) + } + } +}; diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 757df38..b3b2bd6 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -1,14 +1,12 @@ -import Ember from 'ember'; -import Resolver from 'ember/resolver'; -import loadInitializers from 'ember/load-initializers'; +import Application from '@ember/application'; +import Resolver from './resolver'; +import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -Ember.MODEL_FACTORY_INJECTIONS = true; - -var App = Ember.Application.extend({ +const App = Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, - Resolver: Resolver + Resolver }); loadInitializers(App, config.modulePrefix); diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index 651c9fa..4c98d39 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -7,19 +7,19 @@ - {{content-for 'head'}} + {{content-for "head"}} - - + + - {{content-for 'head-footer'}} + {{content-for "head-footer"}} - {{content-for 'body'}} + {{content-for "body"}} - - + + - {{content-for 'body-footer'}} + {{content-for "body-footer"}} diff --git a/tests/dummy/app/resolver.js b/tests/dummy/app/resolver.js new file mode 100644 index 0000000..2fb563d --- /dev/null +++ b/tests/dummy/app/resolver.js @@ -0,0 +1,3 @@ +import Resolver from 'ember-resolver'; + +export default Resolver; diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index cef554b..d0bb009 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,8 +1,9 @@ -import Ember from 'ember'; +import EmberRouter from '@ember/routing/router'; import config from './config/environment'; -var Router = Ember.Router.extend({ - location: config.locationType +const Router = EmberRouter.extend({ + location: config.locationType, + rootURL: config.rootURL }); Router.map(function() { diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index ca4a126..3bc199d 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,15 +1,19 @@ -/* jshint node: true */ +'use strict'; module.exports = function(environment) { - var ENV = { + let ENV = { modulePrefix: 'dummy', - environment: environment, - baseURL: '/pagination-pager', + environment, + rootURL: '/pagination-pager', 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 } }, @@ -29,7 +33,6 @@ module.exports = function(environment) { if (environment === 'test') { // Testem prefers this... - ENV.baseURL = '/'; ENV.locationType = 'none'; // keep test console output quieter @@ -37,10 +40,11 @@ module.exports = function(environment) { ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; + ENV.APP.autoboot = false; } if (environment === 'production') { - + // here you can enable a production-specific feature } return ENV; diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js new file mode 100644 index 0000000..8ffae36 --- /dev/null +++ b/tests/dummy/config/targets.js @@ -0,0 +1,18 @@ +'use strict'; + +const browsers = [ + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' +]; + +const isCI = !!process.env.CI; +const isProduction = process.env.EMBER_ENV === 'production'; + +if (isCI || isProduction) { + browsers.push('ie 11'); +} + +module.exports = { + browsers +}; diff --git a/tests/helpers/.gitkeep b/tests/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js deleted file mode 100644 index 28f4ece..0000000 --- a/tests/helpers/resolver.js +++ /dev/null @@ -1,11 +0,0 @@ -import Resolver from 'ember/resolver'; -import config from '../../config/environment'; - -var resolver = Resolver.create(); - -resolver.namespace = { - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix -}; - -export default resolver; diff --git a/tests/index.html b/tests/index.html index 4112b61..038f8ab 100644 --- a/tests/index.html +++ b/tests/index.html @@ -7,12 +7,12 @@ - {{content-for 'head'}} - {{content-for 'test-head'}} + {{content-for "head"}} + {{content-for "test-head"}} - - - + + + - {{content-for 'head-footer'}} - {{content-for 'test-head-footer'}} + {{content-for "head-footer"}} + {{content-for "test-head-footer"}} + {{content-for "body"}} + {{content-for "test-body"}} - {{content-for 'body'}} - {{content-for 'test-body'}} - - - - - + + + + + - {{content-for 'body-footer'}} - {{content-for 'test-body-footer'}} + {{content-for "body-footer"}} + {{content-for "test-body-footer"}} diff --git a/tests/integration/.gitkeep b/tests/integration/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-helper.js b/tests/test-helper.js index b5f6449..0382a84 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,12 +1,8 @@ -import resolver from './helpers/resolver'; -import { - setResolver -} from 'ember-qunit'; +import Application from '../app'; +import config from '../config/environment'; +import { setApplication } from '@ember/test-helpers'; +import { start } from 'ember-qunit'; -setResolver(resolver); +setApplication(Application.create(config.APP)); -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; +start();