aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tooltip/tooltip_events.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/tooltip/tooltip_events.js')
-rw-r--r--tests/unit/tooltip/tooltip_events.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/unit/tooltip/tooltip_events.js b/tests/unit/tooltip/tooltip_events.js
new file mode 100644
index 000000000..35620df47
--- /dev/null
+++ b/tests/unit/tooltip/tooltip_events.js
@@ -0,0 +1,54 @@
+/*
+ * 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" );
+ same( event.originalEvent.type, "mouseover" );
+ },
+ close: function(event, ui) {
+ same( event.type, "tooltipclose" );
+ same( event.originalEvent.type, "mouseout" );
+ }
+ });
+ e.trigger("mouseover").trigger("mouseout");
+ e.tooltip("destroy");
+});
+
+test("focus events", function() {
+ expect(4);
+ var e = $("#tooltipped1").tooltip({
+ open: function(event, ui) {
+ same( event.type, "tooltipopen" );
+ same( event.originalEvent.type, "focus" );
+ },
+ close: function(event, ui) {
+ same( event.type, "tooltipclose" );
+ same( event.originalEvent.type, "blur" );
+ }
+ });
+ e.trigger("focus").trigger("blur");
+ e.tooltip("destroy");
+});
+
+})(jQuery);