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

fix(tooltip): switch to use raw DOM event bindings #4322

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/tooltip/test/tooltip-template.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ describe('tooltip template', function() {
tooltipScope = elmScope.$$childTail;
}));

function trigger(element, evt) {
evt = new Event(evt);

element[0].dispatchEvent(evt);
}

it('should open on mouseenter', inject(function() {
elm.trigger('mouseenter');
trigger(elm, 'mouseenter');
expect( tooltipScope.isOpen ).toBe( true );

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

elm.trigger('mouseenter');
trigger(elm, 'mouseenter');
expect(tooltipScope.isOpen).toBe(false);

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

elm.trigger('mouseenter');
trigger(elm, 'mouseenter');
expect(tooltipScope.isOpen).toBe(true);

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

it('should hide tooltip when template becomes empty', inject(function($timeout) {
elm.trigger('mouseenter');
trigger(elm, 'mouseenter');
expect(tooltipScope.isOpen).toBe(true);

scope.templateUrl = '';
Expand Down
Loading