aboutsummaryrefslogtreecommitdiffstats
path: root/test/jqLiteSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/jqLiteSpec.js')
-rw-r--r--test/jqLiteSpec.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js
index 8b49502f..358b8c4a 100644
--- a/test/jqLiteSpec.js
+++ b/test/jqLiteSpec.js
@@ -603,6 +603,50 @@ describe('jqLite', function() {
browserTrigger(a, 'click');
});
+
+ describe('mouseenter-mouseleave', function() {
+ var root, parent, sibling, child, log;
+
+ beforeEach(function() {
+ log = '';
+ root = jqLite('<div>root<p>parent<span>child</span></p><ul></ul></div>');
+ parent = root.find('p');
+ sibling = root.find('ul');
+ child = parent.find('span');
+
+ parent.bind('mouseenter', function() { log += 'parentEnter;'; });
+ parent.bind('mouseleave', function() { log += 'parentLeave;'; });
+ parent.mouseover = function(event) { parent.data('bind').mouseover(event || {}); };
+ parent.mouseout = function(event) { parent.data('bind').mouseout(event || {}); };
+
+ child.bind('mouseenter', function() { log += 'childEnter;'; });
+ child.bind('mouseleave', function() { log += 'childLeave;'; });
+ child.mouseover = function(event) { child.data('bind').mouseover(event || {}); };
+ child.mouseout = function(event) { child.data('bind').mouseout(event || {}); };
+ });
+
+ afterEach(function() {
+ dealoc(root);
+ });
+
+ it('should fire mouseenter when coming from outside the browser window', function() {
+ if (window.jQuery) return;
+ parent.mouseover();
+ expect(log).toEqual('parentEnter;');
+
+ child.mouseover();
+ expect(log).toEqual('parentEnter;childEnter;');
+ child.mouseover();
+ expect(log).toEqual('parentEnter;childEnter;');
+
+ child.mouseout();
+ expect(log).toEqual('parentEnter;childEnter;');
+ child.mouseout();
+ expect(log).toEqual('parentEnter;childEnter;childLeave;');
+ parent.mouseout();
+ expect(log).toEqual('parentEnter;childEnter;childLeave;parentLeave;');
+ });
+ });
});