Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 7556bed

Browse files
committed
fix(tooltip): switch to use raw DOM event bindings
- Switch to use `addEventListener` and `removeEventListener` to prevent jqLite/jQuery bug where the events are swallowed on disabled elements Closes #4322 Fixes #4060
1 parent d891c8d commit 7556bed

File tree

4 files changed

+154
-103
lines changed

4 files changed

+154
-103
lines changed

src/tooltip/test/tooltip-template.spec.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ describe('tooltip template', function() {
3030
tooltipScope = elmScope.$$childTail;
3131
}));
3232

33+
function trigger(element, evt) {
34+
evt = new Event(evt);
35+
36+
element[0].dispatchEvent(evt);
37+
}
38+
3339
it('should open on mouseenter', inject(function() {
34-
elm.trigger('mouseenter');
40+
trigger(elm, 'mouseenter');
3541
expect( tooltipScope.isOpen ).toBe( true );
3642

3743
expect( elmBody.children().length ).toBe( 2 );
@@ -41,7 +47,7 @@ describe('tooltip template', function() {
4147
scope.templateUrl = null;
4248
scope.$digest();
4349

44-
elm.trigger('mouseenter');
50+
trigger(elm, 'mouseenter');
4551
expect(tooltipScope.isOpen).toBe(false);
4652

4753
expect(elmBody.children().length).toBe(1);
@@ -51,7 +57,7 @@ describe('tooltip template', function() {
5157
scope.myTemplateText = 'some text';
5258
scope.$digest();
5359

54-
elm.trigger('mouseenter');
60+
trigger(elm, 'mouseenter');
5561
expect(tooltipScope.isOpen).toBe(true);
5662

5763
expect(elmBody.children().eq(1).text().trim()).toBe('some text');
@@ -63,7 +69,7 @@ describe('tooltip template', function() {
6369
}));
6470

6571
it('should hide tooltip when template becomes empty', inject(function($timeout) {
66-
elm.trigger('mouseenter');
72+
trigger(elm, 'mouseenter');
6773
expect(tooltipScope.isOpen).toBe(true);
6874

6975
scope.templateUrl = '';

0 commit comments

Comments
 (0)