Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: mock lodash.debounce and recreate component in async test #5538

Merged
merged 1 commit into from
Mar 5, 2020
Merged
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
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