提交 306b1430 编写于 作者: W wanganxp

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uni-app-x into dev

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view> <view>
<page-head :title="title"></page-head> <page-head :title="title"></page-head>
<view class="uni-padding-wrap"> <view class="uni-padding-wrap">
<view class="uni-hello-text">注意:离开当前页面后背景音乐将保持播放,但退出uni-app将停止</view> <view class="uni-hello-text">注意:离开当前页面后背景音乐将保持播放</view>
<view class="page-body-buttons"> <view class="page-body-buttons">
<block v-if="playing"> <block v-if="playing">
<view class="page-body-button" @tap="stop"> <view class="page-body-button" @tap="stop">
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
onLoad: function () { onLoad: function () {
let bgAudioMannager = uni.getBackgroundAudioManager(); let bgAudioMannager = uni.getBackgroundAudioManager();
bgAudioMannager.title = '致爱丽丝'; bgAudioMannager.title = '致爱丽丝';
bgAudioMannager.epname = '致爱丽丝' bgAudioMannager.singer = '路德维希·范·贝多芬';
bgAudioMannager.singer = '暂无';
bgAudioMannager.coverImgUrl = 'https://web-assets.dcloud.net.cn/unidoc/zh/Alice.jpeg'; bgAudioMannager.coverImgUrl = 'https://web-assets.dcloud.net.cn/unidoc/zh/Alice.jpeg';
bgAudioMannager.onPlay(() => { bgAudioMannager.onPlay(() => {
...@@ -52,14 +51,12 @@ ...@@ -52,14 +51,12 @@
}) })
bgAudioMannager.onEnded(() => { bgAudioMannager.onEnded(() => {
this.playing = false; this.playing = false;
// this.playTime = this.playTime = 0;
// thi.formatedPlayTime = this.formatedPlayTime
}) })
bgAudioMannager.onNext(() => { bgAudioMannager.onNext(() => {
console.log("下一曲"); console.log("下一曲");
this.bgAudioMannager?.stop() this.bgAudioMannager?.stop()
bgAudioMannager.title = '致爱丽丝' + this.count++; bgAudioMannager.title = '致爱丽丝' + this.count++;
bgAudioMannager.singer = '暂无2' + this.count++; bgAudioMannager.singer = '路德维希·范·贝多芬';
bgAudioMannager.coverImgUrl = 'https://web-assets.dcloud.net.cn/unidoc/zh/Alice.jpeg'; bgAudioMannager.coverImgUrl = 'https://web-assets.dcloud.net.cn/unidoc/zh/Alice.jpeg';
this.bgAudioMannager!.src = this.dataUrl; this.bgAudioMannager!.src = this.dataUrl;
this.bgAudioMannager?.play() this.bgAudioMannager?.play()
...@@ -68,17 +65,10 @@ ...@@ -68,17 +65,10 @@
console.log("上一曲"); console.log("上一曲");
this.bgAudioMannager?.stop() this.bgAudioMannager?.stop()
bgAudioMannager.title = '致爱丽丝' + this.count--; bgAudioMannager.title = '致爱丽丝' + this.count--;
bgAudioMannager.singer = '暂无' + this.count--; bgAudioMannager.singer = '路德维希·范·贝多芬';
this.bgAudioMannager!.src = this.dataUrl; this.bgAudioMannager!.src = this.dataUrl;
this.bgAudioMannager?.play() this.bgAudioMannager?.play()
}) })
// bgAudioMannager.onTimeUpdate((e) => {
// if (Math.floor(bgAudioMannager.currentTime) > Math.floor(this.playTime)) {
// this.$backgroundAudioData.formatedPlayTime = this.formatedPlayTime = util.formatTime(Math.floor(bgAudioMannager.currentTime));
// }
// this.$backgroundAudioData.playTime = this.playTime = bgAudioMannager.currentTime;
// })
this.bgAudioMannager = bgAudioMannager; this.bgAudioMannager = bgAudioMannager;
}, },
methods: { methods: {
...@@ -142,5 +132,6 @@ ...@@ -142,5 +132,6 @@
.page-body-button { .page-body-button {
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
margin-bottom: 10px;
} }
</style> </style>
...@@ -2,7 +2,7 @@ const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() ...@@ -2,7 +2,7 @@ const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp') const isMP = platformInfo.startsWith('mp')
describe('component-native-grid-view', () => { describe('component-native-grid-view', () => {
if (isMP) { if (isMP || platformInfo.indexOf('web') > -1) {
it('skip mp', () => { it('skip mp', () => {
expect(1).toBe(1) expect(1).toBe(1)
}) })
...@@ -63,9 +63,9 @@ describe('component-native-grid-view', () => { ...@@ -63,9 +63,9 @@ describe('component-native-grid-view', () => {
endPoint: { x: 100, y: 100 }, endPoint: { x: 100, y: 100 },
duration: 100 duration: 100
}) })
await page.waitFor(600) await page.waitFor(1200)
const endDetail = await page.data('scrollEndDetailTest') const endDetail = await page.data('scrollEndDetailTest')
// console.log('scrollEndDetailTest:', endDetail) console.log('scrollEndDetailTest:', endDetail)
expect(endDetail.deltaY).toBe(0) expect(endDetail.deltaY).toBe(0)
expect(endDetail.deltaX).toBe(0) expect(endDetail.deltaX).toBe(0)
expect(endDetail.scrollLeft).toBe(0) expect(endDetail.scrollLeft).toBe(0)
...@@ -81,7 +81,7 @@ describe('component-native-grid-view', () => { ...@@ -81,7 +81,7 @@ describe('component-native-grid-view', () => {
expect(value).toBe(true) expect(value).toBe(true)
}) })
// //检测下拉刷新 备注:iOS本地测试结果正确,但是自动化测试结果错误 //检测下拉刷新 备注:iOS本地测试结果正确,但是自动化测试结果错误
it('check_refresher', async () => { it('check_refresher', async () => {
await page.callMethod('confirm_scroll_top_input', 0) await page.callMethod('confirm_scroll_top_input', 0)
await page.setData({ await page.setData({
......
...@@ -90,9 +90,9 @@ describe('component-native-list-view', () => { ...@@ -90,9 +90,9 @@ describe('component-native-list-view', () => {
endPoint: { x: 100, y: 100 }, endPoint: { x: 100, y: 100 },
duration: 100 duration: 100
}) })
await page.waitFor(600) await page.waitFor(1600)
const endDetail = await page.data('scrollEndDetailTest') const endDetail = await page.data('scrollEndDetailTest')
// console.log('scrollEndDetailTest:', endDetail) console.log('scrollEndDetailTest:', endDetail)
expect(endDetail.deltaY).toBe(0) expect(endDetail.deltaY).toBe(0)
expect(endDetail.deltaX).toBe(0) expect(endDetail.deltaX).toBe(0)
expect(endDetail.scrollLeft).toBe(0) expect(endDetail.scrollLeft).toBe(0)
......
let page; let page;
describe('web-map', () => { describe('web-map', () => {
if (!process.env.uniTestPlatformInfo.startsWith('web')) {
it('app', () => {
expect(1).toBe(1)
})
return
}
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/map/map') page = await program.reLaunch('/pages/component/map/map')
await page.waitFor('view'); await page.waitFor('view');
...@@ -16,6 +11,26 @@ describe('web-map', () => { ...@@ -16,6 +11,26 @@ describe('web-map', () => {
await page.callMethod('updateAutoTest',true) await page.callMethod('updateAutoTest',true)
}); });
it('handleMoveToLocation', async () => {
await page.callMethod('handleMoveToLocation')
await page.waitFor(500);
const moveToLocationRes = await page.data('jestResult')
expect(moveToLocationRes.moveToLocationMsg).toBe("moveToLocation:ok");
});
it('Check EventDetail JsonStringify', async () => {
const res = await page.data('jestResult')
console.log(res.eventDetailJsonStringify);
expect(res.eventDetailJsonStringify).not.toBe("{}");
})
if (!process.env.uniTestPlatformInfo.startsWith('web')) {
it('app', () => {
expect(1).toBe(1)
})
return
}
it('Check MapMethods', async () => { it('Check MapMethods', async () => {
const mapMethods = ['addControls', 'addMarkers', 'addMarkersLabel','removeMarker','addPolyline','removePolyline', 'addPolygons','removePolygon', 'addCircles','removeCircle','includePoint'] const mapMethods = ['addControls', 'addMarkers', 'addMarkersLabel','removeMarker','addPolyline','removePolyline', 'addPolygons','removePolygon', 'addCircles','removeCircle','includePoint']
for (var i = 0; i < mapMethods.length; i++) { for (var i = 0; i < mapMethods.length; i++) {
...@@ -58,12 +73,7 @@ describe('web-map', () => { ...@@ -58,12 +73,7 @@ describe('web-map', () => {
expect(translateMarkerRes.translateMarkerMsg).toBe('translateMarker:ok'); expect(translateMarkerRes.translateMarkerMsg).toBe('translateMarker:ok');
}); });
it('handleMoveToLocation', async () => {
await page.callMethod('handleMoveToLocation')
await page.waitFor(500);
const moveToLocationRes = await page.data('jestResult')
expect(moveToLocationRes.moveToLocationMsg).toBe("moveToLocation:ok");
});
it('handleGetScale', async () => { it('handleGetScale', async () => {
await page.callMethod('handleGetScale') await page.callMethod('handleGetScale')
...@@ -73,5 +83,4 @@ describe('web-map', () => { ...@@ -73,5 +83,4 @@ describe('web-map', () => {
expect(scaleRes.scale).toBeLessThanOrEqual(18); expect(scaleRes.scale).toBeLessThanOrEqual(18);
console.log("jestResult",await page.data()) console.log("jestResult",await page.data())
}); });
}); });
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
southwest : LocationObject, southwest : LocationObject,
northeast : LocationObject, northeast : LocationObject,
moveToLocationMsg : string, moveToLocationMsg : string,
scale : number scale : number,
eventDetailJsonStringify: string,
} }
const testMarkers :Marker[]= [{ const testMarkers :Marker[]= [{
...@@ -345,6 +346,7 @@ ...@@ -345,6 +346,7 @@
}, },
moveToLocationMsg: "", moveToLocationMsg: "",
scale: 0, scale: 0,
eventDetailJsonStringify: "{}"
} as TypeJestResult); } as TypeJestResult);
...@@ -633,10 +635,17 @@ ...@@ -633,10 +635,17 @@
} }
const maptap = (e : UniMapTapEvent) => { const maptap = (e : UniMapTapEvent) => {
// #ifdef WEB
uni.showModal({
content: 'web端map组件tap事件不支持返回经纬度'
});
// #endif
// #ifndef WEB
// console.log('点击地图时触发',e) // console.log('点击地图时触发',e)
uni.showModal({ uni.showModal({
content: JSON.stringify(e.detail) content: JSON.stringify(e.detail)
}); });
// #endif
}; };
const onmarkertap = (e : UniMapMarkerTapEvent) => { const onmarkertap = (e : UniMapMarkerTapEvent) => {
...@@ -666,6 +675,7 @@ ...@@ -666,6 +675,7 @@
const onregionchange = (e : UniMapRegionChangeEvent) => { const onregionchange = (e : UniMapRegionChangeEvent) => {
console.log('视野发生变化时触发', e.detail) console.log('视野发生变化时触发', e.detail)
jestResult.eventDetailJsonStringify = JSON.stringify(e.detail)
}; };
const onpoitap = (e : UniMapPoiTapEvent) => { const onpoitap = (e : UniMapPoiTapEvent) => {
......
...@@ -68,9 +68,10 @@ ...@@ -68,9 +68,10 @@
}, },
updateRichTextHeight() { updateRichTextHeight() {
if (this.richTextElement != null) { if (this.richTextElement != null) {
const elRect = this.richTextElement!.getBoundingClientRect() this.richTextElement!.getBoundingClientRectAsync().then((elRect: DOMRect) => {
this.richTextHeight = elRect.height this.richTextHeight = elRect.height
console.log('richTextHeight:', this.richTextHeight) console.log('richTextHeight:', this.richTextHeight)
})
} }
}, },
// 自动化测试 // 自动化测试
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
selectionEnd: -1, selectionEnd: -1,
hold_keyboard: false, hold_keyboard: false,
adjust_position: false, adjust_position: false,
disabled: false,
jest_result: false jest_result: false
} }
}, },
...@@ -70,6 +71,9 @@ ...@@ -70,6 +71,9 @@
changeAdjustPosition(event : UniSwitchChangeEvent) { changeAdjustPosition(event : UniSwitchChangeEvent) {
const checked = event.detail.value; const checked = event.detail.value;
this.adjust_position = checked; this.adjust_position = checked;
},
change_disabled_boolean(checked : boolean) {
this.disabled = checked
} }
} }
} }
...@@ -85,7 +89,7 @@ ...@@ -85,7 +89,7 @@
:show-confirm-bar="show_confirm_bar_boolean" :adjust-position="adjust_position_boolean" :show-confirm-bar="show_confirm_bar_boolean" :adjust-position="adjust_position_boolean"
:cursor-color="cursor_color" :cursor="cursor" :placeholder="placeholder_value" :cursor-color="cursor_color" :cursor="cursor" :placeholder="placeholder_value"
:inputmode="inputmode_enum[inputmode_enum_current].name" :inputmode="inputmode_enum[inputmode_enum_current].name"
:confirm-type="confirm_type_list[confirm_type_current].name" @click="textarea_click" :confirm-type="confirm_type_list[confirm_type_current].name" :disabled="disabled" @click="textarea_click"
@touchstart="textarea_touchstart" @touchmove="textarea_touchmove" @touchcancel="textarea_touchcancel" @touchstart="textarea_touchstart" @touchmove="textarea_touchmove" @touchcancel="textarea_touchcancel"
@touchend="textarea_touchend" @tap="textarea_tap" @longpress="textarea_longpress" @confirm="textarea_confirm" @touchend="textarea_touchend" @tap="textarea_tap" @longpress="textarea_longpress" @confirm="textarea_confirm"
@input="textarea_input" @linechange="textarea_linechange" @blur="textarea_blur" @input="textarea_input" @linechange="textarea_linechange" @blur="textarea_blur"
...@@ -100,6 +104,8 @@ ...@@ -100,6 +104,8 @@
<boolean-data :defaultValue="focus_boolean" title="获取焦点" @change="change_focus_boolean"></boolean-data> <boolean-data :defaultValue="focus_boolean" title="获取焦点" @change="change_focus_boolean"></boolean-data>
<boolean-data :defaultValue="true" title="首次自动获取焦点" @change="change_auto_focus_boolean"></boolean-data> <boolean-data :defaultValue="true" title="首次自动获取焦点" @change="change_auto_focus_boolean"></boolean-data>
<boolean-data :defaultValue="false" title="改变光标颜色为透明" @change="change_cursor_color_boolean"></boolean-data> <boolean-data :defaultValue="false" title="改变光标颜色为透明" @change="change_cursor_color_boolean"></boolean-data>
<boolean-data :defaultValue="false" title="设置禁用输入框"
@change="change_disabled_boolean"></boolean-data>
<enum-data :items="confirm_type_list" title="confirm-type,设置键盘右下角按钮。(Android仅支持return)" <enum-data :items="confirm_type_list" title="confirm-type,设置键盘右下角按钮。(Android仅支持return)"
@change="radio_change_confirm_type"></enum-data> @change="radio_change_confirm_type"></enum-data>
<boolean-data :defaultValue="false" title="点击软键盘右下角按钮时是否保持键盘不收起(confirm-type为return时必然不收起)" <boolean-data :defaultValue="false" title="点击软键盘右下角按钮时是否保持键盘不收起(confirm-type为return时必然不收起)"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册