v-text.test.js 889 字节
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
const OPTIONS_PAGE_PATH = '/pages/directive/v-text/v-text-options'
const COMPOSITION_PAGE_PATH = '/pages/directive/v-text/v-text-composition'

describe('v-text', () => {
  if (!process.env.uniTestPlatformInfo.startsWith('web')) {
    // TODO: 仅 web 支持
    it('web', async () => {
      expect(1).toBe(1)
    })
    return
  }
  let page
  
  const test = async (pagePath) => {
    page = await program.reLaunch(pagePath)
    await page.waitFor('view')
    
    const vTextText = await page.$('#v-text-text')
    expect(await vTextText.text()).toBe('v-text for text')

    const vTextView = await page.$('#v-text-view')
    expect(await vTextView.text()).toBe('v-text for view')
  }
  
  it('v-text options API', async () => {
		await test(OPTIONS_PAGE_PATH)
	})
	
	it('v-text composition API', async () => {
		await test(COMPOSITION_PAGE_PATH)
	})
})