diff --git a/App.uvue b/App.uvue index 5db4455497b6a5b845473c571e8f24ba0f29d349..3ae7d1de4f873f15c8e1495a4acafffc0ab0933b 100644 --- a/App.uvue +++ b/App.uvue @@ -80,5 +80,8 @@ diff --git a/components/input-data/input-data.vue b/components/input-data/input-data.vue index d650aa6e270c4ad73b4f4dac5f4441450fae4cf1..74b8baa6cbbf12724e1880f5c53217f560bb6a28 100644 --- a/components/input-data/input-data.vue +++ b/components/input-data/input-data.vue @@ -81,7 +81,7 @@ {{title}} - + @@ -90,20 +90,15 @@ + diff --git a/pages.json b/pages.json index 2172d45ff4be42a1bff57874756e23a3982b7901..f834b4184ced774ced20935ecd307b0356386fe2 100644 --- a/pages.json +++ b/pages.json @@ -50,6 +50,14 @@ "navigationBarTitleText": "button" } }, + // #ifdef WEB + { + "path": "pages/component/canvas/canvas", + "style": { + "navigationBarTitleText": "canvas" + } + }, + // #endif { "path": "pages/component/radio/radio", "style": { @@ -246,6 +254,14 @@ "backgroundColor": "#F8F8F8" } }, + // #ifdef WEB + { + "path": "pages/API/canvas/canvas", + "style": { + "navigationBarTitleText": "创建绘画" + } + }, + // #endif { "path": "pages/API/get-app/get-app", "style": { diff --git a/pages/API/canvas/canvas.uvue b/pages/API/canvas/canvas.uvue new file mode 100644 index 0000000000000000000000000000000000000000..053583aba2e5218bee906ba7254cdf5c22163c42 --- /dev/null +++ b/pages/API/canvas/canvas.uvue @@ -0,0 +1,460 @@ + + + + + diff --git a/pages/API/get-app-base-info/get-app-base-info.test.js b/pages/API/get-app-base-info/get-app-base-info.test.js index 4c61b7bfafed7d025d8eae7c882c4c567bb34d49..0ff7c3c585ff3778b09f02d6c897b63214dd60c9 100644 --- a/pages/API/get-app-base-info/get-app-base-info.test.js +++ b/pages/API/get-app-base-info/get-app-base-info.test.js @@ -6,11 +6,14 @@ describe('ExtApi-GetAppBaseInfo', () => { let res; const stringProperties = [ 'appId', 'appName', 'appVersion', 'appVersionCode', 'appLanguage', - 'language', 'version', 'uniCompileVersion', 'uniPlatform', 'uniRuntimeVersion', + 'language', 'uniCompileVersion', 'uniPlatform', 'uniRuntimeVersion', ] const numberProperties = [ 'uniCompileVersionCode', 'uniRuntimeVersionCode' - ] + ] + if (process.env.uniTestPlatformInfo.indexOf('web') === -1) { + stringProperties.push('version') + } beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) await page.waitFor(600); diff --git a/pages/API/get-app/get-app.uvue b/pages/API/get-app/get-app.uvue index b697a0862d13df9c94bbfa7a54a8c0eb9993ca95..8870fc68d722218e4967d1d3c35b8887d48809e8 100644 --- a/pages/API/get-app/get-app.uvue +++ b/pages/API/get-app/get-app.uvue @@ -1,181 +1,181 @@ - - - - - diff --git a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue index bbce9555e98c17beb16923fddca8e4fcb501a4fc..6041bbe1aea79f697164d2740116230ccdc898e2 100644 --- a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue +++ b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue @@ -28,20 +28,20 @@ }, changePageHeadBackgroundColor() { const pageHead = uni.getElementById('page-head')! - pageHead.style['backgroundColor'] = 'red' + pageHead.style.setProperty('background-color', 'red') }, changeTextColor() { const text = uni.getElementById('text')! - text.style['color'] = 'red' + text.style.setProperty('color', 'red') }, changeViewStyle() { const view = uni.getElementById('view') if (view !== null) { - view.style['width'] = '90%' - view.style['height'] = '50px' - view.style['backgroundColor'] = '#007AFF' + view.style.setProperty('width', '90%') + view.style.setProperty('height', '50px') + view.style.setProperty('backgroundColor', '#007AFF') } } } } - + diff --git a/pages/API/get-element-by-id/get-element-by-id.uvue b/pages/API/get-element-by-id/get-element-by-id.uvue index 24559446a92436dd78e90a99b28129f60c6b8adc..69e7e04e05c4d748d324ee9fd3dec8e4b2e2ffde 100644 --- a/pages/API/get-element-by-id/get-element-by-id.uvue +++ b/pages/API/get-element-by-id/get-element-by-id.uvue @@ -35,18 +35,18 @@ }, changePageHeadBackgroundColor() { const pageHead = uni.getElementById('page-head')! - pageHead.style['backgroundColor'] = 'red' + pageHead.style.setProperty('background-color', 'red') }, changeTextColor() { - const text = uni.getElementById('text')! - text.style['color'] = 'red' - }, + const text = uni.getElementById('text')! + text.style.setProperty('color', 'red') + }, changeViewStyle() { const view = uni.getElementById('view') if (view !== null) { - view.style['width'] = '90%' - view.style['height'] = '50px' - view.style['backgroundColor'] = '#007AFF' + view.style.setProperty('width', '90%') + view.style.setProperty('height', '50px') + view.style.setProperty('background-color', '#007AFF') } }, goMultipleRootNode() { @@ -54,4 +54,4 @@ } } } - + diff --git a/pages/API/get-system-info/get-system-info.test.js b/pages/API/get-system-info/get-system-info.test.js index 5a614780afe15fe8a0b92e7dddf241f0b42d883d..c59da34263bf4c22ac736fc588ee782d35b05eec 100644 --- a/pages/API/get-system-info/get-system-info.test.js +++ b/pages/API/get-system-info/get-system-info.test.js @@ -7,7 +7,7 @@ describe('ExtApi-GetSystemInfo', () => { const stringProperties = [ 'appId', 'appLanguage', 'appName', 'appVersion', 'appVersionCode', 'brand', 'deviceId', 'deviceBrand', 'deviceModel', 'deviceType', 'language', - 'model', 'version', 'osName', 'osVersion', 'osLanguage', 'platform', 'system', 'ua', 'uniCompileVersion', + 'model', 'osName', 'osVersion', 'osLanguage', 'platform', 'system', 'ua', 'uniCompileVersion', 'uniPlatform', 'uniRuntimeVersion', 'romName', 'romVersion', ] const numberProperties = [ @@ -15,7 +15,12 @@ describe('ExtApi-GetSystemInfo', () => { 'windowWidth', 'windowHeight', 'windowTop', 'windowBottom', 'screenTop', 'uniCompileVersionCode', 'uniRuntimeVersionCode' - ] + ] + + + if (process.env.uniTestPlatformInfo.indexOf('web') === -1) { + stringProperties.push('version') + } beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) diff --git a/pages/API/navigator/new-page/onLoad.uvue b/pages/API/navigator/new-page/onLoad.uvue index a13dfa2ec60901c03f2a8d00593c9e910d804538..04e5b90eddcf09a6460255b3ed4a3db877f32a34 100644 --- a/pages/API/navigator/new-page/onLoad.uvue +++ b/pages/API/navigator/new-page/onLoad.uvue @@ -55,11 +55,13 @@ export default { }, // #ifdef WEB onUnload() { - // web 端页面销毁前,关闭 modal 和 actionsheet + // web 端页面销毁前,关闭 modal 和 actionsheet + // @ts-ignore const modalBtn = document.querySelector('.uni-modal__btn') if (modalBtn) { modalBtn.click() - } + } + // @ts-ignore const actionSheetBtn = document.querySelector('.uni-actionsheet__action .uni-actionsheet__cell') if (actionSheetBtn) { actionSheetBtn.click() diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index e4157b0aff1df2ec17ae2142ceb4e9d5e77731c9..8639e985861886093a2c44f615b1c13e0b1730e6 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -69,24 +69,29 @@ describe('ExtApi-Request', () => { }); it('Check PATCH', async () => { await request(page, 'PATCH'); - }); - it('Check OPTIONS', async () => { - await request(page, 'OPTIONS'); - }); + }); + if (process.env.uniTestPlatformInfo.indexOf('web') === -1) { + it('Check OPTIONS', async () => { + await request(page, 'OPTIONS'); + }); + } it('Check HEAD', async () => { await request(page, 'HEAD'); }); - it('Check Set Cookie', async () => { - res = await page.callMethod('jest_set_cookie') - await page.waitFor(500); - res = await page.data('jest_result'); - expect(res).toBe(true) - }); - it('Check Delete Cookie', async () => { - res = await page.callMethod('jest_delete_cookie') - await page.waitFor(1000); - res = await page.data('jest_result'); - expect(res).toBe(true) - }); + + if (process.env.uniTestPlatformInfo.indexOf('web') === -1) { + it('Check Set Cookie', async () => { + res = await page.callMethod('jest_set_cookie') + await page.waitFor(500); + res = await page.data('jest_result'); + expect(res).toBe(true) + }); + it('Check Delete Cookie', async () => { + res = await page.callMethod('jest_delete_cookie') + await page.waitFor(1000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }); + } }); diff --git a/pages/CSS/display/flex.uvue b/pages/CSS/display/flex.uvue index 33e4055d4231d85db85a9804064c39bca7a49355..182561dc7c134040a76dcb791df0cae9ac995506 100644 --- a/pages/CSS/display/flex.uvue +++ b/pages/CSS/display/flex.uvue @@ -1,7 +1,5 @@ + + + + diff --git a/pages/component/checkbox/checkbox.test.js b/pages/component/checkbox/checkbox.test.js index 2bc0d00f463bf8963513ff407c7774530a6abc1e..66db34d30232a763cb32c647413fdb9676bde468 100644 --- a/pages/component/checkbox/checkbox.test.js +++ b/pages/component/checkbox/checkbox.test.js @@ -1,67 +1,67 @@ -function getData(key = '') { - return new Promise(async (resolve, reject) => { - const data = await page.data() - resolve(key ? data[key] : data) - }) -} - -let page -beforeAll(async () => { - page = await program.reLaunch('/pages/component/checkbox/checkbox') - await page.waitFor(2000); -}) - -describe('Checkbox.uvue', () => { - it('change', async () => { - expect(await getData('value')).toEqual([]) - const cb1 = await page.$('.cb1') - await cb1.tap() - expect(await getData('value')).toEqual(['cb', 'cb1']) - const cb = await page.$('.cb') - await cb.tap() - expect(await getData('value')).toEqual(['cb1']) - const cb2 = await page.$('.cb2') - await cb2.tap() - expect(await getData('value')).toEqual(['cb1']) - await cb1.tap() - expect(await getData('value')).toEqual([]) - }) - it('length', async () => { - const checkboxGroupElements = await page.$$('.checkbox-group') - expect(checkboxGroupElements.length).toBe(3) - const checkboxElements = await page.$$('.checkbox') - expect(checkboxElements.length).toBe(12) - }) - it('text', async () => { - const cb = await page.$('.cb1') - expect(await cb.text()).toEqual('未选中') - await page.setData({ - text: 'not selected', - }) - expect(await cb.text()).toEqual('not selected') - }) - it('checked', async () => { - const cb = await page.$('.cb') - expect(await cb.property('checked')).toBe(true) - await page.setData({ - checked: false, - }) - expect(await cb.property('checked')).toBe(false) - }) - it('color', async () => { - const cb = await page.$('.cb') - expect(await cb.property('color')).toBe('#007aff') - await page.setData({ - color: '#63acfc', - }) - expect(await cb.property('color')).toBe('#63acfc') - }) - it('disabled', async () => { - const cb = await page.$('.cb2') - expect(await cb.property('disabled')).toBe(true) - await page.setData({ - disabled: false, - }) - expect(await cb.property('disabled')).toBe(false) - }) -}) +function getData(key = '') { + return new Promise(async (resolve, reject) => { + const data = await page.data() + resolve(key ? data[key] : data) + }) +} + +let page +beforeAll(async () => { + page = await program.reLaunch('/pages/component/checkbox/checkbox') + await page.waitFor(2000); +}) + +describe('Checkbox.uvue', () => { + it('change', async () => { + expect(await getData('value')).toEqual([]) + const cb1 = await page.$('.cb1') + await cb1.tap() + expect(await getData('value')).toEqual(['cb', 'cb1']) + const cb = await page.$('.cb') + await cb.tap() + expect(await getData('value')).toEqual(['cb1']) + const cb2 = await page.$('.cb2') + await cb2.tap() + expect(await getData('value')).toEqual(['cb1']) + await cb1.tap() + expect(await getData('value')).toEqual([]) + }) + it('length', async () => { + const checkboxGroupElements = await page.$$('.checkbox-group') + expect(checkboxGroupElements.length).toBe(3) + const checkboxElements = await page.$$('.checkbox') + expect(checkboxElements.length).toBe(12) + }) + it('text', async () => { + const cb = await page.$('.cb1') + expect(await cb.text()).toEqual('未选中') + await page.setData({ + text: 'not selected', + }) + expect(await cb.text()).toEqual('not selected') + }) + it('checked', async () => { + const cb = await page.$('.cb') + expect(await cb.property('checked')).toBe(true) + await page.setData({ + checked: false, + }) + expect(await cb.property('checked')).toBe(false) + }) + it('color', async () => { + const cb = await page.$('.cb') + expect(await cb.attribute('color')).toBe('#007aff') + await page.setData({ + color: '#63acfc', + }) + expect(await cb.attribute('color')).toBe('#63acfc') + }) + it('disabled', async () => { + const cb = await page.$('.cb2') + expect(await cb.attribute('disabled')).toBe(true + '') + await page.setData({ + disabled: false, + }) + expect(await cb.attribute('disabled')).toBe(false + '') + }) +}) diff --git a/pages/component/form/form.uvue b/pages/component/form/form.uvue index c7f7682b2f235c304a5d76db7c8321c1ae925cc7..79026ede576f7ed9febe767ea25342b75f1ae803 100644 --- a/pages/component/form/form.uvue +++ b/pages/component/form/form.uvue @@ -1,7 +1,5 @@ + .uni-input-placeholder-class-ts { + background-color: orange; + } + diff --git a/pages/component/mixin-datacom/mixin-datacom.test.js b/pages/component/mixin-datacom/mixin-datacom.test.js index f70ed01b5482ab260b538b0cce86eddf52bb7b9b..95a8804ada679250806617dfb9791491b2a6dd74 100644 --- a/pages/component/mixin-datacom/mixin-datacom.test.js +++ b/pages/component/mixin-datacom/mixin-datacom.test.js @@ -1,6 +1,12 @@ const PAGE_PATH = '/pages/component/mixin-datacom/mixin-datacom' describe('mixin-datacom', () => { + if (process.env.uniTestPlatformInfo.startsWith('web')) { + it('dummyTest', async () => { + expect(1).toBe(1) + }) + return + } let page beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) diff --git a/pages/component/picker-view/picker-view.test.js b/pages/component/picker-view/picker-view.test.js index 430805e3d8f54d1cb24a60ec2c8e8b38767ac440..2a16a1d829fd2960036b5e2f1405bd844cbcbfe0 100644 --- a/pages/component/picker-view/picker-view.test.js +++ b/pages/component/picker-view/picker-view.test.js @@ -39,22 +39,22 @@ describe('PickerView.uvue', () => { const el = await page.$('.picker-view') await page.setData({ indicatorStyle: 'height: 100px;', - }) + }) await page.waitFor(500) - expect(await el.property('indicatorStyle')).toBe('height: 100px;') + expect(await el.attribute('indicatorStyle')).toBe('height: 100px;') }) it('mask-top-style', async () => { const el = await page.$('.picker-view') await page.setData({ maskTopStyle: 'background: #ffffff;', }) - expect(await el.property('mask-top-style')).toBe('background: #ffffff;') + expect(await el.attribute('mask-top-style')).toBe('background: #ffffff;') }) it('mask-bottom-style', async () => { const el = await page.$('.picker-view') await page.setData({ maskBottomStyle: 'background: #ffffff;', }) - expect(await el.property('mask-bottom-style')).toBe('background: #ffffff;') + expect(await el.attribute('mask-bottom-style')).toBe('background: #ffffff;') }) }) diff --git a/pages/component/progress/progress.test.js b/pages/component/progress/progress.test.js index a572aeaeb22e2458f1bc8f3bf2f437b81c6304fc..f4cbbaee5290515ccf5ac966adc89100e4ef7a11 100644 --- a/pages/component/progress/progress.test.js +++ b/pages/component/progress/progress.test.js @@ -16,22 +16,22 @@ describe('Progress.uvue', () => { await page.callMethod('setProgress') await page.waitFor(1000); const p = await page.$('.p') - expect(await p.property('percent')).toEqual(20) + expect(await p.attribute('percent')).toEqual(20 + '') const p1 = await page.$('.p1') - expect(await p1.property('percent')).toEqual(40) + expect(await p1.attribute('percent')).toEqual(40 + '') const p2 = await page.$('.p2') - expect(await p2.property('percent')).toEqual(60) + expect(await p2.attribute('percent')).toEqual(60 + '') const p3 = await page.$('.p3') - expect(await p3.property('percent')).toEqual(80) + expect(await p3.attribute('percent')).toEqual(80 + '') if (process.env.UNI_PLATFORM === 'app-android') { expect(await getData('curPercent')).toEqual(20) } await page.callMethod('clearProgress') await page.waitFor(1000) - expect(await p.property('percent')).toEqual(0) - expect(await p1.property('percent')).toEqual(0) - expect(await p2.property('percent')).toEqual(0) - expect(await p3.property('percent')).toEqual(0) + expect(await p.attribute('percent')).toEqual(0 + '') + expect(await p1.attribute('percent')).toEqual(0 + '') + expect(await p2.attribute('percent')).toEqual(0 + '') + expect(await p3.attribute('percent')).toEqual(0 + '') if (process.env.UNI_PLATFORM === 'app-android') { expect(await getData('curPercent')).toEqual(0) } @@ -42,42 +42,42 @@ describe('Progress.uvue', () => { }) it('show-info', async () => { const el = await page.$('.p') - expect(await el.property('show-info')).toEqual(true) + expect(await el.attribute('show-info')).toEqual(true + '') await page.setData({ showInfo: false }) - expect(await el.property('show-info')).toEqual(false) + expect(await el.attribute('show-info')).toEqual(false + '') }) it('border-radius', async () => { const el = await page.$('.p') - expect(await el.property('border-radius')).toEqual(0) + expect(await el.attribute('border-radius')).toEqual(0 + '') await page.setData({ borderRadius: 5 }) - expect(await el.property('border-radius')).toEqual(5) + expect(await el.attribute('border-radius')).toEqual(5 + '') }) it('font-size', async () => { const el = await page.$('.p') - expect(await el.property('font-size')).toEqual(16) + expect(await el.attribute('font-size')).toEqual(16 + '') await page.setData({ fontSize: 18 }) - expect(await el.property('font-size')).toEqual(18) + expect(await el.attribute('font-size')).toEqual(18 + '') }) it('stroke-width', async () => { const el = await page.$('.p') - expect(await el.property('stroke-width')).toEqual(3) + expect(await el.attribute('stroke-width')).toEqual(3 + '') await page.setData({ strokeWidth: 6 }) - expect(await el.property('stroke-width')).toEqual(6) + expect(await el.attribute('stroke-width')).toEqual(6 + '') }) it('backgroundColor', async () => { const el = await page.$('.p') - expect(await el.property('background-color')).toEqual('#EBEBEB') + expect(await el.attribute('background-color')).toEqual('#EBEBEB') await page.setData({ backgroundColor: "#007aff" }) - expect(await el.property('background-color')).toEqual('#007aff') + expect(await el.attribute('background-color')).toEqual('#007aff') }) -}) \ No newline at end of file +}) diff --git a/pages/component/radio/radio.test.js b/pages/component/radio/radio.test.js index aa14de52f63fd704be9942d93654b9e76be07d15..aca487c82751a2b554a1eae572f8ac0ab172650d 100644 --- a/pages/component/radio/radio.test.js +++ b/pages/component/radio/radio.test.js @@ -1,65 +1,65 @@ -function getData(key = '') { - return new Promise(async (resolve, reject) => { - const data = await page.data() - resolve(key ? data[key] : data) - }) -} - -let page -beforeAll(async () => { - page = await program.reLaunch('/pages/component/radio/radio') - await page.waitFor(2000); -}) - -describe('Radio.uvue', () => { - it('change', async () => { - expect(await getData('value')).toEqual('') - const radio1 = await page.$('.r1') - await radio1.tap() - expect(await getData('value')).toEqual('r1') - const radio = await page.$('.r') - await radio.tap() - expect(await getData('value')).toEqual('r') - const radio2 = await page.$('.r2') - await radio2.tap() - expect(await getData('value')).toEqual('r') - }) - it('length', async () => { - const radioGroupElements = await page.$$('.radio-group') - expect(radioGroupElements.length).toBe(3) - const radioElements = await page.$$('.radio') - expect(radioElements.length).toBe(12) - }) - it('text', async () => { - const radio = await page.$('.r1') - expect(await radio.text()).toEqual('未选中') - await page.setData({ - text: 'not selected', - }) - expect(await radio.text()).toEqual('not selected') - }) - it('checked', async () => { - const radio = await page.$('.r') - expect(await radio.property('checked')).toBe(true) - await page.setData({ - checked: false, - }) - expect(await radio.property('checked')).toBe(false) - }) - it('color', async () => { - const radio = await page.$('.r') - expect(await radio.property('color')).toBe('#007aff') - await page.setData({ - color: '#63acfc', - }) - expect(await radio.property('color')).toBe('#63acfc') - }) - it('disabled', async () => { - const radio = await page.$('.r2') - expect(await radio.property('disabled')).toBe(true) - await page.setData({ - disabled: false, - }) - expect(await radio.property('disabled')).toBe(false) - }) -}) +function getData(key = '') { + return new Promise(async (resolve, reject) => { + const data = await page.data() + resolve(key ? data[key] : data) + }) +} + +let page +beforeAll(async () => { + page = await program.reLaunch('/pages/component/radio/radio') + await page.waitFor(2000); +}) + +describe('Radio.uvue', () => { + it('change', async () => { + expect(await getData('value')).toEqual('') + const radio1 = await page.$('.r1') + await radio1.tap() + expect(await getData('value')).toEqual('r1') + const radio = await page.$('.r') + await radio.tap() + expect(await getData('value')).toEqual('r') + const radio2 = await page.$('.r2') + await radio2.tap() + expect(await getData('value')).toEqual('r') + }) + it('length', async () => { + const radioGroupElements = await page.$$('.radio-group') + expect(radioGroupElements.length).toBe(3) + const radioElements = await page.$$('.radio') + expect(radioElements.length).toBe(12) + }) + it('text', async () => { + const radio = await page.$('.r1') + expect(await radio.text()).toEqual('未选中') + await page.setData({ + text: 'not selected', + }) + expect(await radio.text()).toEqual('not selected') + }) + it('checked', async () => { + const radio = await page.$('.r') + expect(await radio.property('checked')).toBe(true) + await page.setData({ + checked: false, + }) + expect(await radio.property('checked')).toBe(false) + }) + it('color', async () => { + const radio = await page.$('.r') + expect(await radio.attribute('color')).toBe('#007aff') + await page.setData({ + color: '#63acfc', + }) + expect(await radio.attribute('color')).toBe('#63acfc') + }) + it('disabled', async () => { + const radio = await page.$('.r2') + expect(await radio.attribute('disabled')).toBe(true + '') + await page.setData({ + disabled: false, + }) + expect(await radio.attribute('disabled')).toBe(false + '') + }) +}) diff --git a/pages/component/scroll-view/scroll-view-props.test.js b/pages/component/scroll-view/scroll-view-props.test.js index 68b9b83feb42de7c1cb1d676419deb67b25296b8..9506178bc0c3fa554b87fa184b7c1324f50fb159 100644 --- a/pages/component/scroll-view/scroll-view-props.test.js +++ b/pages/component/scroll-view/scroll-view-props.test.js @@ -25,7 +25,7 @@ describe('component-native-scroll-view', () => { }) await page.waitFor(600) const element = await page.$('#scrollViewY') - const scrollTop = await element.attribute("scrollTop") + const scrollTop = await element.property("scrollTop") console.log("check_scroll_top---"+scrollTop) expect(scrollTop-600).toBeGreaterThanOrEqual(0) }) @@ -37,7 +37,7 @@ describe('component-native-scroll-view', () => { }) await page.waitFor(600) const element = await page.$('#scrollViewY') - const scrollTop = await element.attribute("scrollTop") + const scrollTop = await element.property("scrollTop") console.log("check_scroll_into_view_top--"+scrollTop) await page.setData({ scrollIntoView: "" @@ -54,7 +54,7 @@ describe('component-native-scroll-view', () => { const value = await page.callMethod('checkScrollWidth') expect(value).toBe(true) }) - + //检测横向scrollLeft属性赋值 it('check_scroll_left', async () => { await page.setData({ @@ -62,11 +62,11 @@ describe('component-native-scroll-view', () => { }) await page.waitFor(600) const element = await page.$('#scrollViewX') - const scrollLeft = await element.attribute("scrollLeft") + const scrollLeft = await element.property("scrollLeft") console.log("check_scroll_left---"+scrollLeft) expect(scrollLeft-600).toBeGreaterThanOrEqual(0) }) - + //检测横向scroll_into_view属性赋值 it('check_scroll_into_view_left', async () => { await page.setData({ @@ -74,7 +74,7 @@ describe('component-native-scroll-view', () => { }) await page.waitFor(600) const element = await page.$('#scrollViewX') - const scrollLeft = await element.attribute("scrollLeft") + const scrollLeft = await element.property("scrollLeft") console.log("check_scroll_into_view_left--"+scrollLeft) await page.setData({ scrollIntoView: "" diff --git a/pages/component/scroll-view/scroll-view-props.uvue b/pages/component/scroll-view/scroll-view-props.uvue index 556b4bd6a4fe25b497caabcbe187fbae4f74391f..08c204799a4777e1e17008eeb68ab0d99bed55a3 100644 --- a/pages/component/scroll-view/scroll-view-props.uvue +++ b/pages/component/scroll-view/scroll-view-props.uvue @@ -5,7 +5,7 @@ @@ -15,9 +15,9 @@ + @scrolltolower="scrolltolower" @scroll="scroll" @scrollend="scrollend" ref="scrollViewY" id="scrollViewY" style="width: 100%;height: 100%;"> {{item.label}} @@ -40,10 +40,10 @@ 是否横向滚动 - - - 是否竖向滚动 - + + + 是否竖向滚动 + @@ -91,7 +91,7 @@ data() { return { items: [] as Item[], - scrollX: false, + scrollX: false, scrollY: true, rebound: false, scrollTop: 0, @@ -122,20 +122,20 @@ this.scrollTop = e.detail.value; }, changeDirectionX() { - this.scrollX = !this.scrollX; - if(this.scrollX) { - this.scrollY = false + this.scrollX = !this.scrollX; + if(this.scrollX) { + this.scrollY = false + } + this.scrollTop = 0; + this.scrollLeft = 0; + }, + changeDirectionY() { + this.scrollY = !this.scrollY; + if(this.scrollY) { + this.scrollX = false } this.scrollTop = 0; this.scrollLeft = 0; - }, - changeDirectionY() { - this.scrollY = !this.scrollY; - if(this.scrollY) { - this.scrollX = false - } - this.scrollTop = 0; - this.scrollLeft = 0; }, handleScrollIntoView() { if (this.scrollX) { @@ -176,33 +176,33 @@ }, scrollend() { console.log("滚动停止"); - }, - onTouchMove() { - console.log("TouchMove"); - }, - //自动化测试专用 - checkScrollHeight(): Boolean { - var element = this.$refs["scrollViewY"] - if(element != null) { - var scrollHeight = (element as Element).scrollHeight - console.log("checkScrollHeight"+scrollHeight) - if(scrollHeight > 1900) { - return true - } - } - return false - }, - //自动化测试专用 - checkScrollWidth(): Boolean { - var element = this.$refs["scrollViewX"] - if(element != null) { - var scrollWidth = (element as Element).scrollWidth - console.log("checkScrollWidth---"+scrollWidth) - if(scrollWidth > 1900) { - return true - } - } - return false + }, + onTouchMove() { + console.log("TouchMove"); + }, + //自动化测试专用 + checkScrollHeight(): Boolean { + var element = this.$refs["scrollViewY"] + if(element != null) { + var scrollHeight = (element as Element).scrollHeight + console.log("checkScrollHeight"+scrollHeight) + if(scrollHeight > 1900) { + return true + } + } + return false + }, + //自动化测试专用 + checkScrollWidth(): Boolean { + var element = this.$refs["scrollViewX"] + if(element != null) { + var scrollWidth = (element as Element).scrollWidth + console.log("checkScrollWidth---"+scrollWidth) + if(scrollWidth > 1900) { + return true + } + } + return false } } } @@ -221,7 +221,7 @@ height: 400rpx; width: 100%; background-color: azure; - border-width: 2rpx; + border-width: 2rpx; border-style: solid; border-color: chocolate; } @@ -249,4 +249,4 @@ padding: 30rpx; justify-content: center; } - + diff --git a/pages/component/scroll-view/scroll-view-refresher-props.uvue b/pages/component/scroll-view/scroll-view-refresher-props.uvue index a6c45b645a6954fb116d9419d74af460af029968..f7afa3c267fa9e177bb727aad74ba887e0e40cc2 100644 --- a/pages/component/scroll-view/scroll-view-refresher-props.uvue +++ b/pages/component/scroll-view/scroll-view-refresher-props.uvue @@ -2,11 +2,11 @@ - + @refresherabort="refresherabort" style="width: 100%;height: 100%;"> {{item.label}} diff --git a/pages/component/slider-100/slider-100.uvue b/pages/component/slider-100/slider-100.uvue index d90ad7caa893bb4cd072727acf2075467321e752..78fab4b5c846068a1a05dfffde732adc6a90e33e 100644 --- a/pages/component/slider-100/slider-100.uvue +++ b/pages/component/slider-100/slider-100.uvue @@ -1,7 +1,5 @@