tapbundle/ts/webhelpers.ts

26 lines
637 B
TypeScript
Raw Permalink Normal View History

2022-03-14 10:22:17 +00:00
import * as plugins from './tapbundle.plugins.js';
2021-02-13 16:02:40 +00:00
import type { fixture, html } from '@open-wc/testing-helpers';
2022-03-14 10:22:17 +00:00
import { tap } from './tapbundle.classes.tap.js';
2021-02-13 16:02:40 +00:00
class WebHelpers {
html: typeof html;
fixture: typeof fixture;
constructor() {
const smartenv = new plugins.smartenv.Smartenv();
if(smartenv.isBrowser) {
this.enable();
}
}
public enable() {
tap.preTask('enable webhelpers', async () => {
const webhelpers = await import('@open-wc/testing-helpers')
this.html = webhelpers.html;
this.fixture = webhelpers.fixture;
})
}
}
export const webhelpers = new WebHelpers();