shallow-reactive.test.js 975 字节
Newer Older
1
const PAGE_PATH = '/pages/reactivity/advanced/shallow-reactive/shallow-reactive'
2 3

describe('shallowReactive', () => {
4 5 6 7 8 9 10
  let page = null
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor('view')
  })
  it('basic', async () => {
    const stateCount = await page.$('#state-count')
11
    expect(await stateCount.text()).toBe('0')
12

13
    const stateNestedCount = await page.$('#state-nested-count')
14
    expect(await stateNestedCount.text()).toBe('0')
15

16 17
    const incrementStateNestedCountBtn = await page.$('.increment-state-nested-count-btn')
    await incrementStateNestedCountBtn.tap()
18

19
    expect(await stateNestedCount.text()).toBe('0')
20

21 22
    const incrementStateCountBtn = await page.$('.increment-state-count-btn')
    await incrementStateCountBtn.tap()
23

24
    expect(await stateCount.text()).toBe('1')
25
    // TODO: web 失败,获取到的还是 0
26
    expect(await stateNestedCount.text()).toBe('1')
27
  })
28
})