ES6 refactor (#409)

* little fix

* little fix /2

* test/clipboard.js refactored

* emitter: emitter --> emitter

* Examples in ES6

* es6

* back to original code

* script > npm test

* script > npm test not necessary

* updating modules

* removing export default
This commit is contained in:
Gabriel Kalani 2017-05-03 01:34:18 -03:00 committed by Zeno Rocha
parent e1394b3b8c
commit 5ab50475e0
5 changed files with 27 additions and 27 deletions

View File

@ -11,31 +11,31 @@
"cut"
],
"dependencies": {
"good-listener": "^1.2.0",
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^1.0.0"
"tiny-emitter": "^2.0.0"
},
"devDependencies": {
"babel-cli": "^6.5.1",
"babel-core": "^6.5.2",
"babel-plugin-transform-es2015-modules-umd": "^6.5.0",
"babel-preset-es2015": "^6.5.0",
"babelify": "^7.2.0",
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"babelify": "^7.3.0",
"bannerify": "Vekat/bannerify#feature-option",
"browserify": "^13.0.0",
"chai": "^3.4.1",
"install": "^0.8.1",
"karma": "^1.3.0",
"karma-browserify": "^5.0.1",
"browserify": "^14.3.0",
"chai": "^3.5.0",
"install": "^0.9.6",
"karma": "^1.6.0",
"karma-browserify": "^5.1.1",
"karma-chai": "^0.1.0",
"karma-mocha": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sinon": "^1.0.4",
"mocha": "^3.1.2",
"phantomjs-prebuilt": "^2.1.4",
"sinon": "^1.17.2",
"uglify-js": "^2.4.24",
"watchify": "^3.4.0"
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"mocha": "^3.3.0",
"phantomjs-prebuilt": "^2.1.14",
"sinon": "^2.2.0",
"uglify-js": "^2.8.22",
"watchify": "^3.9.0"
},
"scripts": {
"build": "npm run build-debug && npm run build-min",

View File

@ -64,7 +64,7 @@ class ClipboardAction {
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
// Move element to the same position vertically
let yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = yPosition + 'px';
this.fakeElem.style.top = `${yPosition}px`;
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;

View File

@ -52,7 +52,7 @@ class Clipboard extends Emitter {
action : this.action(trigger),
target : this.target(trigger),
text : this.text(trigger),
trigger : trigger,
trigger,
emitter : this
});
}

View File

@ -141,7 +141,7 @@ describe('ClipboardAction', () => {
});
let clip = new ClipboardAction({
emitter: emitter,
emitter,
target: document.querySelector('#input')
});
});
@ -156,7 +156,7 @@ describe('ClipboardAction', () => {
});
let clip = new ClipboardAction({
emitter: emitter,
emitter,
target: document.querySelector('#input')
});
});

View File

@ -26,7 +26,7 @@ describe('Clipboard', () => {
describe('#resolveOptions', () => {
before(() => {
global.fn = function() {};
global.fn = () => {};
});
it('should set action as a function', () => {
@ -79,8 +79,8 @@ describe('Clipboard', () => {
it('should throw an exception when target is invalid', done => {
try {
var clipboard = new Clipboard('.btn', {
target: function() {
const clipboard = new Clipboard('.btn', {
target() {
return null;
}
});