提交 3cccb68e 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(reactivity): web 端支持 toValue 示例

上级 450f2023
...@@ -545,7 +545,6 @@ ...@@ -545,7 +545,6 @@
"navigationBarTitleText": "toRef" "navigationBarTitleText": "toRef"
} }
}, },
// #ifdef APP
{ {
"path": "pages/composition-api/reactivity/to-value/to-value", "path": "pages/composition-api/reactivity/to-value/to-value",
"style": { "style": {
...@@ -558,7 +557,6 @@ ...@@ -558,7 +557,6 @@
"navigationBarTitleText": "toRefs" "navigationBarTitleText": "toRefs"
} }
}, },
// #endif
{ {
"path": "pages/composition-api/reactivity/is-proxy/is-proxy", "path": "pages/composition-api/reactivity/is-proxy/is-proxy",
"style": { "style": {
......
const PAGE_PATH = '/pages/composition-api/reactivity/to-value/to-value' const PAGE_PATH = '/pages/composition-api/reactivity/to-value/to-value'
const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isWeb = platformInfo.startsWith('web')
describe('toValue', () => { describe('toValue', () => {
if (process.env.uniTestPlatformInfo.startsWith('web')) {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
return
}
let page = null let page = null
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH) page = await program.reLaunch(PAGE_PATH)
...@@ -32,6 +27,8 @@ describe('toValue', () => { ...@@ -32,6 +27,8 @@ describe('toValue', () => {
await incrementBtn.tap() await incrementBtn.tap()
expect(await objNum.text()).toBe('obj.num: 1') expect(await objNum.text()).toBe('obj.num: 1')
expect(await toValueObjNum.text()).toBe('toValue(() => obj.num): 1') if (!isWeb) {
expect(await toValueObjNum.text()).toBe('toValue(() => obj.num): 1')
}
}) })
}) })
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
num: 0 num: 0
} as Obj) } as Obj)
let toValueObjNum = toValue(() : number => 1) let toValueObjNum = toValue(() : number => 0)
const increment = () => { const increment = () => {
obj.num++; obj.num++;
......
...@@ -146,12 +146,7 @@ ...@@ -146,12 +146,7 @@
{ {
name: 'toValue', name: 'toValue',
url: 'to-value', url: 'to-value',
// #ifdef APP
enable: true, enable: true,
// #endif
// #ifdef WEB
enable: false,
// #endif
}, },
{ {
name: 'toRefs', name: 'toRefs',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册