提交 17572f73 编写于 作者: 杜庆泉's avatar 杜庆泉

增加 storage 字面测试示例

上级 7e279f49
......@@ -141,6 +141,11 @@ describe('ExtApi-StorageInfoTest', () => {
it('Check sync properties', async () => {
let btnComplexStaticTest = await page.$('.btn-complexStaticTest')
await btnComplexStaticTest.tap()
await page.waitFor(600)
expect(await getData('staticComplexRet')).toEqual(true)
await page.setData({
key: "autotest_key_mock",
data:"长安大道连狭斜,青牛白马七香车。玉辇纵横过主第,金鞭络绎向侯家。龙衔宝盖承朝日,凤吐流苏带晚霞。百尺游丝争绕树,一群娇鸟共啼花。游蜂戏蝶千门侧,碧树银台万种色。复道交窗作合欢,双阙连甍垂凤翼。"
......
......@@ -66,6 +66,11 @@
填充负数字符串
</button>
</view>
<view class="uni-flex uni-row">
<button type="default" class="uni-btn btn-complexStaticTest" style="width:100%" @tap="complexStaticTest">
字面量读写测试
</button>
</view>
</view>
<view class="uni-padding-wrap">
<view class="uni-btn-v">
......@@ -106,6 +111,7 @@
data: '' as any,
apiGetData: '' as any | null,
storageInfo: '',
staticComplexRet:false
}
},
methods: {
......@@ -152,6 +158,23 @@
this.key = 'key_' + Math.random()
this.data = '测试字符串数据,长度为16个字符'
},
complexStaticTest() {
uni.setStorageSync("key_complexStaticMock", {
name:"张三",
age:12
})
let savedData = uni.getStorageSync("key_complexStaticMock")
this.staticComplexRet = false
if(savedData instanceof UTSJSONObject){
if((savedData as UTSJSONObject).getNumber('age') == 12){
this.staticComplexRet = true
uni.showToast({
icon:'success',
title:'测试通过'
})
}
}
},
complexMock() {
this.key = 'key_' + Math.random()
let jsonObj = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册