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

test(v-on): 补充修饰符示例及测试

上级 66a9d876
......@@ -24,8 +24,13 @@
<button class="mb-10 btn" v-on="{ click: handleClick }">
v-on="{ click: handleClick }" 对象语法
</button>
<!-- TODO 不支持修饰符 -->
<!-- <view class="mb-10 btn" v-on:click.once="handleClick">v-on:click.once="handleClick" 点击事件将最多触发一次</view> -->
<!-- TODO: ios 不支持 -->
<!-- #ifndef APP-IOS -->
<button class="mb-10 btn" id="btn-once" @click.once="handleClick">@click once</button>
<!-- #endif -->
<view @click="handleClick">
<button class="mb-10 btn" id="btn-stop" @click.stop="handleClick">@click stop</button>
</view>
</view>
</template>
......
......@@ -22,8 +22,13 @@
<button class="mb-10 btn" v-on="{ click: handleClick }">
v-on="{ click: handleClick }" 对象语法
</button>
<!-- TODO 不支持修饰符 -->
<!-- <view class="mb-10 btn" v-on:click.once="handleClick">v-on:click.once="handleClick" 点击事件将最多触发一次</view> -->
<!-- TODO: ios 不支持 -->
<!-- #ifndef APP-IOS -->
<button class="mb-10 btn" id="btn-once" @click.once="handleClick">@click once</button>
<!-- #endif -->
<view @click="handleClick">
<button class="mb-10 btn" id="btn-stop" @click.stop="handleClick">@click stop</button>
</view>
</view>
</template>
......
......@@ -3,6 +3,8 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-on/v-on-composition'
describe('v-on', () => {
let page
const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isIos = platformInfo.startsWith('ios')
const test = async (pagePath) => {
page = await program.reLaunch(pagePath)
......@@ -16,7 +18,13 @@ describe('v-on', () => {
await btnList[i].tap()
}
expect(await count.text()).toBe('6')
expect(await count.text()).toBe(isIos ? '7' : '8')
if (!isIos) {
const onceBtn = await page.$('#btn-once')
await onceBtn.tap()
expect(await count.text()).toBe('8')
}
}
it('v-on options API', async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册