Skip to content

Commit

Permalink
Switch logs
Browse files Browse the repository at this point in the history
  • Loading branch information
svanherk committed Aug 4, 2023
1 parent 6c7aa85 commit 2718737
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/browser/fixture.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint no-console: 0 */

import { nextFrame, fixture as wcFixture } from '@open-wc/testing';
import { reset } from './reset.js';

Expand Down Expand Up @@ -48,7 +50,9 @@ async function waitForElem(elem, awaitLoadingComplete = true) {
}

export async function fixture(element, opts = {}) {
console.log('before reset');
await Promise.all([reset(opts), document.fonts.ready]);
console.log('after reset');
const elem = await wcFixture(element);
await waitForElem(elem, opts.awaitLoadingComplete);

Expand Down
5 changes: 0 additions & 5 deletions src/browser/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ let currentLang = undefined,
shouldResetMouse = false;

export function requestMouseReset() {
console.log('requestMouseReset');
shouldResetMouse = true;
}

export async function reset(opts) {

opts = opts || {};
opts.lang = opts.lang || DEFAULT_LANG;
opts.mathjax = opts.mathjax || {};
Expand All @@ -37,10 +35,7 @@ export async function reset(opts) {

if (shouldResetMouse) {
shouldResetMouse = false;
console.log('resetting mouse');
const start = new Date().getTime();
await sendMouse({ type: 'move', position: [0, 0] }).catch(() => {});
console.log('took', new Date().getTime() - start);
}

if (document.activeElement !== document.body) {
Expand Down
4 changes: 4 additions & 0 deletions test/browser/commands.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint no-console: 0 */

import { clickAt, clickElem, expect, fixture, focusElem, hoverAt, hoverElem, sendKeys, sendKeysElem } from '../../src/browser/index.js';
import { html } from 'lit';
import { spy } from 'sinon';
Expand All @@ -7,7 +9,9 @@ describe('commands', () => {
let elem;
const input = html`<input type="text">`;
beforeEach(async() => {
console.log('before fixture');
elem = await fixture(input);
console.log('after fixture');
});

it('should click on element', async() => {
Expand Down

0 comments on commit 2718737

Please sign in to comment.