parent.test.js 601 字节
Newer Older
crlfe's avatar
crlfe 已提交
1
const PAGE_PATH = '/pages/component-instance/parent/parent'
crlfe's avatar
crlfe 已提交
2

crlfe's avatar
crlfe 已提交
3 4 5 6 7 8
describe('$parent', () => {
  let page
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(500)
  })
crlfe's avatar
crlfe 已提交
9

crlfe's avatar
crlfe 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  it('$parent 属性生效', async () => {
    const el = await page.$('.parent-text')

    expect(await el.text()).toBe('parent')
  });

  it('调用$parent方法正常', async () => {
    const el = await page.$('.parent-func-text')
    const btn = await page.$('.call-parent-func')

    btn.tap()

    await page.waitFor(1000)

    expect(await el.text()).toBe('parentFunctionResult')
  })
crlfe's avatar
crlfe 已提交
26
})