From 1fe54bf3b6fa643bb00a6f6724fd7f4e5368faa3 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Thu, 1 Aug 2024 16:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20storage=20=E5=AD=97?= =?UTF-8?q?=E9=9D=A2=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/storage/storage.test.js | 5 +++++ pages/API/storage/storage.uvue | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/pages/API/storage/storage.test.js b/pages/API/storage/storage.test.js index a7bdba62..a8a6d771 100644 --- a/pages/API/storage/storage.test.js +++ b/pages/API/storage/storage.test.js @@ -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:"长安大道连狭斜,青牛白马七香车。玉辇纵横过主第,金鞭络绎向侯家。龙衔宝盖承朝日,凤吐流苏带晚霞。百尺游丝争绕树,一群娇鸟共啼花。游蜂戏蝶千门侧,碧树银台万种色。复道交窗作合欢,双阙连甍垂凤翼。" diff --git a/pages/API/storage/storage.uvue b/pages/API/storage/storage.uvue index cfe87147..4b91b7b5 100644 --- a/pages/API/storage/storage.uvue +++ b/pages/API/storage/storage.uvue @@ -66,6 +66,11 @@ 填充负数字符串 + + + @@ -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 = { -- GitLab