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

describe('$props', () => {
crlfe's avatar
crlfe 已提交
4 5 6 7 8
  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
  it('$attrs中不应该存在$props属性(已在组件props中声明)', async () => {
    const val = await page.$('.has-props-attrs')
    expect(await val.text()).toBe('false')
  })

  it('$attrs中不应该存在$emits属性(已在组件emits中声明)', async () => {
    const val = await page.$('.has-emits-attrs')
    expect(await val.text()).toBe('false')
  })

  it('$attrs中可以获取到未声明的属性', async () => {
    const val = await page.$('.has-attrs')
    expect(await val.text()).toBe('true')
  })
crlfe's avatar
crlfe 已提交
24
})