mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
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:
parent
e1394b3b8c
commit
5ab50475e0
40
package.json
40
package.json
@ -11,31 +11,31 @@
|
|||||||
"cut"
|
"cut"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"good-listener": "^1.2.0",
|
"good-listener": "^1.2.2",
|
||||||
"select": "^1.1.2",
|
"select": "^1.1.2",
|
||||||
"tiny-emitter": "^1.0.0"
|
"tiny-emitter": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.5.1",
|
"babel-cli": "^6.24.1",
|
||||||
"babel-core": "^6.5.2",
|
"babel-core": "^6.24.1",
|
||||||
"babel-plugin-transform-es2015-modules-umd": "^6.5.0",
|
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
|
||||||
"babel-preset-es2015": "^6.5.0",
|
"babel-preset-es2015": "^6.24.1",
|
||||||
"babelify": "^7.2.0",
|
"babelify": "^7.3.0",
|
||||||
"bannerify": "Vekat/bannerify#feature-option",
|
"bannerify": "Vekat/bannerify#feature-option",
|
||||||
"browserify": "^13.0.0",
|
"browserify": "^14.3.0",
|
||||||
"chai": "^3.4.1",
|
"chai": "^3.5.0",
|
||||||
"install": "^0.8.1",
|
"install": "^0.9.6",
|
||||||
"karma": "^1.3.0",
|
"karma": "^1.6.0",
|
||||||
"karma-browserify": "^5.0.1",
|
"karma-browserify": "^5.1.1",
|
||||||
"karma-chai": "^0.1.0",
|
"karma-chai": "^0.1.0",
|
||||||
"karma-mocha": "^1.2.0",
|
"karma-mocha": "^1.3.0",
|
||||||
"karma-phantomjs-launcher": "^1.0.0",
|
"karma-phantomjs-launcher": "^1.0.4",
|
||||||
"karma-sinon": "^1.0.4",
|
"karma-sinon": "^1.0.5",
|
||||||
"mocha": "^3.1.2",
|
"mocha": "^3.3.0",
|
||||||
"phantomjs-prebuilt": "^2.1.4",
|
"phantomjs-prebuilt": "^2.1.14",
|
||||||
"sinon": "^1.17.2",
|
"sinon": "^2.2.0",
|
||||||
"uglify-js": "^2.4.24",
|
"uglify-js": "^2.8.22",
|
||||||
"watchify": "^3.4.0"
|
"watchify": "^3.9.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run build-debug && npm run build-min",
|
"build": "npm run build-debug && npm run build-min",
|
||||||
|
@ -64,7 +64,7 @@ class ClipboardAction {
|
|||||||
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
|
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
|
||||||
// Move element to the same position vertically
|
// Move element to the same position vertically
|
||||||
let yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
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.setAttribute('readonly', '');
|
||||||
this.fakeElem.value = this.text;
|
this.fakeElem.value = this.text;
|
||||||
|
@ -52,7 +52,7 @@ class Clipboard extends Emitter {
|
|||||||
action : this.action(trigger),
|
action : this.action(trigger),
|
||||||
target : this.target(trigger),
|
target : this.target(trigger),
|
||||||
text : this.text(trigger),
|
text : this.text(trigger),
|
||||||
trigger : trigger,
|
trigger,
|
||||||
emitter : this
|
emitter : this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ describe('ClipboardAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let clip = new ClipboardAction({
|
let clip = new ClipboardAction({
|
||||||
emitter: emitter,
|
emitter,
|
||||||
target: document.querySelector('#input')
|
target: document.querySelector('#input')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -156,7 +156,7 @@ describe('ClipboardAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let clip = new ClipboardAction({
|
let clip = new ClipboardAction({
|
||||||
emitter: emitter,
|
emitter,
|
||||||
target: document.querySelector('#input')
|
target: document.querySelector('#input')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -26,7 +26,7 @@ describe('Clipboard', () => {
|
|||||||
|
|
||||||
describe('#resolveOptions', () => {
|
describe('#resolveOptions', () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
global.fn = function() {};
|
global.fn = () => {};
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set action as a function', () => {
|
it('should set action as a function', () => {
|
||||||
@ -79,8 +79,8 @@ describe('Clipboard', () => {
|
|||||||
|
|
||||||
it('should throw an exception when target is invalid', done => {
|
it('should throw an exception when target is invalid', done => {
|
||||||
try {
|
try {
|
||||||
var clipboard = new Clipboard('.btn', {
|
const clipboard = new Clipboard('.btn', {
|
||||||
target: function() {
|
target() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user