From b84e8305f50a62a4297e6c4efd3275c825e481c1 Mon Sep 17 00:00:00 2001 From: shutao Date: Fri, 29 Nov 2024 12:07:19 +0800 Subject: [PATCH] gird-view rename waterflow --- .../waterflow.test.js} | 18 ++-- .../waterflow.uvue} | 96 +++++++++---------- 2 files changed, 57 insertions(+), 57 deletions(-) rename pages/component/{grid-view/grid-view.test.js => waterflow/waterflow.test.js} (89%) rename pages/component/{grid-view/grid-view.uvue => waterflow/waterflow.uvue} (78%) diff --git a/pages/component/grid-view/grid-view.test.js b/pages/component/waterflow/waterflow.test.js similarity index 89% rename from pages/component/grid-view/grid-view.test.js rename to pages/component/waterflow/waterflow.test.js index 583f15c2..432f4442 100644 --- a/pages/component/grid-view/grid-view.test.js +++ b/pages/component/waterflow/waterflow.test.js @@ -1,7 +1,7 @@ const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() const isMP = platformInfo.startsWith('mp') -describe('component-native-grid-view', () => { +describe('component-native-waterflow', () => { if (isMP || platformInfo.indexOf('web') > -1) { it('skip mp', () => { expect(1).toBe(1) @@ -11,8 +11,8 @@ describe('component-native-grid-view', () => { let page beforeAll(async () => { - //打开grid-view测试页 - page = await program.reLaunch('/pages/component/grid-view/grid-view') + //打开waterflow测试页 + page = await program.reLaunch('/pages/component/waterflow/waterflow') await page.waitFor(600) }) @@ -20,7 +20,7 @@ describe('component-native-grid-view', () => { it('check_scroll_top', async () => { await page.callMethod('confirm_scroll_top_input', 600) await page.waitFor(600) - const listElement = await page.$('#gridview') + const listElement = await page.$('#waterflow') const scrollTop = await listElement.attribute("scrollTop") console.log("check_scroll_top---"+scrollTop) expect(scrollTop-600).toBeGreaterThanOrEqual(0) @@ -98,16 +98,16 @@ describe('component-native-grid-view', () => { it('check_scroll_into_view_top', async () => { await page.callMethod('setScrollIntoView', 'item---3') await page.waitFor(600) - const gridElement = await page.$('#gridview') - const scrollTop = await gridElement.attribute("scrollTop") + const waterflowElement = await page.$('#waterflow') + const scrollTop = await waterflowElement.attribute("scrollTop") console.log("check_scroll_into_view_top--"+scrollTop) await page.callMethod('setScrollIntoView', 'item---0') expect(scrollTop-280).toBeGreaterThanOrEqual(0) }) - //检测grid-view属性变化 截图校验 - it('check_grid_view_props', async () => { - await page.callMethod('testModifyGridViewProps') + //检测waterflow属性变化 截图校验 + it('check_waterflow_view_props', async () => { + await page.callMethod('testModifyWaterflowProps') await page.waitFor(600) const image = await program.screenshot({fullPage: false}); expect(image).toSaveImageSnapshot(); diff --git a/pages/component/grid-view/grid-view.uvue b/pages/component/waterflow/waterflow.uvue similarity index 78% rename from pages/component/grid-view/grid-view.uvue rename to pages/component/waterflow/waterflow.uvue index b520525a..a591701d 100644 --- a/pages/component/grid-view/grid-view.uvue +++ b/pages/component/waterflow/waterflow.uvue @@ -5,7 +5,7 @@ currentTarget : UniElement | null; direction ?: string } - type gridItemData = { + type flowItemData = { height : number, text : string } @@ -23,7 +23,7 @@ scroll_top_input: 0, scroll_left_input: 0, refresher_background_input: "#FFF", - scrollData: [] as Array, + scrollData: [] as Array, size_enum: [{ "value": 0, "name": "item---0" }, { "value": 3, "name": "item---3" }] as ItemType[], scrollIntoView: "", refresherrefresh: false, @@ -40,7 +40,7 @@ cross_axis_count: 2, main_axis_gap: 2, cross_axis_gap: 2, - gridViewPadding: [10, 5, 10, 5] as Array, + waterflowPadding: [10, 5, 10, 5] as Array, loadMore: true, isLoadMore: true } @@ -68,17 +68,17 @@ { height: 90, text: "item---17" }, { height: 130, text: "item---18" }, { height: 140, text: "item---19" }, - ] as Array + ] as Array }, methods: { - grid_view_click() { console.log("组件被点击时触发") }, - grid_view_touchstart() { console.log("手指触摸动作开始") }, - grid_view_touchmove() { console.log("手指触摸后移动") }, - grid_view_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") }, - grid_view_touchend() { console.log("手指触摸动作结束") }, - grid_view_tap() { console.log("手指触摸后马上离开") }, - grid_view_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") }, - grid_view_refresherpulling(e : RefresherEvent) { + waterflow_click() { console.log("组件被点击时触发") }, + waterflow_touchstart() { console.log("手指触摸动作开始") }, + waterflow_touchmove() { console.log("手指触摸后移动") }, + waterflow_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") }, + waterflow_touchend() { console.log("手指触摸动作结束") }, + waterflow_tap() { console.log("手指触摸后马上离开") }, + waterflow_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") }, + waterflow_refresherpulling(e : RefresherEvent) { console.log("下拉刷新控件被下拉") if (this.reset) { if (e.detail.dy > 45) { @@ -88,7 +88,7 @@ } } }, - grid_view_refresherrefresh() { + waterflow_refresherrefresh() { console.log("下拉刷新被触发 ") this.refresherrefresh = true this.refresher_triggered_boolean = true @@ -98,14 +98,14 @@ this.refresher_triggered_boolean = false }, 1500) }, - grid_view_refresherrestore() { + waterflow_refresherrestore() { this.refresherrefresh = false this.state = 3 this.reset = true console.log("下拉刷新被复位") }, - grid_view_refresherabort() { console.log("下拉刷新被中止") }, - grid_view_scrolltoupper(e : UniScrollToUpperEvent) { + waterflow_refresherabort() { console.log("下拉刷新被中止") }, + waterflow_scrolltoupper(e : UniScrollToUpperEvent) { console.log("滚动到顶部/左边,会触发 scrolltoupper 事件 direction=" + e.detail.direction) this.checkEventTest({ type: e.type, @@ -114,7 +114,7 @@ direction: e.detail.direction, } as ScrollEventTest, 'scrolltoupper') }, - grid_view_scrolltolower(e : UniScrollToLowerEvent) { + waterflow_scrolltolower(e : UniScrollToLowerEvent) { console.log("滚动到底部/右边,会触发 scrolltolower 事件 direction=" + e.detail.direction) this.checkEventTest({ type: e.type, @@ -123,7 +123,7 @@ direction: e.detail.direction, } as ScrollEventTest, 'scrolltolower') }, - grid_view_scroll(e : UniScrollEvent) { + waterflow_scroll(e : UniScrollEvent) { console.log("滚动时触发,event.detail = ", e.detail) this.scrollDetailTest = e.detail this.checkEventTest({ @@ -132,7 +132,7 @@ currentTarget: e.currentTarget } as ScrollEventTest, 'scroll') }, - grid_view_scrollend(e : UniScrollEvent) { + waterflow_scrollend(e : UniScrollEvent) { console.log("滚动结束时触发", e.detail) this.scrollEndDetailTest = e.detail this.checkEventTest({ @@ -141,13 +141,13 @@ currentTarget: e.currentTarget } as ScrollEventTest, 'scrollend') }, - grid_item_click() { console.log("grid-item组件被点击时触发") }, - grid_item_touchstart() { console.log("手指触摸grid-item组件动作开始") }, - grid_item_touchmove() { console.log("手指触摸grid-item组件后移动") }, - grid_item_touchcancel() { console.log("手指触摸grid-item组件动作被打断,如来电提醒,弹窗") }, - grid_item_touchend() { console.log("手指触摸grid-item组件动作结束") }, - grid_item_tap() { console.log("手指触摸grid-item组件后马上离开") }, - grid_item_longpress() { console.log("grid-item组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") }, + flow_item_click() { console.log("flow-item组件被点击时触发") }, + flow_item_touchstart() { console.log("手指触摸flow-item组件动作开始") }, + flow_item_touchmove() { console.log("手指触摸flow-item组件后移动") }, + flow_item_touchcancel() { console.log("手指触摸flow-item组件动作被打断,如来电提醒,弹窗") }, + flow_item_touchend() { console.log("手指触摸flow-item组件动作结束") }, + flow_item_tap() { console.log("手指触摸flow-item组件后马上离开") }, + flow_item_longpress() { console.log("flow-item组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") }, change_refresher_triggered_boolean(checked : boolean) { this.refresher_triggered_boolean = checked }, change_refresher_enabled_boolean(checked : boolean) { this.refresher_enabled_boolean = checked }, change_scroll_with_animation_boolean(checked : boolean) { this.scroll_with_animation_boolean = checked }, @@ -181,7 +181,7 @@ }, //自动化测试例专用 check_scroll_height() : Boolean { - var listElement = this.$refs["gridview"] as UniElement + var listElement = this.$refs["waterflow"] as UniElement console.log("check_scroll_height--" + listElement.scrollHeight) if (listElement.scrollHeight > 1400) { return true @@ -212,11 +212,11 @@ this.main_axis_gap = e.detail.value }, //仅自动化测试调用 - testModifyGridViewProps() { + testModifyWaterflowProps() { this.cross_axis_count = 4 this.main_axis_gap = 6 this.cross_axis_gap = 6 - this.gridViewPadding = [5, 10, 5, 10] as Array + this.waterflowPadding = [5, 10, 5, 10] as Array } } } @@ -224,34 +224,34 @@