blob: f5c9b291482ed201f0d782d8110501af0af49646 [file] [log] [blame]
This tests copying URL string using dataTransfer.items. To manually test, click on "Copy text" and paste (Command+V on Mac Control+V elsewhere).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS clipboardData.items.length is 0
PASS clipboardData.setData("text/uri-list", "rock"); clipboardData.items.length is 1
PASS initialItem = clipboardData.items[0]; initialItem.kind is "string"
PASS initialItem.type is "text/uri-list"
PASS initialItem.getAsFile() is null
PASS initialItem.getAsString(checkContent(1, "rock")) is undefined
PASS clipboardData.items.add("paper", "text/uri-list") threw exception NotSupportedError: The operation is not supported..
PASS clipboardData.items[0] is initialItem
PASS clipboardData.items.clear(); clipboardData.items.length is 0
PASS firstItem = clipboardData.items.add("https://webkit.org/", "text/uri-list"); clipboardData.items.length is 1
PASS clipboardData.items[0] is firstItem
PASS clipboardData.items[0] is not initialItem
PASS firstItem.kind is "string"
PASS firstItem.type is "text/uri-list"
PASS firstItem.getAsFile() is null
PASS firstItem.getAsString(checkContent(2, "https://webkit.org/")) is undefined
PASS clipboardData.getData("url") is "https://webkit.org/"
PASS clipboardData.getData("text/plain") is ""
PASS secondItem = clipboardData.items.add("WebKit", "text/PLAIN"); clipboardData.items.length is 2
PASS clipboardData.items[1] is secondItem
PASS secondItem.kind is "string"
PASS secondItem.type is "text/plain"
PASS secondItem.getAsFile() is null
PASS secondItem.getAsString(checkContent(3, "WebKit")) is undefined
PASS clipboardData.getData("url") is "https://webkit.org/"
PASS clipboardData.getData("TEXT/plain") is "WebKit"
PASS clipboardData.setData("text/plain", "some text"); clipboardData.items.length is 2
PASS clipboardData.items[0] is firstItem
PASS firstItem.kind is "string"
PASS firstItem.type is "text/uri-list"
PASS firstItem.getAsString(checkContent(4, "https://webkit.org/")) is undefined
PASS newSecondItem = clipboardData.items[1]; newSecondItem is not secondItem
PASS newSecondItem.kind is "string"
PASS newSecondItem.type is "text/plain"
PASS newSecondItem.getAsString(checkContent(5, "some text")) is undefined
PASS actualContent1 is "rock"
PASS actualContent2 is "https://webkit.org/"
PASS actualContent3 is "WebKit"
PASS actualContent4 is "https://webkit.org/"
PASS actualContent5 is "some text"
PASS successfullyParsed is true
TEST COMPLETE