Progressbar test: init

This commit is contained in:
Chi Cheng 2008-08-19 06:32:56 +00:00
parent 951312cfcb
commit b4e2e0e9ca
3 changed files with 99 additions and 0 deletions

View File

@ -12,6 +12,7 @@
<script type="text/javascript" src="../ui/ui.dialog.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" src="../ui/ui.progressbar.js"></script>
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
<script type="text/javascript" src="../ui/ui.slider.js"></script>
@ -27,6 +28,7 @@
<script type="text/javascript" src="datepicker.js"></script>
<script type="text/javascript" src="dialog.js"></script>
<script type="text/javascript" src="draggable.js"></script>
<script type="text/javascript" src="progressbar.js"></script>
<script type="text/javascript" src="resizable.js"></script>
<script type="text/javascript" src="selectable.js"></script>
<script type="text/javascript" src="slider.js"></script>
@ -200,6 +202,8 @@
<input type="text" id="spin" />
<div id="progressbar"></div>
</div>
</body>
</html>

39
tests/progressbar.html Normal file
View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery UI Progressbar Test Suite</title>
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.progressbar.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="progressbar.js"></script>
<style type="text/css">
</style>
</head>
<body>
<h1 id="header">jQuery UI Progressbar Test Suite</h1>
<h2 id="banner"></h2>
<h2 id="userAgent"></h2>
<ol id="tests"></ol>
<div id="main" style="position:absolute;top:-20000px">
<div id="progressbar"></div>
</div>
</body>
</html>

56
tests/progressbar.js Normal file
View File

@ -0,0 +1,56 @@
/*
* progressbar unit tests
*/
(function($) {
// Spinner Tests
module("progressbar");
test("init", function() {
expect(1);
el = $("#progressbar").progressbar();
ok(true, '.progressbar() called on element');
});
test("destroy", function() {
expect(1);
$("#progressbar").progressbar().progressbar("destroy");
ok(true, '.progressbar("destroy") called on element');
});
test("defaults", function() {
expect(5);
el = $("#progressbar").progressbar();
equals(el.data("width.progressbar"), 300, "width");
equals(el.data("duration.progressbar"), 3000, "duration");
equals(el.data("interval.progressbar"), 200, "interval");
equals(el.data("increment.progressbar"), 1, "increment");
equals(el.data("range.progressbar"), true, "range");
});
test("set defaults on init", function() {
expect(5);
el = $("#progressbar").progressbar({
width: 500,
duration: 5000,
interval: 500,
increment: 5,
range: false
});
equals(el.data("width.progressbar"), 500, "width");
equals(el.data("duration.progressbar"), 5000, "duration");
equals(el.data("interval.progressbar"), 500, "interval");
equals(el.data("increment.progressbar"), 5, "increment");
equals(el.data("range.progressbar"), false, "range");
});
})(jQuery);