Repository: incubator-weex
Updated Branches:
  refs/heads/0.12-dev 90c358303 -> 9d6648840


* [test] update case about line-height


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

Branch: refs/heads/0.12-dev
Commit: 9d6648840946f172d7a1eb4edfc8ea5256209711
Parents: 347180c
Author: YorkShen <shenyua...@gmail.com>
Authored: Tue Apr 18 18:53:15 2017 +0800
Committer: YorkShen <shenyua...@gmail.com>
Committed: Tue Apr 18 19:48:52 2017 +0800

----------------------------------------------------------------------
 test/scripts/components/text.test.js | 174 +++++++++++++++---------------
 1 file changed, 86 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9d664884/test/scripts/components/text.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/text.test.js 
b/test/scripts/components/text.test.js
index 2924c7c..d280eda 100644
--- a/test/scripts/components/text.test.js
+++ b/test/scripts/components/text.test.js
@@ -14,120 +14,118 @@ describe('weex text', function () {
   before(function () {
     return util.init(driver)
       .get(util.getPage('/components/text-layout.js'))
-      .waitForElementById("lines", util.getGETActionWaitTimeMills(),1000)
+      .waitForElementById("lines", util.getGETActionWaitTimeMills(), 1000)
   });
 
   after(function () {
-      // return util.quit(driver);
+    // return util.quit(driver);
   })
 
 
-  let scaleFactor = 0 
+  let scaleFactor = 0
   let screenWidth = 0
-  it ('#1 Window size', () =>{
+  it('#1 Window size', () => {
     return driver
-    .getWindowSize()
-    .then(size=>{
-      screenWidth =  size.width
-      scaleFactor = screenWidth/ 750
-    })
+      .getWindowSize()
+      .then(size => {
+        screenWidth = size.width
+        scaleFactor = screenWidth / 750
+      })
   })
 
   it('#2 Text Content', () => {
     return driver
-    .elementById('text-only')
-    .text()
-    .then((text)=>{
-      assert.equal(text,'Hello World')
-    })
+      .elementById('text-only')
+      .text()
+      .then((text) => {
+        assert.equal(text, 'Hello World')
+      })
   })
 
-  it ('#3 Line Height', () =>{
+  it('#3 Line Height', () => {
     return driver
-    .elementById('lines')
-    .getRect()
-    .then(rect => {
-       console.log(rect)
-       console.log(screenWidth)
-       assert.equal(rect.width, screenWidth)
-       assert.closeTo(rect.height, 32 * scaleFactor*2, 2)
-       scroll(rect.height)
-    })
+      .elementById('lines')
+      .getRect()
+      .then(rect => {
+        assert.equal(rect.width, screenWidth)
+        assert.closeTo(rect.height, 32 * scaleFactor * 2, 2)
+        scroll(rect.height)
+      })
   })
 
-   it ('#4 Font Size', () =>{
+  it('#4 Font Size', () => {
     return driver
-    .elementById('font')
-    .getRect()
-    .then(rect => {
-       assert.equal(rect.width, screenWidth)
-       assert.isAtLeast(rect.height, Math.floor(2 * 48 * scaleFactor))
-       scroll(rect.height)
-    })
+      .elementById('font')
+      .getRect()
+      .then(rect => {
+        assert.equal(rect.width, screenWidth)
+        assert.isAtLeast(rect.height, Math.floor(2 * 48 * scaleFactor))
+        scroll(rect.height)
+      })
   })
 
-   it ('#5 Fixed-Size', () =>{
+  it('#5 Fixed-Size', () => {
     return driver
-    .elementById('fixed-size')
-    .getRect()
-    .then(rect => {
-       assert.equal(rect.width, Math.floor(300 * scaleFactor))
-       assert.equal(rect.height, Math.floor(100 * scaleFactor))
-       scroll(rect.height)
-    })
+      .elementById('fixed-size')
+      .getRect()
+      .then(rect => {
+        assert.equal(rect.width, Math.floor(300 * scaleFactor))
+        assert.equal(rect.height, Math.floor(100 * scaleFactor))
+        scroll(rect.height)
+      })
   })
 
-   it ('#6 flex:1; align-Items: stretch; flex-direction:row', () =>{
+  it('#6 flex:1; align-Items: stretch; flex-direction:row', () => {
     return driver
-    .elementById('flexgrow-alignitems')
-    .getRect()
-    .then(rect => {
-       assert.equal(rect.width, Math.floor(500 * scaleFactor))
-       assert.equal(rect.height, Math.floor(300 * scaleFactor))
-       scroll(rect.height)
-    })
-   })
-  
-   it ('#7 flex:1; align-Items: center; flex-direction:row', () =>{
+      .elementById('flexgrow-alignitems')
+      .getRect()
+      .then(rect => {
+        assert.equal(rect.width, Math.floor(500 * scaleFactor))
+        assert.equal(rect.height, Math.floor(300 * scaleFactor))
+        scroll(rect.height)
+      })
+  })
+
+  it('#7 flex:1; align-Items: center; flex-direction:row', () => {
     return driver
-    .elementById('flexgrow')
-    .getRect()
-    .then(rect => {
-       assert.equal(rect.width, Math.floor(500 * scaleFactor))
-       assert.equal(rect.height, Math.floor(40 * scaleFactor))
-       scroll(rect.height)
-    })
-   })
+      .elementById('flexgrow')
+      .getRect()
+      .then(rect => {
+        assert.equal(rect.width, Math.floor(500 * scaleFactor))
+        assert.closeTo(rect.height, 40 * scaleFactor, 1)
+        scroll(rect.height)
+      })
+  })
 
-   it ('#8 flex:1; align-Items: stretch; flex-direction:column', () =>{
+  it('#8 flex:1; align-Items: stretch; flex-direction:column', () => {
     return driver
-    .elementById('flexgrow-alignitems-coloumn')
-    .getRect()
-    .then(rect => {
-       assert.equal(rect.width, Math.floor(500 * scaleFactor))
-       assert.equal(rect.height, Math.floor(300 * scaleFactor))
-       scroll(rect.height)
-    })
-   })
-  
-   it ('#9 flex:1; align-Items: auto; flex-direction:column', () =>{
+      .elementById('flexgrow-alignitems-coloumn')
+      .getRect()
+      .then(rect => {
+        assert.equal(rect.width, Math.floor(500 * scaleFactor))
+        assert.closeTo(rect.height, 300 * scaleFactor, 1)
+        scroll(rect.height)
+      })
+  })
+
+  it('#9 flex:1; align-Items: auto; flex-direction:column', () => {
     return driver
-    .elementById('flexgrow-column')
-    .getRect()
-    .then(rect => {
-       assert.isBelow(rect.width, 500 * scaleFactor/2)
-       assert.equal(rect.height, Math.floor(300 * scaleFactor))
-       scroll(rect.height)
-    })
-   })
+      .elementById('flexgrow-column')
+      .getRect()
+      .then(rect => {
+        assert.isBelow(rect.width, 500 * scaleFactor / 2)
+        assert.closeTo(rect.height, 300 * scaleFactor, 1)
+        scroll(rect.height)
+      })
+  })
 
-   function scroll(height){
-      driver.touch('drag', {
-        fromX:100,
-        fromY:300+height,
-        toX:  100,
-        toY: 300,
-        duration: 0.5
-       })
-   }
-});
+  function scroll(height) {
+    driver.touch('drag', {
+      fromX: 100,
+      fromY: 300 + height,
+      toX: 100,
+      toY: 300,
+      duration: 0.5
+    })
+  }
+});
\ No newline at end of file

Reply via email to