Update v1.0.6
This commit is contained in:
441
public/filemanager/scripts/zeroclipboard/test/core/api.tests.js
vendored
Normal file
441
public/filemanager/scripts/zeroclipboard/test/core/api.tests.js
vendored
Normal file
@@ -0,0 +1,441 @@
|
||||
/*global ZeroClipboard, _globalConfig:true, _flashState, _clipData, _clipDataFormatMap, _deleteOwnProperties */
|
||||
|
||||
(function(module, test) {
|
||||
"use strict";
|
||||
|
||||
// Helper functions
|
||||
var TestUtils = {
|
||||
getHtmlBridge: function() {
|
||||
return document.getElementById("global-zeroclipboard-html-bridge");
|
||||
}
|
||||
};
|
||||
|
||||
var originalConfig, originalFlashDetect;
|
||||
|
||||
|
||||
module("core/api.js unit tests - state");
|
||||
|
||||
|
||||
test("`state` produces expected result", function(assert) {
|
||||
assert.expect(8);
|
||||
|
||||
// Act
|
||||
var result = ZeroClipboard.state();
|
||||
|
||||
// Assert
|
||||
assert.deepEqual(Object.keys(result), ["browser", "flash", "zeroclipboard"], "Has all expected keys");
|
||||
assert.strictEqual(typeof result.browser, "object", ".browser is an object");
|
||||
assert.notStrictEqual(result.browser, null, ".browser is a non-null object");
|
||||
assert.strictEqual(typeof result.flash, "object", ".flash is an object");
|
||||
assert.notStrictEqual(result.flash, null, ".flash is a non-null object");
|
||||
assert.strictEqual(typeof result.zeroclipboard, "object", ".zeroclipboard is an object");
|
||||
assert.notStrictEqual(result.zeroclipboard, null, ".zeroclipboard is a non-null object");
|
||||
assert.deepEqual(Object.keys(result.zeroclipboard), ["version", "config"], ".zeroclipboard has all expected keys");
|
||||
});
|
||||
|
||||
|
||||
module("core/api.js unit tests - config", {
|
||||
setup: function() {
|
||||
originalConfig = ZeroClipboard.config();
|
||||
},
|
||||
teardown: function() {
|
||||
_globalConfig = originalConfig;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("`swfPath` finds the expected default URL", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Assert, act, assert
|
||||
var rootOrigin = window.location.protocol + "//" + window.location.host + "/";
|
||||
var indexOfTest = window.location.pathname.toLowerCase().indexOf("/test/");
|
||||
var rootDir = window.location.pathname.slice(1, indexOfTest + 1);
|
||||
var rootPath = rootOrigin + rootDir;
|
||||
//var stateJsUrl = rootPath + "src/js/core/state.js";
|
||||
// This is, for the record, a totally incorrect path due to being the development
|
||||
// file structure but it IS the correct URL based on calculated assumption of using
|
||||
// the built distributable versions of the library
|
||||
var swfPathBasedOnStateJsPath = rootPath + "src/js/core/ZeroClipboard.swf";
|
||||
|
||||
// Test that the client has the expected default URL [even if it's not correct]
|
||||
assert.strictEqual(ZeroClipboard.config("swfPath"), swfPathBasedOnStateJsPath);
|
||||
});
|
||||
|
||||
|
||||
test("Changing `trustedDomains` works", function(assert) {
|
||||
assert.expect(5);
|
||||
|
||||
// Arrange
|
||||
var currentHost = window.location.host;
|
||||
var originalValue = currentHost ? [currentHost] : [];
|
||||
var updatedValue = currentHost ? [currentHost, "otherDomain.com"] : ["otherDomain.com"];
|
||||
|
||||
// Assert, act, assert
|
||||
// Test that the client has the default value
|
||||
assert.deepEqual(ZeroClipboard.config("trustedDomains"), originalValue);
|
||||
assert.deepEqual(ZeroClipboard.config().trustedDomains, originalValue);
|
||||
// Change the value
|
||||
var updatedConfig = ZeroClipboard.config({ trustedDomains: updatedValue });
|
||||
// Test that the client has the changed value
|
||||
assert.deepEqual(updatedConfig.trustedDomains, updatedValue);
|
||||
assert.deepEqual(ZeroClipboard.config("trustedDomains"), updatedValue);
|
||||
assert.deepEqual(ZeroClipboard.config().trustedDomains, updatedValue);
|
||||
});
|
||||
|
||||
|
||||
test("Some config values are ignored if SWF is actively embedded", function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
// Arrange
|
||||
var _swfPath = ZeroClipboard.config("swfPath");
|
||||
var expectedBefore = {
|
||||
swfPath: _swfPath,
|
||||
trustedDomains: window.location.host ? [window.location.host] : [],
|
||||
cacheBust: true,
|
||||
forceEnhancedClipboard: false,
|
||||
flashLoadTimeout: 30000,
|
||||
autoActivate: true,
|
||||
containerId: "global-zeroclipboard-html-bridge",
|
||||
containerClass: "global-zeroclipboard-container",
|
||||
swfObjectId: "global-zeroclipboard-flash-bridge",
|
||||
hoverClass: "zeroclipboard-is-hover",
|
||||
activeClass: "zeroclipboard-is-active",
|
||||
|
||||
// These configuration values CAN be modified while a SWF is actively embedded.
|
||||
bubbleEvents: true,
|
||||
forceHandCursor: false,
|
||||
title: null,
|
||||
zIndex: 999999999
|
||||
};
|
||||
var expectedAfter = {
|
||||
swfPath: _swfPath,
|
||||
trustedDomains: window.location.host ? [window.location.host] : [],
|
||||
cacheBust: true,
|
||||
forceEnhancedClipboard: false,
|
||||
flashLoadTimeout: 30000,
|
||||
autoActivate: true,
|
||||
containerId: "global-zeroclipboard-html-bridge",
|
||||
containerClass: "global-zeroclipboard-container",
|
||||
swfObjectId: "global-zeroclipboard-flash-bridge",
|
||||
hoverClass: "zeroclipboard-is-hover",
|
||||
activeClass: "zeroclipboard-is-active",
|
||||
|
||||
// These configuration values CAN be modified while a SWF is actively embedded.
|
||||
bubbleEvents: false,
|
||||
forceHandCursor: true,
|
||||
title: "test",
|
||||
zIndex: 1000
|
||||
};
|
||||
|
||||
// Act
|
||||
var actualBefore = ZeroClipboard.config();
|
||||
|
||||
_flashState.bridge = {};
|
||||
|
||||
var actualAfter = ZeroClipboard.config({
|
||||
swfPath: "/path/to/test.swf",
|
||||
trustedDomains: ["test.domain.com"],
|
||||
cacheBust: false,
|
||||
forceEnhancedClipboard: true,
|
||||
flashLoadTimeout: 15000,
|
||||
autoActivate: false,
|
||||
containerId: "test-id",
|
||||
containerClass: "test-class",
|
||||
swfObjectId: "test-swf",
|
||||
hoverClass: "test-hover",
|
||||
activeClass: "test-active",
|
||||
|
||||
// These configuration values CAN be modified while a SWF is actively embedded.
|
||||
bubbleEvents: false,
|
||||
forceHandCursor: true,
|
||||
title: "test",
|
||||
zIndex: 1000
|
||||
});
|
||||
|
||||
// Assert
|
||||
assert.deepEqual(actualBefore, expectedBefore, "Original config is as expected");
|
||||
assert.deepEqual(actualAfter, expectedAfter, "Updated config is as expected");
|
||||
});
|
||||
|
||||
|
||||
module("core/api.js unit tests - clipboard", {
|
||||
teardown: function() {
|
||||
_deleteOwnProperties(_clipData);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("`setData` works", function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
// Assert, Act, repeat ad nauseam
|
||||
assert.deepEqual(_clipData, {}, "`_clipData` is empty");
|
||||
|
||||
ZeroClipboard.setData("text/plain", "zc4evar");
|
||||
assert.deepEqual(_clipData, { "text/plain": "zc4evar" }, "`_clipData` contains expected text");
|
||||
|
||||
ZeroClipboard.setData("text/x-markdown", "**ZeroClipboard**");
|
||||
assert.deepEqual(_clipData, { "text/plain": "zc4evar", "text/x-markdown": "**ZeroClipboard**" }, "`_clipData` contains expected text and custom format");
|
||||
|
||||
ZeroClipboard.setData({ "text/html": "<b>Win</b>" });
|
||||
assert.deepEqual(_clipData, { "text/html": "<b>Win</b>" }, "`_clipData` contains expected HTML and cleared out old data because an object was passed in");
|
||||
});
|
||||
|
||||
|
||||
test("`clearData` works", function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
// Assert
|
||||
assert.deepEqual(_clipData, {}, "`_clipData` is empty");
|
||||
|
||||
// Arrange & Assert
|
||||
_clipData["text/plain"] = "zc4evar";
|
||||
_clipData["text/html"] = "<b>Win</b>";
|
||||
_clipData["text/x-markdown"] = "**ZeroClipboard**";
|
||||
assert.deepEqual(_clipData, {
|
||||
"text/plain": "zc4evar",
|
||||
"text/html": "<b>Win</b>",
|
||||
"text/x-markdown": "**ZeroClipboard**"
|
||||
}, "`_clipData` contains all expected data");
|
||||
|
||||
// Act & Assert
|
||||
ZeroClipboard.clearData("text/html");
|
||||
assert.deepEqual(_clipData, {
|
||||
"text/plain": "zc4evar",
|
||||
"text/x-markdown": "**ZeroClipboard**"
|
||||
}, "`_clipData` had 'text/html' successfully removed");
|
||||
|
||||
// Act & Assert
|
||||
ZeroClipboard.clearData();
|
||||
assert.deepEqual(_clipData, {}, "`_clipData` had all data successfully removed");
|
||||
});
|
||||
|
||||
|
||||
module("core/api.js unit tests - flash", {
|
||||
setup: function() {
|
||||
// Store
|
||||
originalFlashDetect = ZeroClipboard.isFlashUnusable;
|
||||
// Modify
|
||||
ZeroClipboard.isFlashUnusable = function() {
|
||||
return false;
|
||||
};
|
||||
},
|
||||
teardown: function() {
|
||||
// Restore
|
||||
ZeroClipboard.isFlashUnusable = originalFlashDetect;
|
||||
ZeroClipboard.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("Flash object is ready after emitting `ready`", function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
// Arrange
|
||||
ZeroClipboard.isFlashUnusable = function() {
|
||||
return false;
|
||||
};
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Assert, act, assert
|
||||
assert.strictEqual(_flashState.ready, false);
|
||||
// `emit`-ing event handlers are async (generally) but the internal `ready` state is set synchronously
|
||||
ZeroClipboard.emit("ready");
|
||||
assert.strictEqual(_flashState.ready, true);
|
||||
});
|
||||
|
||||
|
||||
test("Object has a title", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button");
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(TestUtils.getHtmlBridge().getAttribute("title"), "Click me to copy to clipboard.");
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Object has no title", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button_no_title");
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
|
||||
// Assert
|
||||
assert.ok(!TestUtils.getHtmlBridge().getAttribute("title"));
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Object has data-clipboard-text", function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button");
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
var pendingText = ZeroClipboard.emit("copy");
|
||||
|
||||
// Assert
|
||||
assert.deepEqual(_clipData, { "text/plain": "Copy me!" });
|
||||
assert.deepEqual(pendingText, { "text": "Copy me!" });
|
||||
assert.deepEqual(_clipDataFormatMap, { "text": "text/plain" });
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Object has data-clipboard-target textarea", function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button_textarea_text");
|
||||
var expectedText =
|
||||
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n"+
|
||||
"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n"+
|
||||
"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n"+
|
||||
"consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n"+
|
||||
"cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n"+
|
||||
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
var pendingText = ZeroClipboard.emit("copy");
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(_clipData["text/plain"].replace(/\r\n/g, "\n"), expectedText);
|
||||
assert.strictEqual(pendingText.text.replace(/\r\n/g, "\n"), expectedText);
|
||||
assert.deepEqual(_clipDataFormatMap, { "text": "text/plain" });
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Object has data-clipboard-target pre", function(assert) {
|
||||
assert.expect(5);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button_pre_text");
|
||||
var expectedText =
|
||||
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n"+
|
||||
"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n"+
|
||||
"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n"+
|
||||
"consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n"+
|
||||
"cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n"+
|
||||
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
var expectedHtml =
|
||||
"<pre id=\"clipboard_pre\">"+
|
||||
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n"+
|
||||
"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n"+
|
||||
"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n"+
|
||||
"consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n"+
|
||||
"cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n"+
|
||||
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum."+
|
||||
"</pre>";
|
||||
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
var pendingText = ZeroClipboard.emit("copy");
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(_clipData["text/plain"].replace(/\r\n/g, "\n"), expectedText);
|
||||
assert.strictEqual(
|
||||
_clipData["text/html"]
|
||||
.replace(/\r\n/g, "\n")
|
||||
.replace(/<\/?pre(?:\s+[^>]*)?>/gi, function($0) { return $0.toLowerCase(); }),
|
||||
expectedHtml
|
||||
);
|
||||
assert.strictEqual(pendingText.text.replace(/\r\n/g, "\n"), expectedText);
|
||||
assert.strictEqual(
|
||||
pendingText.html
|
||||
.replace(/\r\n/g, "\n")
|
||||
.replace(/<\/?pre(?:\s+[^>]*)?>/gi, function($0) { return $0.toLowerCase(); }),
|
||||
expectedHtml
|
||||
);
|
||||
assert.deepEqual(_clipDataFormatMap, { "text": "text/plain", "html": "text/html" });
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Object has data-clipboard-target input", function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button_input_text");
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
var pendingText = ZeroClipboard.emit("copy");
|
||||
|
||||
// Assert
|
||||
assert.deepEqual(_clipData, { "text/plain": "Clipboard Text" });
|
||||
assert.deepEqual(pendingText, { "text": "Clipboard Text" });
|
||||
assert.deepEqual(_clipDataFormatMap, { "text": "text/plain" });
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Object doesn't have data-clipboard-text", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button_no_text");
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
|
||||
// Assert
|
||||
assert.ok(!TestUtils.getHtmlBridge().getAttribute("data-clipboard-text"));
|
||||
|
||||
// Revert
|
||||
ZeroClipboard.deactivate();
|
||||
});
|
||||
|
||||
|
||||
test("Calculations based on borderWidth never return NaN", function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
// Arrange
|
||||
var currentEl = document.getElementById("d_clip_button");
|
||||
ZeroClipboard.create();
|
||||
|
||||
// Act
|
||||
ZeroClipboard.activate(currentEl);
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(/^-?[0-9\.]+px$/.test(TestUtils.getHtmlBridge().style.top), true);
|
||||
assert.strictEqual(/^-?[0-9\.]+px$/.test(TestUtils.getHtmlBridge().style.left), true);
|
||||
assert.strictEqual(/^-?[0-9\.]+px$/.test(TestUtils.getHtmlBridge().style.width), true);
|
||||
assert.strictEqual(/^-?[0-9\.]+px$/.test(TestUtils.getHtmlBridge().style.height), true);
|
||||
});
|
||||
|
||||
})(QUnit.module, QUnit.test);
|
||||
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ZeroClipboard unit tests: core/api.js</title>
|
||||
<link rel="stylesheet" href="../../node_modules/qunitjs/qunit/qunit.css">
|
||||
<script src="../../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script>
|
||||
// Polyfill in future functionality: https://github.com/jquery/qunit/issues/490
|
||||
if (!QUnit.assert.expect) {
|
||||
QUnit.assert.expect = QUnit.expect;
|
||||
}
|
||||
|
||||
// Require `expect` calls
|
||||
QUnit.config.requireExpects = true;
|
||||
|
||||
// Prevent against Firefox/Firebug failing the global pollution check
|
||||
var getInterface = null;
|
||||
|
||||
// Prevent against failing the global pollution check in all browsers other than IE
|
||||
if (typeof window.ActiveXObject === "undefined") {
|
||||
window.ActiveXObject = null;
|
||||
}
|
||||
|
||||
// Prevent against Flash's ExternalInterface failing the global pollution check (seems to be only in IE < 11)
|
||||
var __flash__arrayToXML = null,
|
||||
__flash__argumentsToXML = null,
|
||||
__flash__objectToXML = null,
|
||||
__flash__escapeXML = null,
|
||||
__flash__toXML = null,
|
||||
__flash__addCallback = null,
|
||||
__flash__removeCallback = null,
|
||||
__flash__request = null;
|
||||
</script>
|
||||
<script src="../../src/js/shared/state.js"></script>
|
||||
<script src="../../src/js/shared/private.js"></script>
|
||||
<script src="../../src/js/core/state.js"></script>
|
||||
<script src="../../src/js/core/private.js"></script>
|
||||
<script src="../../src/js/core/api.js"></script>
|
||||
<script src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script src="api.tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
<p>
|
||||
<button id="d_clip_button" class="my_clip_button" title="Click me to copy to clipboard." data-clipboard-text="Copy me!"><b>Copy To Clipboard...</b></button>
|
||||
</p>
|
||||
<p>
|
||||
<button id="d_clip_button_no_title" class="my_clip_button" data-clipboard-text="Copy me!"><b>Copy To Clipboard...</b></button>
|
||||
</p>
|
||||
<p>
|
||||
<button id="d_clip_button_no_text" class="my_clip_button"><b>Copy To Clipboard...</b></button>
|
||||
</p>
|
||||
<p>
|
||||
<button id="d_clip_button_input_text" class="my_clip_button" data-clipboard-target="clipboard_text"><b>Copy To Clipboard...</b></button>
|
||||
</p>
|
||||
<p>
|
||||
<button id="d_clip_button_textarea_text" class="my_clip_button" data-clipboard-target="clipboard_textarea"><b>Copy To Clipboard...</b></button>
|
||||
</p>
|
||||
<button id="d_clip_button_pre_text" class="my_clip_button" data-clipboard-target="clipboard_pre"><b>Copy To Clipboard...</b></button>
|
||||
<input type="text" id="clipboard_text" value="Clipboard Text"/>
|
||||
<textarea id="clipboard_textarea">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea>
|
||||
<pre id="clipboard_pre">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
494
public/filemanager/scripts/zeroclipboard/test/core/private.tests.js
vendored
Normal file
494
public/filemanager/scripts/zeroclipboard/test/core/private.tests.js
vendored
Normal file
@@ -0,0 +1,494 @@
|
||||
/*global _flashState:true, _currentElement:true, _copyTarget:true, _extend, _getStyle, _removeClass, _addClass, _vars, _cacheBust, _extractDomain, _determineScriptAccess, _mapClipDataToFlash, _mapClipResultsFromFlash, _createEvent, _preprocessEvent, _getRelatedTarget, _shouldPerformAsync, _dispatchCallback, _detectFlashSupport */
|
||||
|
||||
(function(module, test) {
|
||||
"use strict";
|
||||
|
||||
var mimeType, ax, flashState;
|
||||
|
||||
|
||||
module("core/private.js unit tests - utils");
|
||||
|
||||
|
||||
test("`_getStyle` returns computed styles", function(assert) {
|
||||
assert.expect(5);
|
||||
|
||||
// Arrange
|
||||
var pointerEl = $("a.no_cursor_style")[0];
|
||||
var nonPointerEl = $("a.no_pointer_anchor")[0];
|
||||
var zIndexAutoEl = $(".zindex-auto")[0];
|
||||
var clipButtonEl = $("#d_clip_button")[0];
|
||||
var bigBorderEl = $(".big-border")[0];
|
||||
|
||||
// Act
|
||||
var pointerElComputedCursor = _getStyle(pointerEl, "cursor");
|
||||
var nonPointerElComputedCursor = _getStyle(nonPointerEl, "cursor");
|
||||
var zIndexAutoElComputedZIndex = _getStyle(zIndexAutoEl, "z-index");
|
||||
var clipButtonElComputedBorderLeftWidth = _getStyle(clipButtonEl, "border-left-width");
|
||||
var bigBorderElComputedBorderLeftWith = _getStyle(bigBorderEl, "border-left-width");
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(pointerElComputedCursor, "pointer");
|
||||
assert.notStrictEqual(nonPointerElComputedCursor, "pointer");
|
||||
// Returns 0 in IE7, "auto" everywhere else
|
||||
assert.strictEqual(/^(?:auto|0)$/.test(zIndexAutoElComputedZIndex), true);
|
||||
// This varies between "0px" and "3px" depending on the browser (WAT?)
|
||||
assert.strictEqual(/^[0-3]px$/.test(clipButtonElComputedBorderLeftWidth), true);
|
||||
assert.strictEqual(bigBorderElComputedBorderLeftWith, "10px");
|
||||
});
|
||||
|
||||
|
||||
test("`_removeClass` removes classes from element", function(assert) {
|
||||
assert.expect(5);
|
||||
|
||||
// Arrange
|
||||
var div = $("<div></div>").addClass("class1 class-2 class_3")[0];
|
||||
|
||||
// Act & Assert
|
||||
_removeClass(div, "class1");
|
||||
assert.strictEqual(div.className, "class-2 class_3");
|
||||
|
||||
_removeClass(div, "classd");
|
||||
assert.strictEqual(div.className, "class-2 class_3");
|
||||
|
||||
_removeClass(div, "class-2");
|
||||
assert.strictEqual(div.className, "class_3");
|
||||
|
||||
_removeClass(div, "class_3");
|
||||
assert.strictEqual(div.className, "");
|
||||
|
||||
_removeClass(div, "class-3");
|
||||
assert.strictEqual(div.className, "");
|
||||
|
||||
div = null;
|
||||
});
|
||||
|
||||
|
||||
test("`_removeClass` doesn't remove partial class names", function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
// Arrange
|
||||
var div = $("<div></div>").addClass("class1 class-2 class_3")[0];
|
||||
|
||||
// Act & Assert
|
||||
_removeClass(div, "ass");
|
||||
assert.strictEqual(div.className, "class1 class-2 class_3");
|
||||
|
||||
_removeClass(div, "-2");
|
||||
assert.strictEqual(div.className, "class1 class-2 class_3");
|
||||
|
||||
_removeClass(div, "_3");
|
||||
assert.strictEqual(div.className, "class1 class-2 class_3");
|
||||
|
||||
div = null;
|
||||
});
|
||||
|
||||
|
||||
test("`_addClass` adds a class name", function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
// Arrange
|
||||
var div = $("<div></div>")[0];
|
||||
|
||||
// Act & Assert
|
||||
_addClass(div, "class1");
|
||||
assert.strictEqual(div.className, "class1");
|
||||
|
||||
_addClass(div, "class-2");
|
||||
assert.strictEqual(div.className, "class1 class-2");
|
||||
|
||||
_addClass(div, "class_3");
|
||||
assert.strictEqual(div.className, "class1 class-2 class_3");
|
||||
|
||||
_addClass(div, "class_3");
|
||||
assert.strictEqual(div.className, "class1 class-2 class_3");
|
||||
|
||||
div = null;
|
||||
});
|
||||
|
||||
|
||||
test("`_vars` builds FlashVars", function(assert) {
|
||||
assert.expect(6);
|
||||
|
||||
// Arrange
|
||||
var clipOptionsEmpty = {};
|
||||
var clipOptionsTrustedDomains = {
|
||||
trustedDomains: ["*"]
|
||||
};
|
||||
var clipOptionsEnhancedClipboardFalse = {
|
||||
forceEnhancedClipboard: false
|
||||
};
|
||||
var clipOptionsEnhancedClipboardTrue = {
|
||||
forceEnhancedClipboard: true
|
||||
};
|
||||
var clipOptionsTrustedDomainsPlusEnhancedClipboardFalse = {
|
||||
trustedDomains: ["*"],
|
||||
forceEnhancedClipboard: false
|
||||
};
|
||||
var clipOptionsTrustedDomainsPlusEnhancedClipboardTrue = {
|
||||
trustedDomains: ["*"],
|
||||
forceEnhancedClipboard: true
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
assert.strictEqual(_vars(clipOptionsEmpty), "");
|
||||
assert.strictEqual(_vars(clipOptionsTrustedDomains), "trustedOrigins=*");
|
||||
assert.strictEqual(_vars(clipOptionsEnhancedClipboardFalse), "");
|
||||
assert.strictEqual(_vars(clipOptionsEnhancedClipboardTrue), "forceEnhancedClipboard=true");
|
||||
assert.strictEqual(_vars(clipOptionsTrustedDomainsPlusEnhancedClipboardFalse), "trustedOrigins=*");
|
||||
assert.strictEqual(_vars(clipOptionsTrustedDomainsPlusEnhancedClipboardTrue), "trustedOrigins=*&forceEnhancedClipboard=true");
|
||||
});
|
||||
|
||||
|
||||
test("`_cacheBust` adds cache-buster appropriately", function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
// Arrange
|
||||
var pathWithoutQuery = "path.com/z.swf";
|
||||
var pathWithQuery = "path.com/z.swf?q=jon";
|
||||
|
||||
// Act & Assert
|
||||
assert.strictEqual(_cacheBust(pathWithoutQuery).indexOf("?noCache="), 0);
|
||||
assert.strictEqual(_cacheBust(pathWithQuery).indexOf("&noCache="), 0);
|
||||
});
|
||||
|
||||
|
||||
test("`_cacheBust` can be disabled", function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
// Arrange
|
||||
var pathWithoutQuery = "path.com/z.swf";
|
||||
var pathWithQuery = "path.com/z.swf?q=jon";
|
||||
var options = {
|
||||
cacheBust: false
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
assert.strictEqual(_cacheBust(pathWithoutQuery, options), "");
|
||||
assert.strictEqual(_cacheBust(pathWithQuery, options), "");
|
||||
});
|
||||
|
||||
|
||||
test("`_extractDomain` extracts domains from origins and URLs", function(assert) {
|
||||
assert.expect(20);
|
||||
|
||||
// Arrange
|
||||
var inputToExpectedMap = {
|
||||
"": null,
|
||||
" ": null,
|
||||
"ZeroClipboard.swf": null,
|
||||
"js/ZeroClipboard.swf": null,
|
||||
"/js/ZeroClipboard.swf": null,
|
||||
"/zeroclipboard/zeroclipboard/": null,
|
||||
"zeroclipboard/zeroclipboard/": null,
|
||||
"*": "*",
|
||||
"github.com": "github.com",
|
||||
"http://github.com": "github.com",
|
||||
"https://github.com": "github.com",
|
||||
"github.com:80": "github.com:80",
|
||||
"http://github.com:80": "github.com:80",
|
||||
"https://github.com:443": "github.com:443",
|
||||
"http://github.com/zeroclipboard/zeroclipboard/": "github.com",
|
||||
"https://github.com/zeroclipboard/zeroclipboard/": "github.com",
|
||||
"http://github.com:80/zeroclipboard/zeroclipboard/": "github.com:80",
|
||||
"https://github.com:443/zeroclipboard/zeroclipboard/": "github.com:443"
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
assert.strictEqual(_extractDomain(undefined), null, "Processing: `undefined`");
|
||||
assert.strictEqual(_extractDomain(null), null, "Processing: `null`");
|
||||
for (var originOrUrl in inputToExpectedMap) {
|
||||
if (inputToExpectedMap.hasOwnProperty(originOrUrl)) {
|
||||
assert.strictEqual(_extractDomain(originOrUrl), inputToExpectedMap[originOrUrl], "Processing: \"" + originOrUrl + "\"");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("`_determineScriptAccess` determines the appropriate script access level", function(assert) {
|
||||
// Arrange
|
||||
var i, len, tmp;
|
||||
var currentDomain = window.location.host || "localhost";
|
||||
var _globalConfig = {
|
||||
swfPath: "ZeroClipboard.swf",
|
||||
trustedDomains: [currentDomain]
|
||||
};
|
||||
var inputToExpectedMap = [
|
||||
// Same-domain SWF
|
||||
{ args: [currentDomain, _globalConfig], result: "sameDomain" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { trustedDomains: [] })], result: "never" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { trustedDomains: ["*"] })], result: "always" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { trustedDomains: [currentDomain, "otherDomain.com"] })], result: "always" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { trustedDomains: ["otherDomain.com"] })], result: "never" },
|
||||
// Cross-domain SWF
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { swfPath: "//otherDomain.com/ZeroClipboard.swf" })], result: "always" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { swfPath: "//otherDomain.com/ZeroClipboard.swf", trustedDomains: [] })], result: "never" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { swfPath: "//otherDomain.com/ZeroClipboard.swf", trustedDomains: ["*"] })], result: "always" },
|
||||
{ args: [currentDomain, _extend({}, _globalConfig, { swfPath: "//otherDomain.com/ZeroClipboard.swf", trustedDomains: [currentDomain, "otherDomain.com"] })], result: "always" }
|
||||
];
|
||||
|
||||
// Act & Assert
|
||||
assert.expect(9);
|
||||
for (i = 0, len = inputToExpectedMap.length; i < len; i++) {
|
||||
tmp = inputToExpectedMap[i];
|
||||
assert.strictEqual(_determineScriptAccess.apply(this, tmp.args), tmp.result, "Processing: " + JSON.stringify(tmp));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("`_mapClipDataToFlash` works", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Arrange
|
||||
var clipData = {
|
||||
"text/plain": "Zero",
|
||||
"text/html": "<b>Zero</b>"
|
||||
};
|
||||
var expectedOutput = {
|
||||
data: {
|
||||
"text": "Zero",
|
||||
"html": "<b>Zero</b>"
|
||||
},
|
||||
formatMap: {
|
||||
"text": "text/plain",
|
||||
"html": "text/html"
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
var actual = _mapClipDataToFlash(clipData);
|
||||
|
||||
// Assert
|
||||
assert.deepEqual(actual, expectedOutput, "Converted keys to Flash-friendly names and provided a format map");
|
||||
});
|
||||
|
||||
|
||||
test("`_mapClipResultsFromFlash` works", function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
// Arrange
|
||||
var clipResults = {
|
||||
type: "aftercopy",
|
||||
success: {
|
||||
"text": true,
|
||||
"html": false
|
||||
},
|
||||
data: {
|
||||
"text": "Zero",
|
||||
"html": "<b>Zero</b>"
|
||||
}
|
||||
};
|
||||
var formatMap = {
|
||||
"text": "text/plain",
|
||||
"html": "text/html"
|
||||
};
|
||||
var expectedOutput = {
|
||||
type: "aftercopy",
|
||||
success: {
|
||||
"text/plain": true,
|
||||
"text/html": false
|
||||
},
|
||||
data: {
|
||||
"text/plain": "Zero",
|
||||
"text/html": "<b>Zero</b>"
|
||||
}
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
var thisWontChange = _mapClipResultsFromFlash(clipResults, null);
|
||||
assert.deepEqual(thisWontChange, clipResults, "Should return the original object if it cannot map it");
|
||||
|
||||
// Act & Assert
|
||||
var revisedClipResults = _mapClipResultsFromFlash(clipResults, formatMap);
|
||||
assert.deepEqual(revisedClipResults, expectedOutput, "Should reverse the key mapping process");
|
||||
});
|
||||
|
||||
|
||||
test("`_createEvent` works", function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var actual = _createEvent("ready");
|
||||
|
||||
assert.strictEqual(typeof actual === "object" && actual != null, true, "Returns non-null object");
|
||||
assert.strictEqual(actual.type, "ready", "Object has a `type` property of 'ready'");
|
||||
|
||||
// etc.
|
||||
});
|
||||
|
||||
|
||||
// Tests fix for: https://github.com/zeroclipboard/zeroclipboard/issues/467
|
||||
test("`_copyTarget` element is handled appropriately", function(assert) {
|
||||
assert.expect(18);
|
||||
|
||||
// Arrange
|
||||
var el1 = $("#d_clip_button")[0];
|
||||
var el2 = $("#goodTargetId")[0];
|
||||
_currentElement = el1;
|
||||
_copyTarget = null;
|
||||
|
||||
// Act
|
||||
var evt = _createEvent("beforecopy");
|
||||
_preprocessEvent(evt);
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(_currentElement, el1, "`_currentElement` is 'el1'");
|
||||
assert.strictEqual(_copyTarget, el1, "`_copyTarget` is 'el1'");
|
||||
assert.strictEqual(evt.target, el1, "`beforecopy` target is 'el1'");
|
||||
|
||||
// Act some more
|
||||
_currentElement = el2;
|
||||
evt = _createEvent("copy");
|
||||
_preprocessEvent(evt);
|
||||
|
||||
// Assert some more
|
||||
assert.strictEqual(_currentElement, el2, "`_currentElement` is 'el2'");
|
||||
assert.strictEqual(_copyTarget, el1, "`_copyTarget` is 'el1'");
|
||||
assert.strictEqual(evt.target, el1, "`copy` target is 'el1'");
|
||||
|
||||
// Act some more: interruption due to mouse movement (only happens in Firefox,
|
||||
// though similar issues occur in Chrome for Windows if the user clicks on
|
||||
// another clipped element)
|
||||
evt = _createEvent("_mouseover");
|
||||
_preprocessEvent(evt);
|
||||
|
||||
// Assert some more
|
||||
assert.strictEqual(_currentElement, el2, "`_currentElement` is 'el2'");
|
||||
assert.strictEqual(_copyTarget, el1, "`_copyTarget` is 'el1'");
|
||||
assert.strictEqual(evt.target, el2, "`_mouseover` target is 'el2'");
|
||||
|
||||
// Act some more
|
||||
evt = _createEvent("aftercopy");
|
||||
_preprocessEvent(evt);
|
||||
|
||||
// Assert some more
|
||||
assert.strictEqual(_currentElement, el2, "`_currentElement` is 'el2'");
|
||||
assert.strictEqual(_copyTarget, el1, "`_copyTarget` is 'el1'");
|
||||
assert.strictEqual(evt.target, el1, "`aftercopy` target is 'el1'");
|
||||
|
||||
// Act some more
|
||||
evt = _createEvent("_click");
|
||||
|
||||
// Assert some more
|
||||
assert.strictEqual(_currentElement, el2, "`_currentElement` is 'el2'");
|
||||
assert.strictEqual(_copyTarget, el1, "`_copyTarget` is 'el1'");
|
||||
assert.strictEqual(evt.target, el1, "`_click` target is 'el1'");
|
||||
|
||||
// Act some more
|
||||
_preprocessEvent(evt);
|
||||
|
||||
// Assert some more
|
||||
assert.strictEqual(_currentElement, el2, "`_currentElement` is 'el2'");
|
||||
assert.strictEqual(_copyTarget, null, "`_copyTarget` is `null`");
|
||||
assert.strictEqual(evt.target, el1, "`_click` target is 'el1'");
|
||||
|
||||
// Reset
|
||||
_currentElement = _copyTarget = el1 = el2 = null;
|
||||
});
|
||||
|
||||
|
||||
test("`_getRelatedTarget` works", function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
var relTarget = $("#relTargetId")[0];
|
||||
var goodTarget = $("#goodTargetId")[0];
|
||||
var badTarget1 = $("#badTargetId1")[0];
|
||||
var badTarget2 = $("#badTargetId2")[0];
|
||||
|
||||
assert.notEqual(relTarget, null, "The related target is `null`");
|
||||
assert.strictEqual(_getRelatedTarget(goodTarget), relTarget, "Element with `data-clipboard-target` returns `null`");
|
||||
assert.strictEqual(_getRelatedTarget(badTarget1), null, "Element with `data-clipboard-target` that doesn't much any elements returns `null`");
|
||||
assert.strictEqual(_getRelatedTarget(badTarget2), null, "Element without `data-clipboard-target` returns `null`");
|
||||
});
|
||||
|
||||
|
||||
test("`_shouldPerformAsync` works", function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
// Act & Assert
|
||||
assert.strictEqual(_shouldPerformAsync({ type: "beforecopy" }), false, "`beforecopy` should be performed synchronously");
|
||||
assert.strictEqual(_shouldPerformAsync({ type: "copy" }), false, "`copy` should be performed synchronously");
|
||||
assert.strictEqual(_shouldPerformAsync({ type: "destroy" }), false, "`destroy` should be performed synchronously");
|
||||
assert.strictEqual(_shouldPerformAsync({ type: "ready" }), true, "All other event types should be performed asynchronously");
|
||||
});
|
||||
|
||||
|
||||
test("`_dispatchCallback` can fire asynchronously", function(assert) {
|
||||
assert.expect(6);
|
||||
|
||||
// Arrange
|
||||
var syncExec = false;
|
||||
var syncProof = false;
|
||||
var syncProveIt = function() {
|
||||
syncProof = true;
|
||||
};
|
||||
var asyncExec = true;
|
||||
var asyncProof = false;
|
||||
var asyncProveIt = function() {
|
||||
// Resume test evaluation
|
||||
QUnit.start();
|
||||
|
||||
assert.strictEqual(asyncProof, false);
|
||||
asyncProof = true;
|
||||
assert.strictEqual(asyncProof, true);
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
// Synchronous
|
||||
assert.strictEqual(syncProof, false);
|
||||
_dispatchCallback(syncProveIt, null, null, syncExec);
|
||||
assert.strictEqual(syncProof, true);
|
||||
|
||||
// Asynchronous
|
||||
assert.strictEqual(asyncProof, false);
|
||||
_dispatchCallback(asyncProveIt, null, null, asyncExec);
|
||||
assert.strictEqual(asyncProof, false);
|
||||
|
||||
// Stop test evaluation
|
||||
QUnit.stop();
|
||||
});
|
||||
|
||||
|
||||
module("core/private.js unit tests - flash", {
|
||||
setup: function() {
|
||||
flashState = _flashState;
|
||||
mimeType = window.navigator.mimeTypes["application/x-shockwave-flash"];
|
||||
ax = window.ActiveXObject;
|
||||
},
|
||||
teardown: function() {
|
||||
window.navigator.mimeTypes["application/x-shockwave-flash"] = mimeType;
|
||||
window.ActiveXObject = ax;
|
||||
_flashState = flashState;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("Detecting no Flash", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Arrange
|
||||
window.navigator.mimeTypes["application/x-shockwave-flash"] = undefined;
|
||||
window.ActiveXObject = undefined;
|
||||
|
||||
// Act
|
||||
_detectFlashSupport(window.ActiveXObject);
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(_flashState.disabled, true);
|
||||
});
|
||||
|
||||
|
||||
test("Detecting has Flash mimetype", function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
// Arrange
|
||||
window.navigator.mimeTypes["application/x-shockwave-flash"] = {};
|
||||
window.ActiveXObject = function() { };
|
||||
|
||||
// Act
|
||||
_detectFlashSupport(window.ActiveXObject);
|
||||
|
||||
// Assert
|
||||
assert.strictEqual(_flashState.disabled, false);
|
||||
});
|
||||
|
||||
|
||||
})(QUnit.module, QUnit.test);
|
||||
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ZeroClipboard unit tests: core/private.js</title>
|
||||
<link rel="stylesheet" href="../../node_modules/qunitjs/qunit/qunit.css">
|
||||
<script src="../../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script>
|
||||
// Polyfill in future functionality: https://github.com/jquery/qunit/issues/490
|
||||
if (!QUnit.assert.expect) {
|
||||
QUnit.assert.expect = QUnit.expect;
|
||||
}
|
||||
|
||||
// Require `expect` calls
|
||||
QUnit.config.requireExpects = true;
|
||||
|
||||
// Prevent against Firefox/Firebug failing the global pollution check
|
||||
var getInterface = null;
|
||||
|
||||
// Prevent against failing the global pollution check in all browsers other than IE
|
||||
if (typeof window.ActiveXObject === "undefined") {
|
||||
window.ActiveXObject = null;
|
||||
}
|
||||
|
||||
// Prevent against Flash's ExternalInterface failing the global pollution check (seems to be only in IE < 11)
|
||||
var __flash__arrayToXML = null,
|
||||
__flash__argumentsToXML = null,
|
||||
__flash__objectToXML = null,
|
||||
__flash__escapeXML = null,
|
||||
__flash__toXML = null,
|
||||
__flash__addCallback = null,
|
||||
__flash__removeCallback = null,
|
||||
__flash__request = null;
|
||||
|
||||
// Provide a shell of the `ZeroClipboard` object to pass through a few tests
|
||||
var ZeroClipboard = {
|
||||
setData: function() {},
|
||||
clearData: function() {},
|
||||
focus: function(el) {
|
||||
_currentElement = el;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../src/js/shared/state.js"></script>
|
||||
<script src="../../src/js/shared/private.js"></script>
|
||||
<script src="../../src/js/core/state.js"></script>
|
||||
<script src="../../src/js/core/private.js"></script>
|
||||
<script src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script src="private.tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
<div id="goodTargetId" data-clipboard-target="relTargetId"></div>
|
||||
<div id="relTargetId"></div>
|
||||
<div id="badTargetId1" data-clipboard-target="elementIdWithoutMatch"></div>
|
||||
<div id="badTargetId2"></div>
|
||||
|
||||
<button id="d_clip_button" class="my_clip_button" title="Click me to copy to clipboard." data-clipboard-text="Copy me!">
|
||||
<b>Copy To Clipboard...</b>
|
||||
</button>
|
||||
<a href="" class="no_pointer_anchor" style="cursor:default;"></a>
|
||||
<a href="" class="no_cursor_style" style="cursor:auto;"></a>
|
||||
<span class="zindex-auto" style="z-index:auto;"></span>
|
||||
<span class="big-border" style="border: 10px solid red;"></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user