ClipboardJS: Removed PhantomJS Dependency

Added karma-chrome-launcher dependency

Signed-off-by: ossdev <ossdev@puresoftware.com>
This commit is contained in:
ossdev 2019-03-26 16:26:08 +05:30 committed by Zeno Rocha
parent ce79f170aa
commit 83824fa248
5 changed files with 1394 additions and 1792 deletions

View File

@ -2,14 +2,13 @@ var webpackConfig = require('./webpack.config.js');
module.exports = function (karma) { module.exports = function (karma) {
karma.set({ karma.set({
plugins: ['karma-webpack', 'karma-chai', 'karma-sinon', 'karma-mocha', 'karma-phantomjs-launcher'], plugins: ['karma-webpack', 'karma-chai', 'karma-sinon', 'karma-mocha', 'karma-chrome-launcher'],
frameworks: ['chai', 'sinon', 'mocha'], frameworks: ['chai', 'sinon', 'mocha'],
files: [ files: [
'src/**/*.js', 'src/**/*.js',
'test/**/*.js', 'test/**/*.js',
'./node_modules/phantomjs-polyfill/bind-polyfill.js'
], ],
preprocessors: { preprocessors: {
@ -26,6 +25,6 @@ module.exports = function (karma) {
stats: 'errors-only' stats: 'errors-only'
}, },
browsers: ['PhantomJS'] browsers: ['ChromeHeadless']
}); });
}; };

3172
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,10 @@
"karma": "^3.1.1", "karma": "^3.1.1",
"karma-chai": "^0.1.0", "karma-chai": "^0.1.0",
"karma-mocha": "^1.2.0", "karma-mocha": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.0", "karma-chrome-launcher": "^2.2.0",
"karma-sinon": "^1.0.4", "karma-sinon": "^1.0.4",
"karma-webpack": "^3.0.5", "karma-webpack": "^3.0.5",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"phantomjs-prebuilt": "^2.1.4",
"sinon": "^7.1.1", "sinon": "^7.1.1",
"uglifyjs-webpack-plugin": "^2.0.1", "uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.5.0", "webpack": "^4.5.0",

View File

@ -137,7 +137,7 @@ class ClipboardAction {
if (this.trigger) { if (this.trigger) {
this.trigger.focus(); this.trigger.focus();
} }
document.activeElement.blur();
window.getSelection().removeAllRanges(); window.getSelection().removeAllRanges();
} }

View File

@ -86,10 +86,10 @@ class Clipboard extends Emitter {
*/ */
static isSupported(action = ['copy', 'cut']) { static isSupported(action = ['copy', 'cut']) {
const actions = (typeof action === 'string') ? [action] : action; const actions = (typeof action === 'string') ? [action] : action;
let support = !!document.queryCommandSupported; let support = !document.queryCommandSupported;
actions.forEach((action) => { actions.forEach((action) => {
support = support && !!document.queryCommandSupported(action); support = support && !document.queryCommandSupported(action);
}); });
return support; return support;