提交 74631323 编写于 作者: F fxy060608

chore: 调整 reactive 测试例

上级 d6e5e0fa
......@@ -17,9 +17,9 @@ describe('reactive', () => {
expect(await objNum.text()).toBe('0')
const objArr = await page.$('#obj-arr')
expect(await objArr.text()).toBe('["a","b","c"]')
const arr1 = await page.$('#arr1')
expect(await objArr.text()).toBe('["a","b","c"]')
const arr1 = await page.$('#arr1')
expect(await arr1.text()).toBe('[]')
const updateCountBtn = await page.$('#update-count-btn')
......@@ -40,18 +40,18 @@ describe('reactive', () => {
expect(await objArr.text()).toBe('["a","b","c","d"]')
const count1 = await page.$('#count1')
expect(await count1.text()).toBe('1')
expect(await count1.text()).toBe('1')
const updateObj_A_B_C_Btn = await page.$('#update-obj1-a-b-c-btn')
await updateObj_A_B_C_Btn.tap()
expect(await count1.text()).toBe('2')
const updateArr1Btn = await page.$('#update-arr1-btn')
await updateArr1Btn.tap()
expect(await arr1.text()).toBe('[1,2,3]')
const updateArr1ReactiveBtn = await page.$('#update-arr1-reactive-btn')
await updateArr1ReactiveBtn.tap()
expect(await arr1.text()).toBe('[4,5,6]')
expect(await count1.text()).toBe('2')
const updateArr1Btn = await page.$('#update-arr1-btn')
await updateArr1Btn.tap()
expect(await arr1.text()).toBe(JSON.stringify([1, 2, 3]))
const updateArr1ReactiveBtn = await page.$('#update-arr1-reactive-btn')
await updateArr1ReactiveBtn.tap()
expect(await arr1.text()).toBe(JSON.stringify([4, 5, 6]))
})
})
\ No newline at end of file
......@@ -26,7 +26,7 @@
</view>
<view class="flex justify-between flex-row mb-10">
<text>arr1(spread):</text>
<text id="arr1">{{ arr1 }}</text>
<text id="arr1">{{ JSON.stringify(arr1) }}</text>
</view>
<button class='mb-10' id="update-count-btn" @click="updateCount">update count</button>
<button class='mb-10' id="update-obj-str-btn" @click="updateObjStr">update obj.str</button>
......@@ -66,7 +66,7 @@
const obj1 = reactive({
a: { b: { c: 'c' } }
})
} as UTSJSONObject)
const count1 = ref(0)
watchEffect(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册