mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
autodrag - Added beginning of selectables tests
This commit is contained in:
parent
9a671aef8f
commit
8f117475b8
@ -1,10 +1,11 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Draggable - Automated Test Page</title>
|
<title>jQuery UI - Automated Tests</title>
|
||||||
<script type="text/javascript" src="../../jquery/jquery-1.2.6.js"></script>
|
<script type="text/javascript" src="../../jquery/jquery-1.2.6.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/source/ui.core.js"></script>
|
<script type="text/javascript" src="../../ui/source/ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/source/ui.draggable.js"></script>
|
<script type="text/javascript" src="../../ui/source/ui.draggable.js"></script>
|
||||||
|
<script type="text/javascript" src="../../ui/source/ui.selectable.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="ui.testmouse.js"></script>
|
<script type="text/javascript" src="ui.testmouse.js"></script>
|
||||||
|
|
||||||
@ -13,24 +14,28 @@
|
|||||||
html, body { height: 100%; }
|
html, body { height: 100%; }
|
||||||
#main { height: 100%; }
|
#main { height: 100%; }
|
||||||
|
|
||||||
#foo { position: relative; margin: 10px; padding: 10px; border: 3px solid gray; cursor: move; width: 200px; height: 100px; background: #eef; text-align: center; }
|
#foo { position: relative; margin: 10px; padding: 10px; border: 3px solid gray; width: 200px; height: 200px; background: #eef; text-align: center; }
|
||||||
|
#foo * { margin: 4px; }
|
||||||
.ui-draggable .msg-missing-class { display: none !important; background: red; color: white; font-weight: bold; }
|
.ui-draggable .msg-missing-class { display: none !important; background: red; color: white; font-weight: bold; }
|
||||||
.ui-draggable .msg-enabled { display: block; }
|
.ui-draggable .msg-enabled { display: block; }
|
||||||
.ui-draggable .msg-disabled { display: none; }
|
.ui-draggable .msg-disabled { display: none; }
|
||||||
.ui-draggable-disabled .msg-enabled { display: none !important; }
|
.ui-draggable-disabled .msg-enabled { display: none !important; }
|
||||||
.ui-draggable-disabled .msg-disabled { display: block !important; }
|
.ui-draggable-disabled .msg-disabled { display: block !important; }
|
||||||
|
.ui-selectable .msg-missing-class { display: none !important; background: red; color: white; font-weight: bold; }
|
||||||
|
.ui-selectable .msg-enabled { display: block; }
|
||||||
|
.ui-selectable .msg-disabled { display: none; }
|
||||||
|
.ui-selectable-disabled .msg-enabled { display: none !important; }
|
||||||
|
.ui-selectable-disabled .msg-disabled { display: block !important; }
|
||||||
|
//.ui-selectee { border: 1px solid white; }
|
||||||
|
.ui-selecting { background: Highlight; color: HighlightText; outline: 1px dotted white; }
|
||||||
|
.ui-selected { background: Highlight; color: HighlightText; outline: 1px dotted black; }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
var speed = "slow"
|
var speed = "fast";
|
||||||
|
|
||||||
var queue;
|
var queue;
|
||||||
var start = function() {
|
var start = function() {
|
||||||
@ -67,11 +72,19 @@ $(function() {
|
|||||||
|
|
||||||
var setupAndRun = function(nTest) {
|
var setupAndRun = function(nTest) {
|
||||||
$('#testnum').text(nTest.num);
|
$('#testnum').text(nTest.num);
|
||||||
$('#sandbox').hide().append('<div id="foo">' +
|
$('#sandbox').hide()
|
||||||
'<div class="msg-missing-class">THIS TEXT SHOULD NOT BE VISIBLE</div>' +
|
.append('<ul id="foo">' +
|
||||||
'<div class="msg-enabled">enabled</div>' +
|
'<li class="msg-missing-class">THIS TEXT SHOULD NOT BE VISIBLE</li>' +
|
||||||
'<div class="msg-disabled">disabled</div>' +
|
'<li class="msg-enabled">enabled</li>' +
|
||||||
'</div>');
|
'<li class="msg-disabled">disabled</li>' +
|
||||||
|
'<li>Item 2</li>' +
|
||||||
|
'<li>Item 3</li>' +
|
||||||
|
'<li>Item 4</li>' +
|
||||||
|
'<li>Item 5</li>' +
|
||||||
|
'<li>Item 6</li>' +
|
||||||
|
'<li>Item 7</li>' +
|
||||||
|
'<li>Item 8</li>' +
|
||||||
|
'</ul>')
|
||||||
$('#foo').testMouse({
|
$('#foo').testMouse({
|
||||||
speed: speed,
|
speed: speed,
|
||||||
complete: nextTest
|
complete: nextTest
|
||||||
@ -85,20 +98,27 @@ $(function() {
|
|||||||
$('#foo').remove();
|
$('#foo').remove();
|
||||||
if ($.isFunction(fn)) fn.apply();
|
if ($.isFunction(fn)) fn.apply();
|
||||||
}
|
}
|
||||||
|
var plugin = "draggable";
|
||||||
|
plugin = "selectable"
|
||||||
|
var testFn = "testMouse";
|
||||||
|
var testArgs = ["drag", 40, 50];
|
||||||
//1
|
//1
|
||||||
addTest(function() { $("#foo").draggable().testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]()[testFn].apply($("#foo"), testArgs); });
|
||||||
//2
|
//2
|
||||||
addTest(function() { $("#foo").draggable({ disabled: true }).testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]({ disabled: true })[testFn].apply($("#foo"), testArgs); });
|
||||||
addTest(function() { $("#foo").draggable({ disabled: false }).testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]({ disabled: false })[testFn].apply($("#foo"), testArgs); });
|
||||||
//4
|
//4
|
||||||
addTest(function() { $("#foo").draggable().draggable('disable').testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]()[plugin]('disable')[testFn].apply($("#foo"), testArgs); });
|
||||||
addTest(function() { $("#foo").draggable().draggable('enable').testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]()[plugin]('enable')[testFn].apply($("#foo"), testArgs); });
|
||||||
//6
|
//6
|
||||||
addTest(function() { $("#foo").draggable().draggable('enable').draggable('disable').testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]()[plugin]('enable')[plugin]('disable')[testFn].apply($("#foo"), testArgs); });
|
||||||
addTest(function() { $("#foo").draggable().draggable('disable').draggable('enable').testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]()[plugin]('disable')[plugin]('enable')[testFn].apply($("#foo"), testArgs); });
|
||||||
//8
|
//8
|
||||||
addTest(function() { $("#foo").draggable({ disabled: false }).draggable('disable').testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]({ disabled: false })[plugin]('disable')[testFn].apply($("#foo"), testArgs); });
|
||||||
addTest(function() { $("#foo").draggable({ disabled: true }).draggable('enable').testMouse("drag", 100, 100); });
|
addTest(function() { $("#foo")[plugin]({ disabled: true })[plugin]('enable')[testFn].apply($("#foo"), testArgs); });
|
||||||
|
//10
|
||||||
|
addTest(function() { $("#foo")[plugin]({ disabled: false }).data('disabled.' + plugin, true)[testFn].apply($("#foo"), testArgs); });
|
||||||
|
addTest(function() { $("#foo")[plugin]({ disabled: true }).data('disabled.' + plugin, false)[testFn].apply($("#foo"), testArgs); });
|
||||||
|
|
||||||
$('#begin').click(function() {
|
$('#begin').click(function() {
|
||||||
start();
|
start();
|
||||||
@ -112,7 +132,7 @@ $(function() {
|
|||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
||||||
<h1>jQuery UI Draggable - Automated Test</h1>
|
<h1>jQuery UI - Automated Tests</h1>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
Status: <span id="status">Ready</span>
|
Status: <span id="status">Ready</span>
|
||||||
|
@ -12,20 +12,20 @@
|
|||||||
var mouseX = 0;
|
var mouseX = 0;
|
||||||
var mouseY = 0;
|
var mouseY = 0;
|
||||||
|
|
||||||
$.widget("ui.testMouse", {
|
$(function() {
|
||||||
trackMouse: function() {},
|
$(document).mousemove(function(e) {
|
||||||
init: function() {
|
|
||||||
var self = this;
|
|
||||||
this.trackMouse = function(e) {
|
|
||||||
if (e.isTrusted !== false) {
|
if (e.isTrusted !== false) {
|
||||||
mouseX = e.pageX;
|
mouseX = e.pageX;
|
||||||
mouseY = e.pageY;
|
mouseY = e.pageY;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
$(document).bind("mousemove", this.trackMouse);
|
});
|
||||||
|
|
||||||
|
$.widget("ui.testMouse", {
|
||||||
|
trackMouse: function() {},
|
||||||
|
init: function() {
|
||||||
},
|
},
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
$(document).unbind("mousemove", this.trackMouse);
|
|
||||||
},
|
},
|
||||||
center: function(offset) {
|
center: function(offset) {
|
||||||
var o = this.element.offset();
|
var o = this.element.offset();
|
||||||
|
Loading…
Reference in New Issue
Block a user