text-props.test.js 923 字节
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3
const PAGE_PATH = '/pages/component/text/text-props'

describe('text-props', () => {
4
  let page
DCloud-WZF's avatar
DCloud-WZF 已提交
5
  beforeAll(async () => {
6
    page = await program.navigateTo(PAGE_PATH)
DCloud-WZF's avatar
DCloud-WZF 已提交
7 8
    await page.waitFor(1000)
  })
9

DCloud-WZF's avatar
DCloud-WZF 已提交
10 11 12 13
  it('screenshot', async () => {
    const image = await program.screenshot({ fullPage: true })
    expect(image).toMatchImageSnapshot()
  })
14 15 16 17 18 19 20 21 22

  it('empty text', async () => {
      const element = await page.$('#empty-text')
      if (element != null) {
        const { width, height } = await element.size()
        expect(width).toBe(0)
        expect(height).toBe(0)
      }
  })
23

雪洛's avatar
雪洛 已提交
24 25 26 27
  if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
    return
  }

28 29 30 31 32 33 34
  it('text nested', async () => {
      page.callMethod("setTextNested")
      const element = await page.$('#text-nested')
      if (element != null) {
        expect(await element.text()).toBe("二级节点文字红色且背景色黄色")
      }
  })
DCloud-WZF's avatar
DCloud-WZF 已提交
35
})