tapbundle/ts/webhelpers.ts

26 lines
624 B
TypeScript
Raw Normal View History

2022-03-14 10:22:17 +00:00
import * as plugins from './tapbundle.plugins.js';
2023-07-13 00:39:42 +00:00
import type { fixture, html } from '@open-wc/testing';
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();
2023-08-12 09:40:29 +00:00
if (smartenv.isBrowser) {
2021-02-13 16:02:40 +00:00
this.enable();
}
}
public enable() {
tap.preTask('enable webhelpers', async () => {
2023-06-22 11:32:43 +00:00
const webhelpers = await import('@open-wc/testing');
2021-02-13 16:02:40 +00:00
this.html = webhelpers.html;
this.fixture = webhelpers.fixture;
2023-08-12 09:40:29 +00:00
});
2021-02-13 16:02:40 +00:00
}
}
export const webhelpers = new WebHelpers();