本文整理匯總了TypeScript中@stencil/core/testing.TestWindow.load方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TestWindow.load方法的具體用法?TypeScript TestWindow.load怎麽用?TypeScript TestWindow.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@stencil/core/testing.TestWindow
的用法示例。
在下文中一共展示了TestWindow.load方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: beforeEach
beforeEach(async () => {
window = new TestWindow();
element = await window.load({
components: [MadnessEnjineer],
html: '<madness-enjineer></madness-enjineer>'
});
});
示例2: it
it('should pass properties down to <input>', async () => {
const win = new TestWindow();
const el = await win.load({
components: [Toggle],
html: '<ion-toggle disabled checked value="coding" name="primary"></ion-toggle>'
}) as HTMLIonToggleElement;
expect(el.disabled).toBe(true);
expect(el.checked).toBe(true);
expect(el.value).toBe('coding');
expect(el.name).toBe('primary');
const input = getInput(el);
expect(input).toHaveProperties({
disabled: true,
checked: true,
value: 'coding',
name: 'primary'
});
el.disabled = false;
el.checked = false;
el.value = 'design';
el.name = 'secondary';
await win.flush();
expect(input.disabled).toBe(false);
expect(input.checked).toBe(false);
expect(input.value).toBe('design');
expect(input.name).toBe('secondary');
});
示例3: beforeEach
beforeEach(async () => {
testWindow = new TestWindow();
element = await testWindow.load({
components: [MyComponent],
html: '<my-component></my-component>'
});
});