diff options
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/datastore/028.xhtml')
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/datastore/028.xhtml | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/datastore/028.xhtml b/testing/web-platform/tests/html/editing/dnd/datastore/028.xhtml new file mode 100644 index 000000000..e6aec005e --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/datastore/028.xhtml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Clear datastore data during link drag and drop</title> +<style type="text/css"> +div + {height:100px; + width:100px; + padding:20px; + background-color:silver;} +</style> +<script type="application/ecmascript"> +<![CDATA[ +var dataTypes = ['text/uri-list', 'text/plain', 'application/xml', 'application/xhtml+xml', 'application/mathml+xml', 'image/svg+xml', 'text/html', 'text/x-example'], +data = ['data:text/plain,FAIL', 'FAIL', '<result>FAIL</result>', '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Data store item</title></head><body><p>FAIL</p></body></html>', '<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn></math>', '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100px" height="50px" viewBox="0 0 100 50"><text x="0" y="40" font-size="40" fill="green">FAIL</text></svg>', '<!DOCTYPE html><html><head><title>Data store item</title></head><body><p>FAIL</p></body></html>', 'FAIL']; +function start(event) + {event.dataTransfer.effectAllowed = 'copy'; + for(var i = 0; i != dataTypes.length; i++) + {event.dataTransfer.setData(dataTypes[i], data[i]);} + say('items.length (dragstart) : ' + ((event.dataTransfer.items.length >= dataTypes.length)?'PASS':'FAIL')); + } +function start(event) + {event.dataTransfer.effectAllowed = 'copy'; + l = event.dataTransfer.items.length; + for(var i = 0; i != dataTypes.length; i++) + {event.dataTransfer.setData(dataTypes[i], data[i]);} + event.dataTransfer.clearData(); + say('items.length (dragstart) : ' + ((event.dataTransfer.items.length == 0)?'PASS':'FAIL'));} +function dragElement(event) + {for(var i = 0; i != dataTypes.length; i++) + {event.dataTransfer.setData(dataTypes[i], 'FAIL'); + if(event.dataTransfer.getData(dataTypes[i])) + {say('getData(' + dataTypes[i] + ') : FAIL (data store should not be readable during drag)')} + } + if(event.dataTransfer.items.length != 0) + {say('items.length (dragover) : FAIL')} + } +function enterElement(event) + {event.preventDefault(); + for(var i = 0; i != dataTypes.length; i++) + {event.dataTransfer.setData(dataTypes[i], 'FAIL'); + if(event.dataTransfer.getData(dataTypes[i])) + {say('getData(' + dataTypes[i] + ') : FAIL (data store should not be readable during dragenter)')} + } + say('items.length (dragenter) : ' + ((event.dataTransfer.items.length == 0)?'PASS':'FAIL'));} +function dataDrop(event) + {say('items.length (drop) : ' + ((event.dataTransfer.items.length == 0)?'PASS':'FAIL')); + for(var i = 0; i != dataTypes.length; i++) + {say('getData(' + dataTypes[i] + ') : ' + ((event.dataTransfer.getData(dataTypes[i]) == '')?'PASS':'FAIL'));} + document.querySelector('div').setAttribute('style','background-color:green');} +function say(it) + {document.querySelector('pre').appendChild(document.createTextNode(it + '\n'));} +]]> +</script> +</head> +<body> +<p><a href="data:text/plain,1" ondragstart="start(event)" ondrag="dragElement(event)">Drag me</a></p> +<p>Drag link above to the silver box below and drop it. Silver box should turn green and test results should appear below.</p> +<div ondragenter="enterElement(event)" ondragover="return false;" ondrop="dataDrop(event)"/> +<pre/> +</body> +</html>
\ No newline at end of file |