Skip to content

Commit

Permalink
test: mock lodash.debounce and recreate component within async test
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed Mar 5, 2020
1 parent ae8f3af commit fa1d731
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/components/tests/spec/tooltip--simple_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Promise, { delay } from 'bluebird';
import Tooltip from '../../src/components/tooltip/tooltip--simple';
import TooltipDefinitionHTML from '../../html/tooltip/tooltip--definition.html';
import TooltipIconHTML from '../../html/tooltip/tooltip--icon.html';
Expand Down Expand Up @@ -95,15 +94,14 @@ describe('Test simple tooltip', function() {
});

it('Should not have visible class after mouseleave', async function() {
await new Promise(resolve => {
resolve(
element.dispatchEvent(
new CustomEvent('mouseleave', { bubbles: true })
)
);
return Tooltip.__with__({
debounce: fn => fn,
})(() => {
tooltip.release();
tooltip = new Tooltip(element);
element.dispatchEvent(new CustomEvent('mouseleave', { bubbles: true }));
expect(element.classList.contains('bx--tooltip--visible')).toBe(false);
});
await delay(100);
expect(element.classList.contains('bx--tooltip--visible')).toBe(false);
});

it('Should not have hidden class after focus', function() {
Expand Down

0 comments on commit fa1d731

Please sign in to comment.