本文整理汇总了TypeScript中@stencil/core/testing.E2EPage.spyOnEvent方法的典型用法代码示例。如果您正苦于以下问题:TypeScript E2EPage.spyOnEvent方法的具体用法?TypeScript E2EPage.spyOnEvent怎么用?TypeScript E2EPage.spyOnEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@stencil/core/testing.E2EPage
的用法示例。
在下文中一共展示了E2EPage.spyOnEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(async () => {
page = await newE2EPage({
html: `
<dot-textfield
label='Name:'
name='fullName'
value='John'
hint='this is a hint'
placeholder='Enter Name'
regex-check='^[A-Za-z ]+$'
validation-message="Invalid Name"
required
required-message="Required Name"
></dot-textfield>`
});
spyStatusChangeEvent = await page.spyOnEvent('statusChange');
spyValueChange = await page.spyOnEvent('valueChange');
element = await page.find('dot-textfield');
input = await page.find('input');
});
示例2: it
it('should send "submit" event', async () => {
const expectedSubmit = {};
const spy = await page.spyOnEvent('onSubmit');
const saveBtn = await element.find('button[type="submit"]');
fields.forEach((field) => {
expectedSubmit[field.name] = field.value;
});
saveBtn.click();
await page.waitForChanges();
expect(spy).toHaveReceivedEventDetail(expectedSubmit);
});
示例3: beforeEach
beforeEach(async () => {
page = await newE2EPage({
html: `
<dot-date
label="Date:"
name="date01"
value="2019-01-20"
hint="date hint"
required
required-message="Required Date"
validation-message="Invalid Date Range"
min="2019-01-01"
max="2019-10-30"
step="2"
></dot-date>`
});
spyStatusChangeEvent = await page.spyOnEvent('statusChange');
spyValueChange = await page.spyOnEvent('valueChange');
element = await page.find('dot-date');
input = await page.find('input');
});
示例4: beforeEach
beforeEach(async () => {
spyStatusChangeEvent = await page.spyOnEvent('statusChange');
spyValueChange = await page.spyOnEvent('valueChange');
});