diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/editing/dnd/interactive | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/interactive')
4 files changed, 212 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/interactive/frames-1.html b/testing/web-platform/tests/html/editing/dnd/interactive/frames-1.html new file mode 100644 index 0000000000..b1a4f5fdef --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/interactive/frames-1.html @@ -0,0 +1,18 @@ +<!doctype html> +<html> + <head> + <title>drag and drop should allow dragging of iframes and object iframes</title> + <style type="text/css"> +html { background: black; color: white; } + </style> + </head> + <body> + + <script type="text/javascript"> +if( self == top ) { + document.write('<p>This is a helper file, not a testcase.<\/p>'); +} + </script> + + </body> +</html> diff --git a/testing/web-platform/tests/html/editing/dnd/interactive/frames.html b/testing/web-platform/tests/html/editing/dnd/interactive/frames.html new file mode 100644 index 0000000000..ae14232e5a --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/interactive/frames.html @@ -0,0 +1,22 @@ +<!doctype html> +<html> + <head> + <title>drag and drop should allow dragging of iframes and object iframes</title> + <style type="text/css"> +iframe, object { + border: 10px solid orange; + background: blue; + padding: 10px; + height: 100px; + width: 100px; +} + </style> + </head> + <body> + + <p>It should be possible to drag the following two blocks by both their orange and blue borders.</p> + <p><iframe draggable="true" src="frames-1.html"></iframe></p> + <p><object draggable="true" data="frames-1.html"></object></p> + + </body> +</html> diff --git a/testing/web-platform/tests/html/editing/dnd/interactive/object-retention.html b/testing/web-platform/tests/html/editing/dnd/interactive/object-retention.html new file mode 100644 index 0000000000..d1d2603421 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/interactive/object-retention.html @@ -0,0 +1,144 @@ +<!DOCTYPE html> +<title>drag & drop - variable retention within event handlers</title> +<style> + body > div { + height: 200px; + width: 200px; + background-color: orange; + } + body > div + div { + margin-top: 10px; + height: 200px; + width: 200px; + background-color: blue; + } +</style> + +<script> +window.onload = function() { + var orange = document.getElementsByTagName('div')[0], blue = document.getElementsByTagName('div')[1], fails = [], evs = {}; + orange.ondragstart = function(e) { + e.dataTransfer.effectAllowed = 'copy'; + var foo = {}; + e.dataTransfer.setData('text', foo); + if( e.dataTransfer.getData('text') === foo ) { + fails[fails.length] = 'object was not cast to string'; + } + evs[e.type] = {}; + evs[e.type].dataTransfer = e.dataTransfer; + evs[e.type].items = e.dataTransfer.items; + evs[e.type].types = e.dataTransfer.types; + evs[e.type].files = e.dataTransfer.files; + //"The same object must be returned each time." + if( evs[e.type].dataTransfer !== e.dataTransfer ) { + fails[fails.length] = '.dataTransfer is not returning the same object during '+e.type; + } + if( !e.dataTransfer.items ) { + fails[fails.length] = '.items is not returning anything during '+e.type; + } else if( evs[e.type].items !== e.dataTransfer.items ) { + fails[fails.length] = '.items is not returning the same object during '+e.type; + } + if( !e.dataTransfer.types ) { + fails[fails.length] = '.types is not returning anything during '+e.type; + } else if( evs[e.type].types !== e.dataTransfer.types ) { + fails[fails.length] = '.types is not returning the same object during '+e.type; + } + if( !e.dataTransfer.files ) { + fails[fails.length] = '.files is not returning anything during '+e.type; + } else if( evs[e.type].files !== e.dataTransfer.files ) { + fails[fails.length] = '.files is not returning the same object during '+e.type; + } + }; + blue.ondragover = blue.ondragenter = function(e) { + e.preventDefault(); + e.dataTransfer.dropEffect = 'copy'; + if( !evs[e.type] ) { evs[e.type] = {}; } + evs[e.type].dataTransfer = e.dataTransfer; + evs[e.type].items = e.dataTransfer.items; + evs[e.type].types = e.dataTransfer.types; + evs[e.type].files = e.dataTransfer.files; + if( evs[e.type].dataTransfer != e.dataTransfer ) { + fails[fails.length] = '.dataTransfer is not returning the same object during '+e.type; + } + if( !e.dataTransfer.items ) { + fails[fails.length] = '.items is not returning anything during '+e.type; + } else if( evs[e.type].items !== e.dataTransfer.items ) { + fails[fails.length] = '.items is not returning the same object during '+e.type; + } + if( !e.dataTransfer.types ) { + fails[fails.length] = '.types is not returning anything during '+e.type; + } else if( evs[e.type].types !== e.dataTransfer.types ) { + fails[fails.length] = '.types is not returning the same object during '+e.type; + } + if( !e.dataTransfer.files ) { + fails[fails.length] = '.files is not returning anything during '+e.type; + } else if( evs[e.type].files !== e.dataTransfer.files ) { + fails[fails.length] = '.files is not returning the same object during '+e.type; + } + //http://dev.w3.org/html5/spec/dnd.html#datatransfer + //"The * attribute must return a * object associated with the DataTransfer object." + //Note that it is associated with the DataTransfer object, *not* the data store + //http://dev.w3.org/html5/spec/dnd.html#dragevent + //"when a user agent is required to fire a DND event named e at an element, using a particular drag data store... + //Let dataTransfer be a newly created DataTransfer object associated with the given drag data store." + //A new DataTransfer object therefore means a new set of properties, not the same ones as last event + if( evs.dragstart.dataTransfer === e.dataTransfer ) { + fails[fails.length] = '.dataTransfer is returning the same object during '+e.type+' as it did during dragstart'; + } + if( e.dataTransfer.items && evs.dragstart.items === e.dataTransfer.items ) { + fails[fails.length] = '.items is returning the same object during '+e.type+' as it did during dragstart'; + } + if( e.dataTransfer.types && evs.dragstart.types === e.dataTransfer.types ) { + fails[fails.length] = '.types is returning the same object during '+e.type+' as it did during dragstart'; + } + if( e.dataTransfer.files && evs.dragstart.files === e.dataTransfer.files ) { + fails[fails.length] = '.files is returning the same object during '+e.type+' as it did during dragstart'; + } + }; + blue.ondrop = function(e) { + e.preventDefault(); + evs[e.type] = {}; + evs[e.type].dataTransfer = e.dataTransfer; + evs[e.type].items = e.dataTransfer.items; + evs[e.type].types = e.dataTransfer.types; + evs[e.type].files = e.dataTransfer.files; + if( evs[e.type].dataTransfer !== e.dataTransfer ) { + fails[fails.length] = '.dataTransfer is not returning the same object during '+e.type; + } + if( !e.dataTransfer.items ) { + fails[fails.length] = '.items is not returning anything during '+e.type; + } else if( evs[e.type].items !== e.dataTransfer.items ) { + fails[fails.length] = '.items is not returning the same object during '+e.type; + } + if( !e.dataTransfer.types ) { + fails[fails.length] = '.types is not returning anything during '+e.type; + } else if( evs[e.type].types !== e.dataTransfer.types ) { + fails[fails.length] = '.types is not returning the same object during '+e.type; + } + if( !e.dataTransfer.files ) { + fails[fails.length] = '.files is not returning anything during '+e.type; + } else if( evs[e.type].files !== e.dataTransfer.files ) { + fails[fails.length] = '.files is not returning the same object during '+e.type; + } + if( evs.dragstart.dataTransfer === e.dataTransfer ) { + fails[fails.length] = '.dataTransfer is returning the same object during '+e.type+' as it did during dragstart'; + } + if( e.dataTransfer.items && evs.dragstart.items === e.dataTransfer.items ) { + fails[fails.length] = '.items is returning the same object during '+e.type+' as it did during dragstart'; + } + if( e.dataTransfer.types && evs.dragstart.types === e.dataTransfer.types ) { + fails[fails.length] = '.types is returning the same object during '+e.type+' as it did during dragstart'; + } + if( e.dataTransfer.files && evs.dragstart.files === e.dataTransfer.files ) { + fails[fails.length] = '.files is returning the same object during '+e.type+' as it did during dragstart'; + } + document.getElementsByTagName('p')[0].innerHTML = fails.length ? ( 'FAIL:<br>' + fails.join('<br>') ) : 'PASS'; + }; +}; +</script> + +<p>Drag the orange square onto the blue square. Fail if this text does not change.</p> +<div draggable="true"></div> +<div></div> + +<noscript><p>Enable JavaScript and reload</p></noscript> diff --git a/testing/web-platform/tests/html/editing/dnd/interactive/plugins.html b/testing/web-platform/tests/html/editing/dnd/interactive/plugins.html new file mode 100644 index 0000000000..70eb97bf42 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/interactive/plugins.html @@ -0,0 +1,28 @@ +<!doctype html> +<html> + <head> + <title>drag and drop should not remove styling of plugin object elements</title> + <style type="text/css"> +div { + border: 10px solid orange; + background: yellow; + padding: 10px; + height: 140px; + width: 140px; +} +object { + border: 10px solid gray; + background: fuchsia; + padding: 10px; + height: 100px; + width: 100px; +} + </style> + </head> + <body> + + <p>Drag the following block by the orange border. The drag placeholder should contain all inner borders, but may optionally show white or pink instead of the navy square.</p> + <div draggable="true" ondragstart="event.dataTransfer.setData('Text','dummy text');"><object data="../resources/boxnavy.swf"></object></div> + + </body> +</html> |