From e430d056ad3b6a0cd887bac7f7ff291ee125a400 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Wed, 4 Mar 2020 22:24:24 -0800 Subject: [PATCH] Fix "isSupported" behavior - Closes #666 --- src/clipboard.js | 4 ++-- test/clipboard.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/clipboard.js b/src/clipboard.js index 46530eec..02ebedef 100644 --- a/src/clipboard.js +++ b/src/clipboard.js @@ -86,10 +86,10 @@ class Clipboard extends Emitter { */ static isSupported(action = ['copy', 'cut']) { const actions = (typeof action === 'string') ? [action] : action; - let support = !document.queryCommandSupported; + let support = !!document.queryCommandSupported; actions.forEach((action) => { - support = support && !document.queryCommandSupported(action); + support = support && !!document.queryCommandSupported(action); }); return support; diff --git a/test/clipboard.js b/test/clipboard.js index 9b54932d..7a3b2355 100644 --- a/test/clipboard.js +++ b/test/clipboard.js @@ -110,12 +110,12 @@ describe('Clipboard', () => { describe('#static isSupported', () => { it('should return the support of the given action', () => { - assert.equal(Clipboard.isSupported('copy'), false); - assert.equal(Clipboard.isSupported('cut'), false); + assert.equal(Clipboard.isSupported('copy'), true); + assert.equal(Clipboard.isSupported('cut'), true); }); it('should return the support of the cut and copy actions', () => { - assert.equal(Clipboard.isSupported(), false); + assert.equal(Clipboard.isSupported(), true); }); });