Skip to content
Permalink
Browse files

Widget tests: Cleanup.

  • Loading branch information
scottgonzalez committed Jan 25, 2011
1 parent 2e214f9 commit 8034cc38038ff1246cd98caecd517f9685d50f8b
Showing with 26 additions and 32 deletions.
  1. +12 −12 tests/unit/widget/widget.html
  2. +13 −16 tests/unit/widget/widget_core.js
  3. +1 −4 tests/unit/widget/widget_tickets.js
@@ -1,22 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta charset="utf-8">
<title>jQuery UI Widget Test Suite</title>

<script type="text/javascript" src="../../../jquery-1.4.4.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../jquery-1.4.4.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
<script type="text/javascript" src="../../../external/qunit.js"></script>
<script type="text/javascript" src="../../jquery.simulate.js"></script>
<script type="text/javascript" src="../testsuite.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
<script src="../../jquery.simulate.js"></script>
<script src="../testsuite.js"></script>

<script type="text/javascript" src="widget_core.js"></script>
<script type="text/javascript" src="widget_tickets.js"></script>
<script type="text/javascript" src="../swarminject.js"></script>
<script src="widget_core.js"></script>
<script src="widget_tickets.js"></script>

<script src="../swarminject.js"></script>
</head>
<body>

@@ -1,6 +1,3 @@
/*
* widget unit tests
*/
(function( $ ) {

module( "widget factory", {
@@ -104,7 +101,7 @@ test( "jQuery usage", function() {
});

shouldCreate = true;
var elem = $( "<div></div>" )
var elem = $( "<div>" )
.bind( "testwidgetcreate", function() {
ok( shouldCreate, "create event triggered on instantiation" );
})
@@ -150,7 +147,7 @@ test( "direct usage", function() {
}
});

var elem = $( "<div></div>" )[ 0 ];
var elem = $( "<div>" )[ 0 ];

shouldCreate = true;
var instance = new $.ui.testWidget( {}, elem );
@@ -202,7 +199,7 @@ test("merge multiple option arguments", function() {
});
}
});
$( "<div></div>" ).testWidget({
$( "<div>" ).testWidget({
option1: "valuex",
option2: "valuex",
option3: "value3",
@@ -249,7 +246,7 @@ test( "_getCreateOptions()", function() {
});

test( "re-init", function() {
var div = $( "<div></div>" ),
var div = $( "<div>" ),
actions = [];

$.widget( "ui.testWidget", {
@@ -335,7 +332,7 @@ test( ".option() - getter", function() {
_create: function() {}
});

var div = $( "<div></div>" ).testWidget({
var div = $( "<div>" ).testWidget({
foo: "bar",
baz: 5,
qux: [ "quux", "quuux" ]
@@ -366,7 +363,7 @@ test( ".option() - delegate to ._setOptions()", function() {
calls.push( options );
}
});
var div = $( "<div></div>" ).testWidget();
var div = $( "<div>" ).testWidget();

calls = [];
div.testWidget( "option", "foo", "bar" );
@@ -392,7 +389,7 @@ test( ".option() - delegate to ._setOption()", function() {
});
}
});
var div = $( "<div></div>" ).testWidget();
var div = $( "<div>" ).testWidget();

calls = [];
div.testWidget( "option", "foo", "bar" );
@@ -419,7 +416,7 @@ test( ".enable()", function() {
same( val, false, "disabled set to false" );
}
});
$( "<div></div>" ).testWidget().testWidget( "enable" );
$( "<div>" ).testWidget().testWidget( "enable" );
});

test( ".disable()", function() {
@@ -431,26 +428,26 @@ test( ".disable()", function() {
same( val, true, "disabled set to true" );
}
});
$( "<div></div>" ).testWidget().testWidget( "disable" );
$( "<div>" ).testWidget().testWidget( "disable" );
});

test( ".widget() - base", function() {
$.widget( "ui.testWidget", {
_create: function() {}
});
var div = $( "<div></div>" ).testWidget();
var div = $( "<div>" ).testWidget();
same( div[0], div.testWidget( "widget" )[0]);
});

test( ".widget() - overriden", function() {
var wrapper = $( "<div></div>" );
var wrapper = $( "<div>" );
$.widget( "ui.testWidget", {
_create: function() {},
widget: function() {
return wrapper;
}
});
same( wrapper[0], $( "<div></div>" ).testWidget().testWidget( "widget" )[0] );
same( wrapper[0], $( "<div>" ).testWidget().testWidget( "widget" )[0] );
});

test( "._trigger() - no event, no ui", function() {
@@ -670,4 +667,4 @@ test( "auto-destroy - .detach()", function() {
$( "#widget" ).testWidget().detach();
});

})( jQuery );
}( jQuery ) );
@@ -1,6 +1,3 @@
/*
* widget unit tests
*/
(function( $ ) {

module( "widget: tickets" );
@@ -43,4 +40,4 @@ test( "#5830 - Widget: Using inheritance overwrites the base classes options", f
delete $.ui.testWidgetExtension;
});

})( jQuery );
}( jQuery ) );

0 comments on commit 8034cc3

Please sign in to comment.
You can’t perform that action at this time.