mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tooltip: Unit tests cleanup
This commit is contained in:
parent
732a485676
commit
61b4b3e445
@ -9,6 +9,7 @@
|
||||
<script type="text/javascript" src="../../../jquery-1.4.2.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 type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
|
||||
|
@ -3,24 +3,38 @@
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
module("tooltip: options");
|
||||
|
||||
function contentTest(name, expected, impl) {
|
||||
test(name, function() {
|
||||
$("#tooltipped1").tooltip({
|
||||
content: impl
|
||||
}).tooltip("open");
|
||||
same( $(".ui-tooltip").text(), expected );
|
||||
module("tooltip: options", {
|
||||
teardown: function() {
|
||||
$(":ui-tooltip").tooltip("destroy");
|
||||
});
|
||||
}
|
||||
|
||||
contentTest("content: default", "anchortitle");
|
||||
contentTest("content: return string", "customstring", function() {
|
||||
return "customstring";
|
||||
});
|
||||
contentTest("content: callback string", "customstring2", function(response) {
|
||||
|
||||
test("content: default", function() {
|
||||
$("#tooltipped1").tooltip().tooltip("open");
|
||||
same( $(".ui-tooltip").text(), "anchortitle" );
|
||||
});
|
||||
|
||||
test("content: return string", function() {
|
||||
$("#tooltipped1").tooltip({
|
||||
content: function() {
|
||||
return "customstring";
|
||||
}
|
||||
}).tooltip("open");
|
||||
same( $(".ui-tooltip").text(), "customstring" );
|
||||
});
|
||||
|
||||
test("content: callback string", function() {
|
||||
stop();
|
||||
$("#tooltipped1").tooltip({
|
||||
content: function(response) {
|
||||
response("customstring2");
|
||||
setTimeout(function() {
|
||||
same( $(".ui-tooltip").text(), "customstring2" );
|
||||
start();
|
||||
}, 100)
|
||||
}
|
||||
}).tooltip("open");
|
||||
|
||||
});
|
||||
|
||||
test("tooltipClass, default", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user