You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/07/28 04:17:52 UTC

[2/5] incubator-weex git commit: * [ios] update image onload event failed case

* [ios] update image onload event failed case


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e4c466b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e4c466b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e4c466b7

Branch: refs/heads/0.16-dev
Commit: e4c466b7d6a797eb72cbbfa646650b79280e458a
Parents: 29f5ecb
Author: acton393 <zh...@gmail.com>
Authored: Wed Jul 26 18:36:17 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Jul 26 18:36:17 2017 +0800

----------------------------------------------------------------------
 test/pages/image-onload.vue                  | 14 ++++++++++++--
 test/scripts/components/image-onload.test.js | 10 ++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e4c466b7/test/pages/image-onload.vue
----------------------------------------------------------------------
diff --git a/test/pages/image-onload.vue b/test/pages/image-onload.vue
index 0c0b309..7d0167c 100644
--- a/test/pages/image-onload.vue
+++ b/test/pages/image-onload.vue
@@ -1,20 +1,30 @@
 <template>
-  <scroller>
+  <scroller style='alignItems:center'>
     <image style="width: 500;height: 500;" src="https://gw.alicdn.com/tps/TB1bEMYKXXXXXaLaXXXXXXXXXXX-360-388.png" @load="onload"></image>
     <text test-id='imgSize' style="font-size:30">{{size}}</text>
+    <image style="width: 300;height: 300;border-width:2px;" src="https://cn.vuejs.org/images/logo.png1" @load="onloadFailed"></image>
+    <text test-id='download' style="font-size:30">{{download}}</text>
   </scroller>
 </template>
 <script>
   module.exports = {
     data : function(){
       return {
-      size:"-1,-1"
+      size:"-1,-1",
+      download:'success'
       }
     },
     methods : {
       onload : function(e) {
         nativeLog(JSON.stringify(e))
         this.size = e.size.naturalWidth + ',' + e.size.naturalHeight;
+      },
+      onloadFailed:function(e) {
+        if (e.success){
+          this.download = 'success'; 
+        }else {
+          this.download ='failed';
+        }
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e4c466b7/test/scripts/components/image-onload.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/image-onload.test.js b/test/scripts/components/image-onload.test.js
index c3a7570..7c0e6d8 100644
--- a/test/scripts/components/image-onload.test.js
+++ b/test/scripts/components/image-onload.test.js
@@ -51,6 +51,16 @@ describe('image onload @ignore-ios', function () {
         }
         assert.equal(text, '360,388')
     })
+  });
+
+  it('#2 test download image failed event', () => {
+    return driver
+    .sleep(5000)
+    .elementById('download')
+    .text()
+    .then((text)=>{
+        assert.equal(text, 'failed')
+    })
   })
 });