v-bind-style.test.js 1013 字节
Newer Older
H
hdx 已提交
1 2 3
const PAGE_PATH = '/pages/directive/v-bind/v-bind-style'

describe('v-bind-style', () => {
4
  const isFirefox = process.env.uniTestPlatformInfo.indexOf('firefox') > -1
H
hdx 已提交
5 6 7 8 9 10 11 12 13 14
  let page
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(500)
  })
  it('basic', async () => {
    const text = await page.$('.text-font-size')
    const view = await page.$('.view-style')

    expect(await text.style('fontSize')).toBe('14px')
雪洛's avatar
雪洛 已提交
15 16 17 18 19
    if(process.env.uniTestPlatformInfo.startsWith('web')) {
      expect(await view.style('backgroundColor')).toBe('rgb(0, 128, 0)')
    } else {
      expect(await view.style('backgroundColor')).toBe('#008000')
    }
20 21 22
    expect(await view.style(isFirefox ? 'borderTopWidth' : 'borderWidth')).toBe('2px')
    if (process.env.uniTestPlatformInfo.startsWith('web')) {
      expect(await view.style(isFirefox ? 'borderTopColor' : 'borderColor')).toBe('rgb(0, 0, 255)')
雪洛's avatar
雪洛 已提交
23 24 25
    } else {
      expect(await view.style('borderColor')).toBe('#0000FF')
    }
H
hdx 已提交
26 27
  })
})