summaryrefslogtreecommitdiffstats
path: root/tests/visual/droppable
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2009-02-07 19:02:08 +0000
committerRichard Worth <rdworth@gmail.com>2009-02-07 19:02:08 +0000
commit7da9735a9e370eb88cbfaae66c20a6dd67f0bd8e (patch)
treeeee2f40a8315e3c49df2fc9c9dcff5d827ceff90 /tests/visual/droppable
parent8a12510ca140478cb701a8f6fa4ccb8b8bb25de2 (diff)
downloadjquery-ui-7da9735a9e370eb88cbfaae66c20a6dd67f0bd8e.tar.gz
jquery-ui-7da9735a9e370eb88cbfaae66c20a6dd67f0bd8e.zip
droppable visual tests: added option accept tests
Diffstat (limited to 'tests/visual/droppable')
-rw-r--r--tests/visual/droppable/droppable.css3
-rw-r--r--tests/visual/droppable/droppable.html30
-rw-r--r--tests/visual/droppable/droppable_option_accept_default.html37
-rw-r--r--tests/visual/droppable/droppable_option_accept_function.html40
-rw-r--r--tests/visual/droppable/droppable_option_accept_selector.html38
5 files changed, 124 insertions, 24 deletions
diff --git a/tests/visual/droppable/droppable.css b/tests/visual/droppable/droppable.css
new file mode 100644
index 000000000..cfe663ece
--- /dev/null
+++ b/tests/visual/droppable/droppable.css
@@ -0,0 +1,3 @@
+#draggables * { width: 100px; height: 20px; display: block; margin-bottom: 1em; background: #abc; }
+#droppable { width: 200px; }
+#droppable * { margin: 0.8em; padding: 0.4em; }
diff --git a/tests/visual/droppable/droppable.html b/tests/visual/droppable/droppable.html
index 998573271..2a03da716 100644
--- a/tests/visual/droppable/droppable.html
+++ b/tests/visual/droppable/droppable.html
@@ -1,8 +1,8 @@
<!doctype html>
<html lang="en">
<head>
- <title>Simple Droppable</title>
- <link rel="stylesheet" href="../all.css" type="text/css">
+ <title>Droppable Visual Test : Default</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
<link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
<script type="text/javascript" src="../../../jquery-1.3.1.js"></script>
<script type="text/javascript" src="../../../ui/ui.core.js"></script>
@@ -10,31 +10,13 @@
<script type="text/javascript" src="../../../ui/ui.droppable.js"></script>
<script type="text/javascript">
$(function() {
- $(".draggable").draggable();
- $("#droppable").droppable({
- accept: '.draggable',
- drop: function(ev, ui) {
- ui.draggable.css({ position: 'relative', top: 0, left: 0 }).clone().appendTo(this);
- }
- });
+ $("#droppable").droppable();
});
</script>
</head>
<body>
-
-<ul class="plugins">
-<li class="plugin">
- Droppable
- <div class="draggable">D</div>
- <div class="draggable">R</div>
- <div class="draggable">A</div>
- <div class="draggable">G</div>
- <div id="droppable">
- DROP
- <hr>
- </div>
-</li>
-</ul>
-
+<div id="droppable">
+ <p> Droppable </p>
+</div>
</body>
</html>
diff --git a/tests/visual/droppable/droppable_option_accept_default.html b/tests/visual/droppable/droppable_option_accept_default.html
new file mode 100644
index 000000000..b47f2ef73
--- /dev/null
+++ b/tests/visual/droppable/droppable_option_accept_default.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>Droppable Visual Test : Draggable option accept default</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="droppable.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.3.1.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.draggable.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.droppable.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $("#draggables *").draggable({
+ revert: true
+ });
+ $("#droppable").droppable({
+ drop: function(event, ui) {
+ $(this).append('<div>' + ui.draggable.text() + '</div>');
+ }
+ });
+ });
+ </script>
+</head>
+<body>
+
+<div id="draggables">
+ <div>Draggable div</div>
+ <p>Draggable p</p>
+ <span>Draggable span</div>
+</div>
+
+<div id="droppable" class="ui-widget-content ui-corner-all">
+ <p class="ui-widget-header ui-corner-all"> Droppable </p>
+</div>
+</body>
+</html>
diff --git a/tests/visual/droppable/droppable_option_accept_function.html b/tests/visual/droppable/droppable_option_accept_function.html
new file mode 100644
index 000000000..36606e7ea
--- /dev/null
+++ b/tests/visual/droppable/droppable_option_accept_function.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>Droppable Visual Test : Draggable option accept function</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="droppable.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.3.1.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.draggable.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.droppable.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $("#draggables *").draggable({
+ revert: true
+ });
+ $("#droppable").droppable({
+ accept: function(draggable) {
+ return (draggable.text() === 'Draggable p');
+ },
+ drop: function(event, ui) {
+ $(this).append('<div>' + ui.draggable.text() + '</div>');
+ }
+ });
+ });
+ </script>
+</head>
+<body>
+
+<div id="draggables">
+ <div>Draggable div</div>
+ <p>Draggable p</p>
+ <span>Draggable span</div>
+</div>
+
+<div id="droppable" class="ui-widget-content ui-corner-all">
+ <p class="ui-widget-header ui-corner-all"> Droppable </p>
+</div>
+</body>
+</html>
diff --git a/tests/visual/droppable/droppable_option_accept_selector.html b/tests/visual/droppable/droppable_option_accept_selector.html
new file mode 100644
index 000000000..97bee428b
--- /dev/null
+++ b/tests/visual/droppable/droppable_option_accept_selector.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>Droppable Visual Test : Draggable option accept selector</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="droppable.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.3.1.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.draggable.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.droppable.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $("#draggables *").draggable({
+ revert: true
+ });
+ $("#droppable").droppable({
+ accept: 'p',
+ drop: function(event, ui) {
+ $(this).append('<div>' + ui.draggable.text() + '</div>');
+ }
+ });
+ });
+ </script>
+</head>
+<body>
+
+<div id="draggables">
+ <div>Draggable div</div>
+ <p>Draggable p</p>
+ <span>Draggable span</div>
+</div>
+
+<div id="droppable" class="ui-widget-content ui-corner-all">
+ <p class="ui-widget-header ui-corner-all"> Droppable </p>
+</div>
+</body>
+</html>