You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by zs...@apache.org on 2017/04/10 03:24:17 UTC
[09/10] incubator-weex git commit: * [test] fix recycler test problems
* [test] fix recycler test problems
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/982da124
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/982da124
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/982da124
Branch: refs/heads/0.12-dev
Commit: 982da1245e64f518680b91356abf30a45005287d
Parents: 53b61da
Author: \u9690\u98ce <cx...@apache.org>
Authored: Fri Apr 7 11:58:24 2017 +0800
Committer: \u9690\u98ce <cx...@apache.org>
Committed: Fri Apr 7 11:58:24 2017 +0800
----------------------------------------------------------------------
.../Component/Recycler/WXRecyclerComponent.m | 1 +
.../WeexSDK/Sources/Component/WXListComponent.m | 2 ++
test/pages/components/recycler.vue | 12 ++++------
test/scripts/components/recycler.test.js | 25 ++++++++++++--------
4 files changed, 22 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/982da124/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index 842fa1f..92daf1c 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -348,6 +348,7 @@ typedef enum : NSUInteger {
}
[cellView.contentView addSubview:contentView];
+ [cellView setAccessibilityIdentifier:contentView.accessibilityIdentifier];
return cellView;
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/982da124/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index c598a3d..8037799 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -610,6 +610,8 @@
[cellView.contentView addSubview:cell.view];
+ [cellView setAccessibilityIdentifier:cell.view.accessibilityIdentifier];
+
WXLogDebug(@"Created cell:%@ view:%@ cellView:%@ at indexPath:%@", cell.ref, cell.view, cellView, indexPath);
return cellView;
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/982da124/test/pages/components/recycler.vue
----------------------------------------------------------------------
diff --git a/test/pages/components/recycler.vue b/test/pages/components/recycler.vue
index 7a55136..ae52e7a 100644
--- a/test/pages/components/recycler.vue
+++ b/test/pages/components/recycler.vue
@@ -42,7 +42,7 @@
<text class="stickyText">Content Offset:{{contentOffset}}</text>
</div>
</header>
- <cell v-for="(item, index) in items" :key="item.src" class="cell" :test-id="item.testid" ref="index">
+ <cell v-for="(item, index) in items" :key="item.src" class="cell" :test-id="'cell' + index" ref="index">
<div class="item" @click="onItemclick(item.behaviour, index)" @appear="itemAppear(item.src)" @disappear="itemDisappear(item.src)">
<text v-if="item.name" class="itemName">{{item.name}}</text>
<image class="itemPhoto" :src="item.src"></image>
@@ -304,14 +304,10 @@
]
let repeatItems = [];
- // for (let i = 0; i < 3; i++) {
+ for (let i = 0; i < 3; i++) {
repeatItems.push(...items)
- // }
-
- for(let i =0;i< repeatItems.length;i++ ){
- repeatItems[i].testid = 'cell'+i;
- console.log(repeatItems[i].testid)
- }
+ }
+
return {
padding: 0,
refreshing: false,
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/982da124/test/scripts/components/recycler.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/recycler.test.js b/test/scripts/components/recycler.test.js
index ba75fa8..21e8f79 100644
--- a/test/scripts/components/recycler.test.js
+++ b/test/scripts/components/recycler.test.js
@@ -25,7 +25,7 @@ const isAndroid = platform === 'android';
// const footerPath = '//recycler[1]/div[1]'
const isApproximate = (x, y) => {
- return Math.abs(x - y) <= isAndroid ? 1 : 0.5
+ return Math.abs(x - y) <= (isAndroid ? 1 : 1.5)
}
// if (isAndroid) {
@@ -130,7 +130,7 @@ describe('recycler', function () {
it('#2 test column count', () => {
return driver
- .elementById('cell3')
+ .elementById('cell2')
.click()
.elementById('cell0')
.getRect()
@@ -307,14 +307,14 @@ describe('recycler', function () {
it('#9 test moving cell', () => {
return driver
- .elementById('cell28')
+ .elementById('cell29')
.click()
.elementById('fixed1')
.click()
- .elementById('cell28')
+ .elementById('cell27')
.getRect()
.then((rect)=>{
- console.log(`cell 28 rect after moving cell 29 to 1:${JSON.stringify(rect)}`)
+ console.log(`cell 28 rect after moving cell 30 to 1:${JSON.stringify(rect)}`)
assert.isOk(isApproximate(rect.x, 381 * scaleFactor))
assert.isOk(isApproximate(rect.y, screenHeight - 94 * scaleFactor - rect.height))
assert.isOk(isApproximate(rect.width, 369 * scaleFactor))
@@ -323,7 +323,7 @@ describe('recycler', function () {
it('#10 test recycler padding', () => {
return driver
- .elementById('cell27')
+ .elementById('cell26')
.click()
.elementById('fixed1')
.click()
@@ -348,14 +348,14 @@ describe('recycler', function () {
.elementById('cell27')
.getRect()
.then((rect)=>{
- console.log(`cell 28 rect after setting padding to 12:${JSON.stringify(rect)}`)
+ console.log(`cell 27 rect after setting padding to 12:${JSON.stringify(rect)}`)
assert.isOk(isApproximate(rect.x, 12 * scaleFactor))
assert.isOk(isApproximate(rect.width, 357 * scaleFactor))
})
.elementById('cell28')
.getRect()
.then((rect)=>{
- console.log(`cell 29 rect after setting padding to 12:${JSON.stringify(rect)}`)
+ console.log(`cell 28 rect after setting padding to 12:${JSON.stringify(rect)}`)
assert.isOk(isApproximate(rect.x, 381 * scaleFactor))
assert.isOk(isApproximate(rect.width, 357 * scaleFactor))
})
@@ -366,10 +366,15 @@ describe('recycler', function () {
it('#11 test onscroll', () => {
let originContentOffset = 0
return driver
- .elementById('cell28')
+ .elementById('cell28')
+ .getRect()
+ .then((rect)=>{
+ console.log(`cell 29 rect:${JSON.stringify(rect)}`)
+ })
+ .elementById('cell28')
.click()
.elementById('stickyText1')
- .text()
+ .text()
.then(text => {
console.log(text)
originContentOffset = Number.parseInt(text.replace('Content Offset:-',''))