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
asudoh authored and joshblack committed Mar 10, 2020
1 parent 3e7b3da commit d02e8b7
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/components/tests/spec/tooltip--simple_spec.js
@@ -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 d02e8b7

Please sign in to comment.