Skip to content

Commit

Permalink
Upgrade to CLI 2.8.0-beta.2. Add unit tests. SRP in Mixin.
Browse files Browse the repository at this point in the history
  • Loading branch information
e00dan committed Aug 6, 2016
1 parent bb68239 commit a5c16a1
Show file tree
Hide file tree
Showing 23 changed files with 269 additions and 149 deletions.
14 changes: 0 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,8 @@ insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"strict": false,
"white": false,
"eqnull": true,
"esnext": true,
"esversion": 6,
"unused": true
}
20 changes: 11 additions & 9 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
bower_components/
tests/
tmp/
dist/

/bower_components
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.gitignore
.jshintrc
.watchmanconfig
.travis.yml
.npmignore
**/.gitkeep
bower.json
Brocfile.js
testem.json
ember-cli-build.js
testem.js
16 changes: 10 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: node_js
node_js:
- "0.12"
- "4"

sudo: false

Expand All @@ -11,6 +11,7 @@ cache:

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
Expand All @@ -21,14 +22,17 @@ matrix:
- 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"
- 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 -g bower
- npm install
- bower install

script:
- ember try $EMBER_TRY_SCENARIO test
# Usually, it's ok 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
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015
Copyright (c) 2016

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:

Expand Down
6 changes: 4 additions & 2 deletions addon/initializers/allow-link-action.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Ember from 'ember';
import LinkActionMixin from '../mixins/link-action';

const { LinkComponent } = Ember;

export function initialize() {
Ember.LinkComponent.reopen(LinkActionMixin);
LinkComponent.reopen(LinkActionMixin);
}

export default {
name: 'allow-link-action',
initialize: initialize
initialize
};
25 changes: 14 additions & 11 deletions addon/mixins/link-action.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import Ember from 'ember';

export default Ember.Mixin.create({
_sendInvokeAction() {
this.sendAction('invokeAction');
},
const { Mixin } = Ember;

export default Mixin.create({
init() {
this._super(...arguments);

// Map desired event name to invoke function
const eventName = this.get('eventName');

if (this.get('invokeAction')) {
this.on(eventName, this, this._sendInvokeAction);
this._attachActionEvent();
}

},

willDestroyElement() {
if (this.get('invokeAction')) {
this.off(this.get('eventName'), this, this._sendInvokeAction);
this._detachActionEvent();
}
},

_sendInvokeAction() {
this.sendAction('invokeAction');
},
_attachActionEvent() {
this.on(this.get('eventName'), this, this._sendInvokeAction);
},
_detachActionEvent() {
this.off(this.get('eventName'), this, this._sendInvokeAction);
}
});
12 changes: 2 additions & 10 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"name": "ember-link-action",
"dependencies": {
"ember": "2.0.2",
"ember-cli-shims": "0.0.6",
"ember-cli-test-loader": "0.2.1",
"ember-load-initializers": "0.1.7",
"ember-qunit": "0.4.16",
"ember-qunit-notifications": "0.1.0",
"ember-resolver": "~0.1.20",
"jquery": "^1.11.3",
"loader.js": "ember-cli/loader.js#3.4.0",
"qunit": "~1.20.0"
"ember": "~2.8.0-beta.1",
"ember-cli-shims": "0.1.1"
}
}
51 changes: 35 additions & 16 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,52 @@ module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
bower: {
dependencies: { }
}
},
{
name: 'ember-1.13',
bower: {
dependencies: {
'ember': '~1.13.0'
},
resolutions: {
'ember': '~1.13.0'
}
}
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
bower: {
dependencies: {
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
}
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
bower: {
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
}
}
},
{
name: 'ember-canary',
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
bower: {
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
}
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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
Expand Down
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:testall"
"test": "ember try:each"
},
"repository": {
"type": "git",
Expand All @@ -21,24 +21,28 @@
"author": "Daniel 'Kuzirashi' Kmak",
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.2.0",
"ember-cli": "1.13.13",
"broccoli-asset-rev": "^2.4.2",
"ember-cli": "2.8.0-beta.2",
"ember-ajax": "^2.0.1",
"ember-cli-app-version": "^1.0.0",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^1.1.0",
"ember-cli-htmlbars": "^1.0.1",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-htmlbars": "^1.0.3",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.4",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.4",
"ember-cli-release": "0.2.8",
"ember-cli-sri": "^1.2.0",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-qunit": "^2.1.0",
"ember-cli-release": "^0.2.9",
"ember-cli-sri": "^2.1.0",
"ember-cli-test-loader": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.0.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-try": "~0.0.8",
"handlebars": "^1.3.0"
"ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3",
"ember-disable-prototype-extensions": "^1.1.0",
"ember-cli-jshint": "^1.0.0",
"loader.js": "^4.0.1"
},
"dependencies": {
"ember-cli-babel": "^5.1.6"
},
"keywords": [
"ember-addon",
Expand All @@ -50,9 +54,6 @@
"action",
"addon"
],
"dependencies": {
"ember-cli-babel": "^5.1.5"
},
"ember-addon": {
"configPath": "tests/dummy/config"
}
Expand Down
13 changes: 13 additions & 0 deletions testem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*jshint node:true*/
module.exports = {
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
};
2 changes: 1 addition & 1 deletion tests/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
"strict": false,
"white": false,
"eqnull": true,
"esnext": true,
"esversion": 6,
"unused": true
}
Loading

0 comments on commit a5c16a1

Please sign in to comment.