提交 04d7543a 编写于 作者: DCloud-yyl's avatar DCloud-yyl

Merge branch 'dev' into alpha

...@@ -6,7 +6,7 @@ const { ...@@ -6,7 +6,7 @@ const {
const hbuilderx_version = process.env.HX_Version const hbuilderx_version = process.env.HX_Version
const uniTestPlatformInfo = process.env.uniTestPlatformInfo ? process.env.uniTestPlatformInfo.replace(/\s/g,'_') : '' const uniTestPlatformInfo = process.env.uniTestPlatformInfo ? process.env.uniTestPlatformInfo.replace(/\s/g,'_') : ''
const folderName = `__image_snapshots__/${hbuilderx_version}/__${uniTestPlatformInfo}__` const folderName = `__image_snapshots__/${hbuilderx_version}/__${uniTestPlatformInfo}__`
const baseFolderName = `__image_snapshots__/base` const baseFolderName = `__image_snapshots__/base/__${uniTestPlatformInfo}__`
expect.extend({ expect.extend({
toMatchImageSnapshot: configureToMatchImageSnapshot({ toMatchImageSnapshot: configureToMatchImageSnapshot({
......
{ {
"name" : "hello-uniapp x", "name": "hello-uniapp x",
"appid" : "__UNI__3584C99", "appid": "__UNI__3584C99",
"description" : "", "description": "",
"versionName" : "1.0.10", "versionName": "1.0.11",
"versionCode" : 10010, "versionCode": 10011,
"uni-app-x" : {}, "uni-app-x":
/* 快应用特有相关 */ {
"quickapp" : {}, },
/* 小程序特有相关 */ /* 快应用特有相关 */
"mp-weixin" : { "quickapp":
"appid" : "", {
"setting" : { },
"urlCheck" : false /* 小程序特有相关 */
}, "mp-weixin":
"usingComponents" : true {
}, "appid": "",
"mp-alipay" : { "setting":
"usingComponents" : true {
}, "urlCheck": false
"mp-baidu" : { },
"usingComponents" : true "usingComponents": true
}, },
"mp-toutiao" : { "mp-alipay":
"usingComponents" : true {
}, "usingComponents": true
"uniStatistics" : { },
"enable" : false "mp-baidu":
}, {
"app": { "usingComponents": true
"duts": [ },
"uni-facialRecognitionVerify" "mp-toutiao":
] {
}, "usingComponents": true
"vueVersion" : "3" },
} "uniStatistics":
{
"enable": false
},
"app":
{
},
"vueVersion": "3"
}
\ No newline at end of file
...@@ -1001,6 +1001,14 @@ ...@@ -1001,6 +1001,14 @@
"navigationBarTitleText" : "getDrawableContext", "navigationBarTitleText" : "getDrawableContext",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
},
{
"path" : "pages/component/transition-event/transition-event",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
}
} }
], ],
......
<template> <template>
<view> <view id="snapshot-content">
<page-head id="page-head" title="getElementById"></page-head> <page-head id="page-head" title="对本页面根view截图"></page-head>
<view class="uni-padding-wrap" id="snapshot-content"> <view class="uni-padding-wrap">
<text id="text">this is text</text> <text id="text">this is text</text>
<view id="view" class="uni-common-mt" style="border: 1px solid red">this is view</view>
</view> </view>
<button class="uni-btn" @click="changeViewStyle">
修改 view 宽高及背景色
</button>
<button class="uni-btn btn-TakeSnapshot" type="primary" @tap="takeSnapshotClick"> <button class="uni-btn btn-TakeSnapshot" type="primary" @tap="takeSnapshotClick">
点击截图 点击截图并替换显示下方图片
</button> </button>
<image style="margin-top: 20px;" :src="snapImage" mode="aspectFit" @longpress="saveToAlbum"></image> <image style="margin-top: 20px;" :src="snapImage" mode="aspectFit" @longpress="saveToAlbum"></image>
</view> </view>
...@@ -24,16 +19,6 @@ ...@@ -24,16 +19,6 @@
} }
}, },
methods: { methods: {
changeViewStyle() {
const text = uni.getElementById('text')!
text.style.setProperty('color', 'red')
const view = uni.getElementById('view')!
view.style.setProperty('width', '90%')
view.style.setProperty('height', '50px')
view.style.setProperty('backgroundColor', '#007AFF')
},
takeSnapshotClick() { takeSnapshotClick() {
const view = uni.getElementById('snapshot-content')! const view = uni.getElementById('snapshot-content')!
view.takeSnapshot({ view.takeSnapshot({
......
...@@ -11,7 +11,7 @@ describe('navigator', () => { ...@@ -11,7 +11,7 @@ describe('navigator', () => {
const btnNavigate = await page.$('.navigate') const btnNavigate = await page.$('.navigate')
await btnNavigate.tap() await btnNavigate.tap()
await page.waitFor(100) await page.waitFor(300)
const currentPage = await program.currentPage() const currentPage = await program.currentPage()
expect(currentPage.path).toBe(PAGE_PATH_NAVIGATE.substring(1)) expect(currentPage.path).toBe(PAGE_PATH_NAVIGATE.substring(1))
...@@ -22,7 +22,7 @@ describe('navigator', () => { ...@@ -22,7 +22,7 @@ describe('navigator', () => {
const btnRedirect = await page.$('.redirect') const btnRedirect = await page.$('.redirect')
await btnRedirect.tap() await btnRedirect.tap()
await page.waitFor(100) await page.waitFor(300)
const currentPage = await program.currentPage() const currentPage = await program.currentPage()
expect(currentPage.path).toBe(PAGE_PATH_REDIRECT.substring(1)) expect(currentPage.path).toBe(PAGE_PATH_REDIRECT.substring(1))
......
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('transition event', () => {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/transition-event/transition-event')
await page.waitFor(3000);
});
it('transitionend', async () => {
await page.callMethod('switchBtn')
await page.waitFor(3000)
expect(await page.data("onTransitionEndTriggr")).toBe(true)
});
});
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<button @click="switchBtn">{{buttonValue}}</button>
<image class="transition-transform" id="transition-transform" @transitionend="onEnd" src="/static/uni.png"></image>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
times: 0,
element: null as Element | null,
isStart: false,
buttonValue: "开启图片旋转",
onTransitionEndTriggr: false
}
},
methods: {
switchBtn() {
if (!this.isStart) {
if (this.element == null) {
this.element = uni.getElementById('transition-transform')
}
this.buttonValue = "关闭图片旋转"
this.times = this.times + 1
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.element!.style.setProperty('transition-duration', '2000')
this.isStart = true
} else {
this.isStart = false
this.times = 0
this.buttonValue = "开启图片旋转"
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.element!.style.setProperty('transition-duration', '0')
}
},
onEnd() {
if (this.isStart) {
this.times = this.times + 1
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.onTransitionEndTriggr = true
}
}
}
}
</script>
<style>
.transition-transform {
width: 400rpx;
height: 400rpx;
margin: 50rpx auto;
border-radius: 200rpx;
transition-duration: 2000;
transition-property: transform;
transition-timing-function: linear;
transform: rotate(0deg);
}
</style>
<template> <template>
<view class="page"> <view class="page">
<unicloud-db ref="udb" v-slot:default="{data, loading, error}" :collection="collection" loadtime="manual"> <unicloud-db ref="udb" v-slot:default="{error}" :collection="collection" loadtime="manual">
<view v-if="error" class="error">{{error}}</view> <view v-if="error!=null" class="error">{{error.errMsg}}</view>
</unicloud-db> </unicloud-db>
<view class="form-item"> <view class="form-item">
<text class="form-item-label">姓名</text> <text class="form-item-label">姓名</text>
...@@ -126,4 +126,4 @@ ...@@ -126,4 +126,4 @@
.btn-add { .btn-add {
margin-top: 50px; margin-top: 50px;
} }
</style> </style>
\ No newline at end of file
...@@ -37,6 +37,7 @@ const pages = [ ...@@ -37,6 +37,7 @@ const pages = [
'/pages/component/view/view', '/pages/component/view/view',
// '/pages/component/web-view/web-view', // 动态内容 // '/pages/component/web-view/web-view', // 动态内容
'/pages/component/web-view-local/web-view-local', '/pages/component/web-view-local/web-view-local',
'/pages/component/transition-event/transition-event',
// CSS // CSS
'/pages/CSS/background/background-color', '/pages/CSS/background/background-color',
......
...@@ -254,6 +254,10 @@ export default { ...@@ -254,6 +254,10 @@ export default {
name: '通用事件', name: '通用事件',
url: '/pages/component/general-event/general-event', url: '/pages/component/general-event/general-event',
enable: true, enable: true,
},{
name: 'Transition事件',
url: '/pages/component/transition-event/transition-event',
enable: true,
}, },
] as Page[], ] as Page[],
} }
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
</list-item> </list-item>
<sticky-header> <sticky-header>
<view style="width: 100%;height:44px;background-color: #f5f5f5;flex-direction: row;justify-content:center;align-items:center;"> <view style="width: 100%;height:44px;background-color: #f5f5f5;flex-direction: row;justify-content:center;align-items:center;">
<button style="height: 40px;font-size: 13px;" v-for="(name,index) in th_item" @click="clickTH(index)"> <text v-for="(name,index) in th_item" @click="clickTH(index)" style="margin-right: 20px;">
{{name}} {{name}}
</button> </text>
</view> </view>
</sticky-header> </sticky-header>
<list-item v-for="(value, index) in listData" :key="index"> <list-item v-for="(value, index) in listData" :key="index">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册