提交 9022b1b2 编写于 作者: F fxy060608

feat: v-for 增加 JSON.parse 的number类型测试

上级 4bf32f5e
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<text class="bold mb-10">v-for number</text> <text class="bold mb-10">v-for number</text>
<view class="mb-10" v-for="item in 3" :key="item"> <view class="mb-10" v-for="item in 3" :key="item">
<text :id="`number-${item}`">{{ item }}</text> <text :id="`number-${item}`">{{ item }}</text>
</view>
<view class="mb-10" v-for="item in utsNumber" :key="item">
<text :id="`uts-number-${item}`">{{ item }}</text>
</view> </view>
<view class="bold mb-10">v-for object</view> <view class="bold mb-10">v-for object</view>
...@@ -144,5 +148,7 @@ const mapList = new Map<string, string>([ ...@@ -144,5 +148,7 @@ const mapList = new Map<string, string>([
const setList = new Set<string>(['set value 1', 'set value 2', 'set value 3']) const setList = new Set<string>(['set value 1', 'set value 2', 'set value 3'])
const utsJSONObject = reactive({ utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' }) const utsJSONObject = reactive({ utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' })
const utsNumber = JSON.parse("3") as number
</script> </script>
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<text class="bold mb-10">v-for number</text> <text class="bold mb-10">v-for number</text>
<view class="mb-10" v-for="item in 3" :key="item"> <view class="mb-10" v-for="item in 3" :key="item">
<text :id="`number-${item}`">{{ item }}</text> <text :id="`number-${item}`">{{ item }}</text>
</view>
<view class="mb-10" v-for="item in utsNumber" :key="item">
<text :id="`uts-number-${item}`">{{ item }}</text>
</view> </view>
<view class="bold mb-10">v-for object</view> <view class="bold mb-10">v-for object</view>
...@@ -144,7 +148,8 @@ export default { ...@@ -144,7 +148,8 @@ export default {
['map-key-3', 'map value 3'], ['map-key-3', 'map value 3'],
]), ]),
setList: new Set<string>(['set value 1', 'set value 2', 'set value 3']), setList: new Set<string>(['set value 1', 'set value 2', 'set value 3']),
utsJSONObject: { utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' } utsJSONObject: { utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' },
utsNumber: JSON.parse("3") as number
} }
} }
} }
......
...@@ -12,6 +12,14 @@ describe('v-for', () => { ...@@ -12,6 +12,14 @@ describe('v-for', () => {
expect(await num2.text()).toBe('2') expect(await num2.text()).toBe('2')
const num3 = await page.$('#number-3') const num3 = await page.$('#number-3')
expect(await num3.text()).toBe('3') expect(await num3.text()).toBe('3')
// v-for uts-number
const utsNum1 = await page.$('#uts-number-1')
expect(await utsNum1.text()).toBe('1')
const utsNum2 = await page.$('#uts-number-2')
expect(await utsNum2.text()).toBe('2')
const utsNum3 = await page.$('#uts-number-3')
expect(await utsNum3.text()).toBe('3')
// v-for object // v-for object
const value1 = await page.$('#value1') const value1 = await page.$('#value1')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册