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

feat(composition api): isRef

上级 4d082aba
const PAGE_PATH = '/pages/composition-api/reactivity/is-ref/is-ref'
describe('isRef', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page = null
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor('view')
})
it('basic', async () => {
const refCount = await page.$('#ref-count')
expect(await refCount.text()).toBe('ref count: 0')
const isRefRefCount = await page.$('#is-ref-ref-count')
expect(await isRefRefCount.text()).toBe('isRef ref count: true')
const count = await page.$('#count')
expect(await count.text()).toBe('count: 0')
const isRefCount = await page.$('#is-ref-count')
expect(await isRefCount.text()).toBe('isRef count: false')
})
} else {
it('other platform', () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
<template><view class="page">isRef</view></template>
\ No newline at end of file
<template>
<view class="page">
<text id="ref-count">ref count: {{ refCount }}</text>
<text class="uni-common-mt" id="is-ref-ref-count">isRef ref count: {{ isRefRefCount }}</text>
<text class="uni-common-mt" id="count">count: {{ count }}</text>
<text class="uni-common-mt" id="is-ref-count">isRef count: {{ isRefCount }}</text>
</view>
</template>
<script setup>
const refCount = ref(0);
const count = 0;
const isRefRefCount = isRef(refCount);
const isRefCount = isRef(count);
</script>
\ No newline at end of file
const PAGE_PATH = '/pages/composition-api/reactivity/watch-effect/watch-effect'
describe('watch', () => {
describe('watchEffect', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page = null
beforeAll(async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册