diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html new file mode 100644 index 0000000000..686bd0f6f9 --- /dev/null +++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/dragdrop_test.html @@ -0,0 +1,131 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>script.aculo.us Unit test file</title> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <script src="../../lib/prototype.js" type="text/javascript"></script> + <script src="../../src/scriptaculous.js" type="text/javascript"></script> + <script src="../../src/unittest.js" type="text/javascript"></script> + <link rel="stylesheet" href="../test.css" type="text/css" /> + <style type="text/css" media="screen"> + /* <![CDATA[ */ + #div_absolute_test { position: absolute } + /* ]]> */ + </style> + +</head> +<body> +<h1>script.aculo.us Unit test file</h1> +<p> + Test of drag & drop functions in dragdrop.js +</p> + +<!-- Log output --> +<div id="testlog"> </div> + +<p id="p_test">p_test</p> +<p id="p_test2">p_test2</p> +<p id="p_test3">p_test3</p> +<img id="img_test" src="icon.png" alt="img_text"/> +<div id="droppable_test">droppable_test</div> + +<div id="div_test">div_test</div> +<div id="div_absolute_test">div_absolute_test</div> +<div id="div_absolute_inline_test" style="position:absolute">div_absolute_inline_test</div> + +<div id="droppable_container"> + <div id="d1">droppable_test</div> + <div id="d2">droppable_test</div> +</div> + +<div id="droppable_container_2"> + <div id="d3">droppable_test</div> +</div> + +<!-- Tests follow --> +<script type="text/javascript" language="javascript" charset="utf-8"> +// <![CDATA[ + + new Test.Unit.Runner({ + + testDraggableBasics: function() { with(this) { + var d = new Draggable('p_test'); + assertInstanceOf(Draggable, d); + }}, + + testDraggableStartEffect: function() { with(this) { + var d = new Draggable('p_test2'); + assert(d.options.starteffect, 'There should be a default start effect.'); + d = new Draggable('p_test3', { endeffect: Prototype.EmptyFunction }); + assert(undefined === d.options.startEffect, 'There should be no default start effect.'); + }}, + + testAutoPositioning: function() { with(this) { + assertEqual('static', Element.getStyle('div_test','position')); + new Draggable('div_test'); + new Draggable('div_absolute_test'); + new Draggable('div_absolute_inline_test'); + assertEqual('relative', Element.getStyle('div_test','position')); + assertEqual('absolute', Element.getStyle('div_absolute_test','position')); + assertEqual('absolute', Element.getStyle('div_absolute_inline_test','position')); + }}, + + testDroppbalesBasics: function() { with(this) { + assertEqual(0, Droppables.drops.length); + assertEqual('static', Element.getStyle('droppable_test','position')); + + Droppables.add('droppable_test'); + assertEqual(1, Droppables.drops.length); + assertEqual('relative', Element.getStyle('droppable_test','position')); + + Droppables.remove('droppable_test'); + assertEqual(0, Droppables.drops.length); + + // accept option should take strings or array of strings + Droppables.add('droppable_test',{accept:'document'}); + assertEqual(['document'].inspect(), Droppables.drops[0].accept.inspect()); + Droppables.remove('droppable_test'); + + Droppables.add('droppable_test',{accept:['document','image']}); + assertEqual(['document','image'].inspect(), Droppables.drops[0].accept.inspect()); + Droppables.remove('droppable_test'); + }}, + + testDroppableContainment: function() { with(this) { + // Droppable containers should be cached + Droppables.add('droppable_test', { + containment:'droppable_container' }); + assertEqual(1, Droppables.drops[0]._containers.length); + assertEqual($('droppable_container'), Droppables.drops[0]._containers[0]); + assert(Droppables.isContained($('d1'), Droppables.drops[0])); + assert(Droppables.isContained($('d2'), Droppables.drops[0])); + assert(!Droppables.isContained($('d3'), Droppables.drops[0])); + Droppables.remove('droppable_test'); + + Droppables.add('droppable_test', { + containment:['droppable_container','droppable_container_2'] }); + assertEqual(2, Droppables.drops[0]._containers.length); + assertEqual($('droppable_container'), Droppables.drops[0]._containers[0]); + assertEqual($('droppable_container_2'), Droppables.drops[0]._containers[1]); + assert(Droppables.isContained($('d1'), Droppables.drops[0])); + assert(Droppables.isContained($('d2'), Droppables.drops[0])); + assert(Droppables.isContained($('d3'), Droppables.drops[0])); + Droppables.remove('droppable_test'); + }}, + + testDroppablesIsAffected: function() { with(this) { + Droppables.add('droppable_test'); + + Position.prepare(); + assert(!Droppables.isAffected([-10, -10], null, Droppables.drops[0])); + + var p = Position.page($('droppable_test')); + assert(Droppables.isAffected(p, null, Droppables.drops[0])); + }} + + }, "testlog"); +// ]]> +</script> +</body> +</html> |