提交 5feecd0d 编写于 作者: F fxy060608

feat(reactive): 新增数组响应式reverse测试例

上级 2084c776
...@@ -68,6 +68,9 @@ describe('reactive', () => { ...@@ -68,6 +68,9 @@ describe('reactive', () => {
await page.waitFor(100) await page.waitFor(100)
expect(await arr2.text()).toBe('2') expect(await arr2.text()).toBe('2')
const arr3 = await page.$('#arr3')
expect(await arr2.text()).toBe(JSON.stringify([1, 2, 3, 4, 5].reverse()))
const map2 = await page.$('#map2') const map2 = await page.$('#map2')
expect(await map2.text()).toBe('1') expect(await map2.text()).toBe('1')
const updateMap2ForEachEffectBtn = await page.$('#update-map2-forEach-effect-btn') const updateMap2ForEachEffectBtn = await page.$('#update-map2-forEach-effect-btn')
......
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
<view class="flex justify-between flex-row mb-10"> <view class="flex justify-between flex-row mb-10">
<text>arr2ForEachEffectCount:</text> <text>arr2ForEachEffectCount:</text>
<text id="arr2">{{ arr2ForEachEffectCount }}</text> <text id="arr2">{{ arr2ForEachEffectCount }}</text>
</view>
<view class="flex justify-between flex-row mb-10">
<text>arr3(reverse):</text>
<text id="arr3">{{ JSON.stringify(arr3.reverse()) }}</text>
</view> </view>
<view class="flex justify-between flex-row mb-10"> <view class="flex justify-between flex-row mb-10">
<text>map2ForEachEffectCount:</text> <text>map2ForEachEffectCount:</text>
...@@ -124,7 +128,9 @@ ...@@ -124,7 +128,9 @@
}) })
function updateArr2() { function updateArr2() {
arr2.push(Date.now()) arr2.push(Date.now())
} }
var arr3 = reactive([1, 2, 3, 4, 5])
const map2 = reactive(new Map<string, number>([["a", 1]])) const map2 = reactive(new Map<string, number>([["a", 1]]))
const map2ForEachEffectCount = ref(0) const map2ForEachEffectCount = ref(0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册