2010-04-15 07:45:35 +00:00
|
|
|
/*
|
|
|
|
* tooltip_events.js
|
|
|
|
*/
|
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("tooltip: events");
|
|
|
|
|
|
|
|
test("programmatic triggers", function() {
|
|
|
|
expect(2);
|
|
|
|
var e = $("#tooltipped1").tooltip({
|
|
|
|
open: function(event, ui) {
|
|
|
|
same( event.type, "tooltipopen" );
|
|
|
|
},
|
|
|
|
close: function(event, ui) {
|
|
|
|
same( event.type, "tooltipclose" );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
e.tooltip("open").tooltip("close");
|
|
|
|
e.tooltip("destroy");
|
|
|
|
});
|
|
|
|
|
|
|
|
test("mouse events", function() {
|
|
|
|
expect(4);
|
|
|
|
var e = $("#tooltipped1").tooltip({
|
|
|
|
open: function(event, ui) {
|
|
|
|
same( event.type, "tooltipopen" );
|
2010-10-26 15:07:22 +00:00
|
|
|
same( event.originalEvent.type, "mouseover" );
|
2010-04-15 07:45:35 +00:00
|
|
|
},
|
|
|
|
close: function(event, ui) {
|
|
|
|
same( event.type, "tooltipclose" );
|
2011-05-02 19:04:56 +00:00
|
|
|
same( event.originalEvent.type, "mouseleave" );
|
2010-04-15 07:45:35 +00:00
|
|
|
}
|
|
|
|
});
|
2011-05-02 19:04:56 +00:00
|
|
|
e.trigger("mouseover").trigger("mouseleave");
|
2010-04-15 07:45:35 +00:00
|
|
|
e.tooltip("destroy");
|
|
|
|
});
|
|
|
|
|
|
|
|
test("focus events", function() {
|
|
|
|
expect(4);
|
|
|
|
var e = $("#tooltipped1").tooltip({
|
|
|
|
open: function(event, ui) {
|
|
|
|
same( event.type, "tooltipopen" );
|
2011-05-02 19:04:56 +00:00
|
|
|
same( event.originalEvent.type, "focusin" );
|
2010-04-15 07:45:35 +00:00
|
|
|
},
|
|
|
|
close: function(event, ui) {
|
|
|
|
same( event.type, "tooltipclose" );
|
|
|
|
same( event.originalEvent.type, "blur" );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
e.trigger("focus").trigger("blur");
|
|
|
|
e.tooltip("destroy");
|
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|