提交 74631323 编写于 作者: F fxy060608

chore: 调整 reactive 测试例

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