You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by da...@apache.org on 2017/07/20 08:29:31 UTC
[01/50] incubator-weex git commit: * [html5] improve test case
Repository: incubator-weex
Updated Branches:
refs/heads/0.15-dev 831cb26d3 -> 9764e25ea
* [html5] improve test 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/635d27a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/635d27a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/635d27a2
Branch: refs/heads/0.15-dev
Commit: 635d27a296ed26c93e3170965c5fbc906e4fe3a7
Parents: 59c0ef9
Author: erha19 <fa...@gmail.com>
Authored: Sun Jul 9 20:12:25 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Sun Jul 9 20:12:25 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/pref.js | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/635d27a2/html5/test/render/vue/utils/pref.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/pref.js b/html5/test/render/vue/utils/pref.js
index 79a234f..3aad2b8 100644
--- a/html5/test/render/vue/utils/pref.js
+++ b/html5/test/render/vue/utils/pref.js
@@ -19,9 +19,18 @@
import {
collectStatPerf,
tagFirstScreen,
- tagImg
+ tagImg,
+ tagBeforeCreate,
+ tagRootMounted,
+ tagMounted,
+ tagBeforeUpdate,
+ tagUpdated,
+ tagBegin,
+ tagEnd
} from '../../../../render/vue/utils/perf'
describe('utils', function () {
+ before(function(){
+ })
describe('pref', function () {
before(function () {
this.clock = sinon.useFakeTimers()
@@ -31,17 +40,26 @@ describe('utils', function () {
})
it('collectStatPerf', function () {
expect(collectStatPerf).to.be.a('function')
- collectStatPerf('totalTime', (new Date()).getTime())
+ expect(collectStatPerf('totalTime', (new Date()).getTime())).to.be.a('undefined')
+ expect(collectStatPerf()).to.be.a('undefined')
})
it('tagFirstScreen', function () {
+ const weexEmit = sinon.stub(window.weex,'emit')
expect(tagFirstScreen).to.be.a('function')
tagFirstScreen()
+ expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
window._first_screen_detected = false
tagFirstScreen()
+ expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
+ expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
+ weexEmit.restore()
})
it('tagImg', function () {
+ const weexEmit = sinon.stub(window.weex,'emit')
tagImg()
this.clock.tick(500)
+ expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
expect(tagImg).to.be.a('function')
})
})
[44/50] incubator-weex git commit: * [html5] improve style unit test
case
Posted by da...@apache.org.
* [html5] improve style unit test 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/9c84d237
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9c84d237
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9c84d237
Branch: refs/heads/0.15-dev
Commit: 9c84d23729d424d18d7c0a2c474dc339f4617067
Parents: 646ce6b
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 16:32:38 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 16:32:38 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/style.js | 119 +++++++++++++++++++++++++-----
1 file changed, 100 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9c84d237/html5/test/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/style.js b/html5/test/render/vue/utils/style.js
index 6bc1a78..2110f23 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -24,71 +24,153 @@ import {
normalizeString,
normalizeNumber,
normalizeUnitsNum,
+ addTransform,
+ addTranslateX,
trimComment
} from '../../../../render/vue/utils/style'
-import { init } from '../../../../render/vue/env/viewport'
-
+import {
+ init
+} from '../../../../render/vue/env/viewport'
describe('style', function () {
// const rect = document.documentElement.getBoundingClientRect()
// const info = {}
- const { scale, dpr } = init()
+ const {
+ scale,
+ dpr
+ } = init()
it('should support using 0.5px to paint 1px width border', () => {
expect(supportHairlines()).to.be.false
window.devicePixelRatio = 2
- // phantomjs didn't support using 0.5px to paint 1px width border
+ // phantomjs didn't support using 0.5px to paint 1px width border
expect(supportHairlines()).to.be.false
})
it('should support stick style', () => {
// phantomjs support stick true
expect(supportSticky()).to.be.true
})
-
it('should normalize units numbers', () => {
expect(normalizeUnitsNum('100px')).to.equal(100 * scale + 'px')
expect(normalizeUnitsNum('100')).to.equal(100 * scale + 'px')
expect(normalizeUnitsNum('100wx')).to.equal(100 * scale * dpr + 'px')
expect(normalizeUnitsNum('20wm')).to.equal('')
})
-
it('should normalize number style vals', () => {
expect(normalizeNumber('width', 10)).to.equal(10 * scale + 'px')
expect(normalizeNumber('width', 1.2)).to.equal(1.2 * scale + 'px')
})
-
it('should normalize string style vals', () => {
expect(normalizeString('width', '100%')).to.equal('100%')
- expect(normalizeString('transform', 'translate3d(10px, 10px, 10px)'))
- .to.equal(`translate3d(${10 * scale}px, ${10 * scale}px, ${10 * scale}px)`)
- expect(normalizeString('border-bottom', '4px solid #112233'))
- .to.equal(`${4 * scale}px solid #112233`)
- expect(normalizeString('border-left', '4wx dotted red'))
- .to.equal(`${4 * scale * dpr}px dotted red`)
+ expect(normalizeString('transform', 'translate3d(10px, 10px, 10px)')).to.equal(`translate3d(${10 * scale}px, ${10 * scale}px, ${10 * scale}px)`)
+ expect(normalizeString('border-bottom', '4px solid #112233')).to.equal(`${4 * scale}px solid #112233`)
+ expect(normalizeString('border-left', '4wx dotted red')).to.equal(`${4 * scale * dpr}px dotted red`)
})
-
it('should normalize style object', () => {
const style = {
width: '200px',
flexDirection: 'row',
flex: 1,
fontSize: 12,
- transform: 'translate3d(100px, 100px, 0)'
+ transform: 'translate3d(100px, 100px, 0)',
+ // just for run default branch
+ reg: /^(\d+)/
}
const res = normalizeStyle(style)
- console.log(res)
expect(normalizeString('transform', style.transform)).to.equal(res.transform)
expect(normalizeString('width', style.width)).to.equal(res.width)
expect(normalizeString('flexDirection', style.flexDirection)).to.equal(res.flexDirection)
expect(normalizeNumber('fontSize', style.fontSize)).to.equal(res.fontSize)
- // flex is in noUnitsNumberKeys array
+ // flex is in noUnitsNumberKeys array
expect(style.flex).to.equal(res.flex)
+ expect(style.reg).to.equal(res.reg)
})
-
it('should trim comment in style.', () => {
const cssText = '.ani-point0[data-v-4c05cc1a] {\n left: 88px;\n top: 88px;\n}\n.ani-point1[data-v-4c05cc1a] {\n /* left: 43px;\n top: 71px;*/\n}'
const trimmed = '.ani-point0[data-v-4c05cc1a] {\n left: 88px;\n top: 88px;\n}\n.ani-point1[data-v-4c05cc1a] {\n \n}'
expect(trimComment(cssText)).to.equal(trimmed)
})
})
+describe('transform', () => {
+ describe('should add translate style to the element', () => {
+ const style = {
+ translate: 'translate3d(2px, 2px, 2px)',
+ rotate: 'rotate(30deg)'
+ }
+ const nodeStyle = {
+ translate: 'translate3d(5px, 5px, 5px)',
+ scale: 'scale(0.5)',
+ rotate: 'rotate(50deg)'
+ }
+ let node = null
+ beforeEach(() => {
+ node = document.createElement('div')
+ node.style.transform = nodeStyle.translate + ' ' + nodeStyle.scale + ' ' + nodeStyle.rotate
+ node.style.webkitTransform = nodeStyle.translate + ' ' + nodeStyle.scale + ' ' + nodeStyle.rotate
+ })
+ it('should inherit transform properties from element', () => {
+ addTransform(node, style, false)
+ expect(node.style.transform).to.be.equal(style.translate + ' ' + nodeStyle.scale + ' ' + style.rotate + ' ')
+ // webkitTransform will remove last whitespace automatically
+ expect(node.style.webkitTransform).to.be.equal(style.translate + ' ' + nodeStyle.scale + ' ' + style.rotate)
+ })
+ it('should replace all transform properties', () => {
+ addTransform(node, style, true)
+ expect(node.style.transform).to.be.equal(style.translate + ' ' + style.rotate + ' ')
+ // webkitTransform will remove last whitespace automatically
+ expect(node.style.webkitTransform).to.be.equal(style.translate + ' ' + style.rotate)
+ })
+ })
+ describe('should add translate X to the element', () => {
+ const nodeStyle = {
+ translate: 'translate3d(5px, 5px, 5px)',
+ scale: 'scale(0.5)',
+ rotate: 'rotate(50deg)'
+ }
+ let node = null
+ beforeEach(() => {
+ node = document.createElement('div')
+ // node.style.transform = nodeStyle.translate+' '+nodeStyle.scale+' '+ nodeStyle.rotate
+ // node.style.webkitTransform = nodeStyle.translate+' '+nodeStyle.scale+' '+ nodeStyle.rotate
+ })
+ it('should element has translate property', () => {
+ const toAdd = 2
+ const translateReg = /[+-\d.]+[pw]x/
+ const translateReplaceFunction = ($0) => {
+ return (parseFloat($0) + toAdd) + 'px'
+ }
+ const removeSpaceReg = /(\s?)/g
+ node.style.transform = nodeStyle.translate + ' ' + nodeStyle.scale + ' ' + nodeStyle.rotate
+ node.style.webkitTransform = nodeStyle.translate + ' ' + nodeStyle.scale + ' ' + nodeStyle.rotate
+ addTranslateX(node, toAdd)
+ // webkitTransform will reserved whitespace between translate value but transform will not.
+ expect(node.style.transform).to.be.equal(nodeStyle.translate.replace(translateReg, translateReplaceFunction).replace(removeSpaceReg, '') + ' ' + nodeStyle.scale + ' ' + nodeStyle.rotate + ' ')
+ // webkitTransform will remove last whitespace automatically
+ expect(node.style.webkitTransform).to.be.equal(nodeStyle.translate.replace(translateReg, translateReplaceFunction) + ' ' + nodeStyle.scale + ' ' + nodeStyle.rotate)
+ })
+ it('should element does not have translate property', () => {
+ const toAdd = 2
+ const translateReg = /[+-\d.]+[pw]x/
+ const translateReplaceFunction = ($0) => {
+ return (parseFloat($0) + toAdd) + 'px'
+ }
+ const defaultTranslate = 'translate3d(0px, 0px, 0px)'
+ node.style.transform = nodeStyle.scale + ' ' + nodeStyle.rotate
+ node.style.webkitTransform = nodeStyle.scale + ' ' + nodeStyle.rotate
+ addTranslateX(node, toAdd)
+ // transform will reserved whitespace when translate on the last position.
+ expect(node.style.transform).to.be.equal(nodeStyle.scale + ' ' + nodeStyle.rotate + ' ' + defaultTranslate.replace(translateReg, translateReplaceFunction) + ' ')
+ // webkitTransform will remove last whitespace automatically
+ expect(node.style.webkitTransform).to.be.equal(nodeStyle.scale + ' ' + nodeStyle.rotate + ' ' + defaultTranslate.replace(translateReg, translateReplaceFunction))
+ })
+ it('should elemet remain', () => {
+ const toAdd = 0
+ node.style.transform = nodeStyle.scale + ' ' + nodeStyle.rotate
+ node.style.webkitTransform = nodeStyle.scale + ' ' + nodeStyle.rotate
+ addTranslateX(node, toAdd)
+ expect(node.style.transform).to.be.equal(nodeStyle.scale + ' ' + nodeStyle.rotate)
+ expect(node.style.webkitTransform).to.be.equal(nodeStyle.scale + ' ' + nodeStyle.rotate)
+ })
+ })
+})
describe('autoPrefix', () => {
const style = {
width: '200px',
@@ -96,7 +178,6 @@ describe('autoPrefix', () => {
flex: 1,
transform: 'translate3d(100px, 100px, 0)'
}
-
it('should add prefix for styles.', () => {
const res = autoPrefix(style)
const {
[28/50] incubator-weex git commit: * [html5] imporve unit test case
Posted by da...@apache.org.
* [html5] imporve unit test 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/89c66d4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/89c66d4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/89c66d4e
Branch: refs/heads/0.15-dev
Commit: 89c66d4e4d0bf67cd0f50273cd9cfbdf946eb02e
Parents: 92bf1d3
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 17:52:52 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 17:52:52 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/lazyload.js | 48 ++++++++++++++++------------
1 file changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/89c66d4e/html5/test/render/vue/utils/lazyload.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/lazyload.js b/html5/test/render/vue/utils/lazyload.js
index 5f5eeaa..7fc25a7 100644
--- a/html5/test/render/vue/utils/lazyload.js
+++ b/html5/test/render/vue/utils/lazyload.js
@@ -19,49 +19,55 @@
import * as lazyload from '../../../../render/vue/utils/lazyload'
describe('utils', function () {
describe('lazyload', function () {
- const validImage_transparent = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
- const validImage_black = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
+ const validImageTransparent = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
+ const validImageBlack = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
const invalidImage = 'data:image/jpeg;base64,'
before(() => {
- // this.clock = sinon.useFakeTimers()
+ // this.clock = sinon.useFakeTimers()
})
after(() => {
- // this.clock.restore()
+ // this.clock.restore()
})
- it('fireLazyload', () => {
+ it('fireLazyload', (done) => {
const {
fireLazyload
} = lazyload
const node = document.createElement('figure')
const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
+ // const IMG_REC_INDENT = 500
+ node.setAttribute('img-src', invalidImage)
+ node.setAttribute('img-placeholder', validImageBlack)
node.style.height = '10px'
- node.setAttribute('img-src', validImage_transparent)
- node.setAttribute('img-placeholder', validImage_transparent)
- document.body.appendChild(node)
+ // coverage branch if (item._src_loading)
+ node._src_loading = true
+ // coverage branch if (Array.isArray(el))
fireLazyload([node])
- setTimeout(() => {
- console.log(node)
- },200)
- expect(node.style.backgroundImage.replace(urlReg,'')).to.be.equal('url('+validImage_transparent+')')
- node.setAttribute('img-src', validImage_black)
+ node._src_loading = false
fireLazyload(node, true)
- expect(node.style.backgroundImage.replace(urlReg,'')).to.be.equal('url('+validImage_black+')')
- document.body.removeChild(node)
+ setTimeout(() => {
+ expect(node.style.backgroundImage.replace(urlReg, '')).to.be.equal('url(' + validImageBlack + ')')
+ done()
+ document.body.removeChild(node)
+ }, 100)
})
- it('getThrottleLazyload', () => {
+ it('getThrottleLazyload', (done) => {
const {
getThrottleLazyload
} = lazyload
const node = document.createElement('figure')
const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
- const wait = 100,duration = wait + (wait > 25 ? wait : 25)
+ const wait = 100
node.style.height = '10px'
- node.setAttribute('img-src', validImage_transparent)
- node.setAttribute('img-placeholder', validImage_transparent)
+ node.setAttribute('img-src', validImageTransparent)
+ node.setAttribute('img-placeholder', validImageBlack)
document.body.appendChild(node)
+ window._weex_perf.renderTime.length = 3
getThrottleLazyload(wait, node)()
- document.body.removeChild(node)
- expect(node.style.backgroundImage.replace(urlReg,'')).to.be.equal('url('+validImage_transparent+')')
+ setTimeout(() => {
+ expect(node.style.backgroundImage.replace(urlReg, '')).to.be.equal('url(' + validImageTransparent + ')')
+ done()
+ document.body.removeChild(node)
+ }, 100)
})
})
})
[41/50] incubator-weex git commit: * [html5] formate code style
@notdanger
Posted by da...@apache.org.
* [html5] formate code style @notdanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a2e8b085
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a2e8b085
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a2e8b085
Branch: refs/heads/0.15-dev
Commit: a2e8b08551e8f2a36a09d2508da31a7cb7a61284
Parents: d2aacf7
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 14:46:25 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 14:46:25 2017 +0800
----------------------------------------------------------------------
html5/render/vue/utils/func.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a2e8b085/html5/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/func.js b/html5/render/vue/utils/func.js
index 5018b09..386a932 100644
--- a/html5/render/vue/utils/func.js
+++ b/html5/render/vue/utils/func.js
@@ -24,7 +24,7 @@ import {
* Mix properties into target object.
* the rightest object's value has the highest priority.
*/
-export function extend (to: {}, ...args: Array < {} >): {} {
+export function extend (to: {}, ...args: Array<{}>): {} {
if (!args || args.length <= 0) {
return to
}
@@ -43,7 +43,7 @@ export function extend (to: {}, ...args: Array < {} >): {} {
* mostly for merging styles. (that's why '' is falsy but still should be counted in.)
* the rightest object's value has the highest priority.
*/
-export function extendTruthy (to: {}, ...args: Array < {} >): {} {
+export function extendTruthy (to: {}, ...args: Array<{}>): {} {
if (!args || args.length <= 0) {
return to
}
@@ -63,7 +63,7 @@ export function extendTruthy (to: {}, ...args: Array < {} >): {} {
/**
* Mix specified properties into target object.
*/
-export function extendKeys (to: {}, from: {} = {}, keys: Array < string >): {} {
+export function extendKeys (to: {}, from: {} = {}, keys: Array<string>): {} {
(keys || []).forEach(key => {
from && (to[key] = from[key])
})
@@ -72,7 +72,7 @@ export function extendKeys (to: {}, from: {} = {}, keys: Array < string >): {} {
/**
* Extract specified properties from src to target object.
*/
-export function extractKeys (to: {}, from: {} = {}, keys: Array < string >) {
+export function extractKeys (to: {}, from: {} = {}, keys: Array<string>) {
if (!from) {
return to
}
[39/50] incubator-weex git commit: * [html5] update to eslint formate
@notdanger
Posted by da...@apache.org.
* [html5] update to eslint formate @notdanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b8606a40
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b8606a40
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b8606a40
Branch: refs/heads/0.15-dev
Commit: b8606a405794a486a9bc21b65dd124d5c3e77e1a
Parents: d2315fb
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 14:35:04 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 14:35:04 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/style.js | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b8606a40/html5/test/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/style.js b/html5/test/render/vue/utils/style.js
index 31b672c..1f1e78f 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -18,8 +18,9 @@
*/
import {
supportHairlines,
+ supportSticky,
autoPrefix,
- // normalizeStyle,
+ normalizeStyle,
normalizeString,
normalizeNumber,
normalizeUnitsNum,
@@ -34,9 +35,14 @@ describe('style', function () {
it('should support using 0.5px to paint 1px width border', () => {
expect(supportHairlines()).to.be.false
window.devicePixelRatio = 2
- //phantomjs didn't support using 0.5px to paint 1px width border
+ // phantomjs didn't support using 0.5px to paint 1px width border
expect(supportHairlines()).to.be.false
})
+ it('should support stick style', () => {
+ // phantomjs support stick true
+ expect(supportSticky()).to.be.true
+ })
+
it('should normalize units numbers', () => {
expect(normalizeUnitsNum('100px')).to.equal(100 * scale + 'px')
expect(normalizeUnitsNum('100')).to.equal(100 * scale + 'px')
@@ -69,7 +75,21 @@ describe('style', function () {
expect(trimComment(cssText)).to.equal(trimmed)
})
})
-
+describe('normalizeStyle', () => {
+ const style = {
+ width: '200px',
+ flexDirection: 'row',
+ flex: 1,
+ transform: 'translate3d(100px, 100px, 0)'
+ }
+ it('should switch to suitble case', () => {
+ const res = normalizeStyle(style)
+ expect(normalizeString('transform', style.transform)).to.equal(res.transform)
+ expect(normalizeString('width', style.width)).to.equal(res.width)
+ expect(normalizeString('flexDirection', style.flexDirection)).to.equal(res.flexDirection)
+ expect(normalizeNumber('flex', style.flex)).to.equal(res.flex)
+ })
+})
describe('autoPrefix', () => {
const style = {
width: '200px',
[35/50] incubator-weex git commit: * [html5] eslint formate for
component
Posted by da...@apache.org.
* [html5] eslint formate for component
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a1db177c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a1db177c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a1db177c
Branch: refs/heads/0.15-dev
Commit: a1db177ce965f3853e7f2b8ef5afa6a29c313d79
Parents: 066be09
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 20:53:55 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 20:53:55 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/component.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a1db177c/html5/test/render/vue/utils/component.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/component.js b/html5/test/render/vue/utils/component.js
index 8248493..9de64b0 100644
--- a/html5/test/render/vue/utils/component.js
+++ b/html5/test/render/vue/utils/component.js
@@ -1,3 +1,4 @@
+/*global Event*/
import { init } from '../helper/runtime'
import div from '../../../../render/vue/components/div'
@@ -19,9 +20,8 @@ init('utils component', (Vue, helper) => {
before(() => {
helper.register('div', div)
- vm =helper.createVm(firstScreenAppearBundle, id)
+ vm = helper.createVm(firstScreenAppearBundle, id)
})
-
describe('component functions', () => {
it('getParentScroller', () => {
const { getParentScroller } = components
@@ -50,7 +50,7 @@ init('utils component', (Vue, helper) => {
setTimeout(() => {
helper.unregisterDone(id)
done()
- },25)
+ }, 25)
})
})
})
[34/50] incubator-weex git commit: * [html5] rebuild perf unit test
code
Posted by da...@apache.org.
* [html5] rebuild perf unit test code
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/066be096
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/066be096
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/066be096
Branch: refs/heads/0.15-dev
Commit: 066be09627f1f703af0a0cf387fac38fc6135bf6
Parents: 25947dd
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 20:50:24 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 20:50:24 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/perf.js | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/066be096/html5/test/render/vue/utils/perf.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/perf.js b/html5/test/render/vue/utils/perf.js
index c3b7ac7..824daa3 100644
--- a/html5/test/render/vue/utils/perf.js
+++ b/html5/test/render/vue/utils/perf.js
@@ -37,6 +37,12 @@ describe('utils', function () {
after(() => {
this.clock.restore()
})
+ beforeEach(() => {
+ this.weexEmit = sinon.stub(window.weex, 'emit')
+ })
+ afterEach(() => {
+ this.weexEmit.restore()
+ })
it('collectStatPerf', () => {
const time = (new Date()).getTime()
collectStatPerf('totalTime', time)
@@ -45,24 +51,20 @@ describe('utils', function () {
expect(collectStatPerf()).to.be.a('undefined')
})
it('tagFirstScreen', () => {
- const weexEmit = sinon.stub(window.weex, 'emit')
expect(tagFirstScreen).to.be.a('function')
tagFirstScreen()
- expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
- expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
window._first_screen_detected = false
tagFirstScreen()
- expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
- expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
- weexEmit.restore()
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
+ expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
})
it('tagImg', () => {
- const weexEmit = sinon.stub(window.weex, 'emit')
tagImg()
this.clock.tick(500)
- expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
expect(tagImg).to.be.a('function')
- weexEmit.restore()
})
it('tagBeforeCreate', () => {
tagBeforeCreate()
[13/50] incubator-weex git commit: * [html5] merge open && close &&
message
Posted by da...@apache.org.
* [html5] merge open && close && message
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/bca5422d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/bca5422d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/bca5422d
Branch: refs/heads/0.15-dev
Commit: bca5422d4a7223803ef1252b542f33e1a0680be5
Parents: 57599bd
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 15:51:01 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 15:51:01 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 28 ++++++-------------------
1 file changed, 6 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/bca5422d/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index fa6f757..1a18294 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -21,13 +21,6 @@ import websocket from '../../../../render/vue/modules/websocket/websocket'
const TestUrl = 'ws://echo.websocket.org'
/** @test {webSocket module} */
describe('webSocket module', function () {
- after(function (done) {
- const ws = new WebSocket(TestUrl)
- ws.addEventListener('open', function () {
- ws.send('shutdown')
- done()
- })
- })
describe('extends Standard WebSocket API', function () {
context('should inherit', function () {
const ws = websocket.WebSocket(TestUrl)
@@ -54,33 +47,24 @@ describe('webSocket module', function () {
context('should forward native events', function () {
let ws = null
beforeEach(function () {
- ws = websocket.WebSocket(TestUrl)
+ ws = websocket.WebSocket(TestUrl,'')
})
afterEach(function () {
websocket.close()
})
- it('open', function (done) {
- websocket.onopen = function () {
- done()
- }
- })
- it('close', function (done) {
+ it('open && message && close', function (done) {
let closed = false
+ const message = 'Test'
ws.onclose = function () {
if (!closed) {
- done()
closed = true
}
+ expect(closed).to.be.true
+ done()
}
- websocket.onopen = function () {
- websocket.close()
- }
- })
- it('message', function (done) {
- const message = 'Test'
websocket.onmessage = function (e) {
expect(e.data).to.be.equal(message)
- done()
+ websocket.close()
}
websocket.onopen = function () {
websocket.send(message)
[37/50] incubator-weex git commit: * [html5] add copy right
header@notdanger
Posted by da...@apache.org.
* [html5] add copy right header@notdanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/229ba3af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/229ba3af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/229ba3af
Branch: refs/heads/0.15-dev
Commit: 229ba3af68f4cc77ab64ef5d0ad25efcfcf886dd
Parents: e878c2d
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 11:14:28 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 11:14:28 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/component.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/229ba3af/html5/test/render/vue/utils/component.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/component.js b/html5/test/render/vue/utils/component.js
index a8aee77..ed6df2e 100644
--- a/html5/test/render/vue/utils/component.js
+++ b/html5/test/render/vue/utils/component.js
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
/*global Event*/
import { init } from '../helper/runtime'
import div from '../../../../render/vue/components/div'
[02/50] incubator-weex git commit: * [html5] remove useless console
log
Posted by da...@apache.org.
* [html5] remove useless console log
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/41357557
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/41357557
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/41357557
Branch: refs/heads/0.15-dev
Commit: 4135755702839afe221be19a49fa1e0f42cbeab3
Parents: 635d27a
Author: erha19 <fa...@gmail.com>
Authored: Sun Jul 9 20:12:46 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Sun Jul 9 20:12:46 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/event.js | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/41357557/html5/test/render/vue/utils/event.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/event.js b/html5/test/render/vue/utils/event.js
index d44bd95..5be2e7f 100644
--- a/html5/test/render/vue/utils/event.js
+++ b/html5/test/render/vue/utils/event.js
@@ -24,7 +24,6 @@ describe('utils', function () {
createEvent
} = event
const clickEvent = createEvent('', 'click')
- console.log(createEvent('', 'click'))
expect(createEvent).to.be.a('function')
expect(clickEvent.type).to.be.equal('click')
expect(clickEvent.target).to.be.a('null')
[38/50] incubator-weex git commit: * [html5] improve style unit test
case @notdanger
Posted by da...@apache.org.
* [html5] improve style unit test case @notdanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d2315fb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d2315fb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d2315fb4
Branch: refs/heads/0.15-dev
Commit: d2315fb4ac74a7cca7fe33032a80e7e8ed892474
Parents: 229ba3a
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 11:34:43 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 11:34:43 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/style.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2315fb4/html5/test/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/style.js b/html5/test/render/vue/utils/style.js
index 4ef26c0..31b672c 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -17,6 +17,7 @@
* under the License.
*/
import {
+ supportHairlines,
autoPrefix,
// normalizeStyle,
normalizeString,
@@ -30,7 +31,12 @@ describe('style', function () {
// const rect = document.documentElement.getBoundingClientRect()
// const info = {}
const { scale, dpr } = init()
-
+ it('should support using 0.5px to paint 1px width border', () => {
+ expect(supportHairlines()).to.be.false
+ window.devicePixelRatio = 2
+ //phantomjs didn't support using 0.5px to paint 1px width border
+ expect(supportHairlines()).to.be.false
+ })
it('should normalize units numbers', () => {
expect(normalizeUnitsNum('100px')).to.equal(100 * scale + 'px')
expect(normalizeUnitsNum('100')).to.equal(100 * scale + 'px')
@@ -68,6 +74,7 @@ describe('autoPrefix', () => {
const style = {
width: '200px',
flexDirection: 'row',
+ flex: 1,
transform: 'translate3d(100px, 100px, 0)'
}
[07/50] incubator-weex git commit: - [html5] remove index.js on test
folder
Posted by da...@apache.org.
- [html5] remove index.js on test folder
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c96f0e39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c96f0e39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c96f0e39
Branch: refs/heads/0.15-dev
Commit: c96f0e390720f844b13e869645c66d4db993970e
Parents: 0378b36
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:04:48 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:04:48 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/index.js | 157 ------------------------------
1 file changed, 157 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c96f0e39/html5/test/render/vue/utils/index.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/index.js b/html5/test/render/vue/utils/index.js
deleted file mode 100644
index 80edce8..0000000
--- a/html5/test/render/vue/utils/index.js
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import * as utils from '../../../../render/vue/utils'
-describe('utils', function () {
- describe('index', function () {
- it('cached', function () {
- expect(utils.cached).to.be.a('function')
- })
- it('camelize', function () {
- const {
- camelize
- } = utils
- expect(camelize).to.be.a('function')
- expect(camelize('')).to.be.equal('')
- expect(camelize('dispaly')).to.be.equal('dispaly')
- expect(camelize('-webkit-transform')).to.be.equal('WebkitTransform')
- expect(camelize('text-overflow')).to.be.equal('textOverflow')
- expect(camelize('a-b-c-d')).to.be.equal('aBCD')
- })
- it('camelizeKeys', function () {
- const {
- camelizeKeys
- } = utils
- const camelizeobj = {
- dispaly: 'none',
- '-webkit-transform': 'all 1s ease'
- }
- const shouldBe = camelizeKeys(camelizeobj)
- const expected = {
- dispaly: 'none',
- WebkitTransform: 'all 1s ease'
- }
- expect(camelizeKeys).to.be.a('function')
- expect(shouldBe).to.be.deep.equal(expected)
- })
- it('capitalize', function () {
- const {
- capitalize
- } = utils
- expect(capitalize).to.be.a('function')
- expect(capitalize('')).to.be.equal('')
- expect(capitalize('string')).to.be.equal('String')
- expect(capitalize('string object')).to.be.equal('String object')
- expect(capitalize('[string object]')).to.be.equal('[string object]')
- expect(capitalize('I have an apple')).to.be.equal('I have an apple')
- })
- it('hyphenate', function () {
- const {
- hyphenate
- } = utils
- expect(hyphenate).to.be.a('function')
- expect(hyphenate('')).to.be.equal('')
- expect(hyphenate('dispaly')).to.be.equal('dispaly')
- expect(hyphenate('WebkitTransform')).to.be.equal('webkit-transform')
- expect(hyphenate('textOverflow')).to.be.equal('text-overflow')
- expect(hyphenate('aBCD')).to.be.equal('a-b-c-d')
- })
- it('hyphenateKeys', function () {
- const {
- hyphenateKeys
- } = utils
- const hyphenateobj = {
- dispaly: 'none',
- WebkitTransform: 'all 1s ease'
- }
- const shouldBe = hyphenateKeys(hyphenateobj)
- const expected = {
- dispaly: 'none',
- 'webkit-transform': 'all 1s ease'
- }
- expect(hyphenateKeys).to.be.a('function')
- expect(shouldBe).to.be.deep.equal(expected)
- })
- it('hyphenateStyleKeys', function () {
- const {
- hyphenateStyleKeys
- } = utils
- const hyphenateStyleObj = {
- dispaly: 'none',
- 'webkit-transform': 'all 1s ease'
- }
- const shouldBe = hyphenateStyleKeys(hyphenateStyleObj)
- const expected = {
- dispaly: 'none',
- '-webkit-transform': 'all 1s ease'
- }
- expect(hyphenateStyleKeys).to.be.a('function')
- expect(shouldBe).to.be.deep.equal(expected)
- })
- it('camelToKebab', function () {
- const {
- camelToKebab
- } = utils
- expect(camelToKebab).to.be.a('function')
- expect(camelToKebab('')).to.be.equal('')
- expect(camelToKebab('ABC')).to.be.equal('-a-b-c')
- })
- it('appendCss', function () {
- const {
- appendCss
- } = utils
- const cssid = 'append-test'
- const css = '.test{font-size:12px}'
- expect(appendCss).to.be.a('function')
- appendCss(css, cssid, true)
- let handler = document.querySelector('#' + cssid)
- expect(handler.textContent).to.be.equal(css)
- const anothercss = '.test2{font-size:16px}'
- appendCss(anothercss, cssid, true)
- handler = document.querySelector('#' + cssid)
- expect(handler.textContent).to.be.equal(anothercss)
- })
- it('nextFrame', function (done) {
- const {
- nextFrame
- } = utils
- let shouldBe
- const expected = 'test'
- const cb = function () {
- shouldBe = expected
- }
- expect(nextFrame).to.be.a('function')
- nextFrame(cb)
- setTimeout(() => {
- expect(shouldBe).to.be.equal(expected)
- done()
- }, 10)
- })
- it('toCSSText', function () {
- const {
- toCSSText
- } = utils
- const expected = 'font-size:12px;'
- const shouldBe = toCSSText({
- 'font-size': '12px'
- })
- expect(toCSSText).to.be.a('function')
- expect(shouldBe).to.be.equal(expected)
- })
- })
-})
[50/50] incubator-weex git commit: Merge branch '0.15-dev' of
https://github.com/erha19/incubator-weex into 0.15-dev
Posted by da...@apache.org.
Merge branch '0.15-dev' of https://github.com/erha19/incubator-weex into 0.15-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9764e25e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9764e25e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9764e25e
Branch: refs/heads/0.15-dev
Commit: 9764e25ea1d8abdd803f6b2547f268d470d91ee0
Parents: 831cb26 2211546
Author: MrRaindrop <te...@gmail.com>
Authored: Thu Jul 20 16:28:44 2017 +0800
Committer: MrRaindrop <te...@gmail.com>
Committed: Thu Jul 20 16:28:44 2017 +0800
----------------------------------------------------------------------
build/config.js | 1 +
build/karma.vue.conf.js | 7 +
html5/render/vue/modules/websocket/websocket.js | 1 +
html5/render/vue/utils/event.js | 6 +-
html5/render/vue/utils/func.js | 136 +++++++--
html5/render/vue/utils/index.js | 104 -------
html5/render/vue/utils/perf.js | 3 +-
html5/test/render/vue/modules/websocket.js | 90 +++---
html5/test/render/vue/utils/component.js | 50 +++-
html5/test/render/vue/utils/event.js | 78 ++++++
html5/test/render/vue/utils/func.js | 278 +++++++++++++++++--
html5/test/render/vue/utils/lazyload.js | 106 +++++++
html5/test/render/vue/utils/perf.js | 132 +++++++++
html5/test/render/vue/utils/style.js | 157 +++++++++--
html5/test/render/vue/utils/type.js | 49 ++++
html5/test/render/vue/validator/index.js | 31 ++-
16 files changed, 981 insertions(+), 248 deletions(-)
----------------------------------------------------------------------
[29/50] incubator-weex git commit: * [html5] change code formate
Posted by da...@apache.org.
* [html5] change code formate
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f0dd9d01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f0dd9d01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f0dd9d01
Branch: refs/heads/0.15-dev
Commit: f0dd9d01e2546f1c9a760b345c6400fefe2a67d3
Parents: 89c66d4
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 17:53:34 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 17:53:34 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/validator/index.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f0dd9d01/html5/test/render/vue/validator/index.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/validator/index.js b/html5/test/render/vue/validator/index.js
index 3525dc6..e525cf7 100644
--- a/html5/test/render/vue/validator/index.js
+++ b/html5/test/render/vue/validator/index.js
@@ -16,10 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-import * as validator from '../../../../render/vue/validator'
+import { validateStyles, validateProps, configure } from '../../../../render/vue/validator'
describe('validator', function () {
- const { validateStyles, validateProps, configure } = validator
const warn = function () {}
before(() => {
[03/50] incubator-weex git commit: * [html5] improve utils/pref.js
unit test cast coverage
Posted by da...@apache.org.
* [html5] improve utils/pref.js unit test cast coverage
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/500a3b07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/500a3b07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/500a3b07
Branch: refs/heads/0.15-dev
Commit: 500a3b07b02e5499d33a9dc55dee3f60e9a32d9d
Parents: 4135755
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 10:20:30 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 10:20:30 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/pref.js | 48 ++++++++++++++++++++++++++++----
1 file changed, 43 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/500a3b07/html5/test/render/vue/utils/pref.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/pref.js b/html5/test/render/vue/utils/pref.js
index 3aad2b8..431ce33 100644
--- a/html5/test/render/vue/utils/pref.js
+++ b/html5/test/render/vue/utils/pref.js
@@ -19,7 +19,7 @@
import {
collectStatPerf,
tagFirstScreen,
- tagImg,
+ tagImg,
tagBeforeCreate,
tagRootMounted,
tagMounted,
@@ -29,8 +29,7 @@ import {
tagEnd
} from '../../../../render/vue/utils/perf'
describe('utils', function () {
- before(function(){
- })
+ before(function () {})
describe('pref', function () {
before(function () {
this.clock = sinon.useFakeTimers()
@@ -44,7 +43,7 @@ describe('utils', function () {
expect(collectStatPerf()).to.be.a('undefined')
})
it('tagFirstScreen', function () {
- const weexEmit = sinon.stub(window.weex,'emit')
+ const weexEmit = sinon.stub(window.weex, 'emit')
expect(tagFirstScreen).to.be.a('function')
tagFirstScreen()
expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
@@ -56,11 +55,50 @@ describe('utils', function () {
weexEmit.restore()
})
it('tagImg', function () {
- const weexEmit = sinon.stub(window.weex,'emit')
+ const weexEmit = sinon.stub(window.weex, 'emit')
tagImg()
this.clock.tick(500)
expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
expect(tagImg).to.be.a('function')
+ weexEmit.restore()
+ })
+ it('tagBeforeCreate', function () {
+ const shouldBe = tagBeforeCreate()
+ this.clock.tick(25)
+ expect(shouldBe).to.be.a('undefined')
+ expect(tagBeforeCreate).to.be.a('function')
+ })
+ it('tagRootMounted', function () {
+ expect(tagRootMounted()).to.be.a('undefined')
+ expect(tagRootMounted).to.be.a('function')
+ })
+ it('tagMounted', function () {
+ const tagmount = tagMounted()
+ this.clock.tick(25)
+ expect(tagMounted).to.be.a('function')
+ expect(tagmount).to.be.a('undefined')
+ })
+ it('tagBeforeUpdate', function () {
+ const tagbeforeupdate = tagBeforeUpdate()
+ this.clock.tick(25)
+ expect(tagBeforeUpdate).to.be.a('function')
+ expect(tagbeforeupdate).to.be.a('undefined')
+ })
+ it('tagUpdated', function () {
+ const tagupdated = tagUpdated()
+ this.clock.tick(25)
+ expect(tagUpdated).to.be.a('function')
+ expect(tagupdated).to.be.a('undefined')
+ })
+ it('tagBegin', function () {
+ const tagbegin = tagBegin()
+ expect(tagbegin).to.be.a('undefined')
+ expect(tagBegin).to.be.a('function')
+ })
+ it('tagEnd', function () {
+ const tagend = tagEnd()
+ expect(tagend).to.be.a('undefined')
+ expect(tagEnd).to.be.a('function')
})
})
})
[33/50] incubator-weex git commit: * [html5] improve component unit
test case
Posted by da...@apache.org.
* [html5] improve component unit test 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/25947ddb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/25947ddb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/25947ddb
Branch: refs/heads/0.15-dev
Commit: 25947ddbbd07a605152340f9ff5ef75365f33259
Parents: 30a52ef
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 20:49:59 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 20:49:59 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/component.js | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/25947ddb/html5/test/render/vue/utils/component.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/component.js b/html5/test/render/vue/utils/component.js
index fd97d5b..8248493 100644
--- a/html5/test/render/vue/utils/component.js
+++ b/html5/test/render/vue/utils/component.js
@@ -2,6 +2,7 @@ import { init } from '../helper/runtime'
import div from '../../../../render/vue/components/div'
import firstScreenAppearBundle from '../data/build/dotvue/first-screen-appear.js'
+import * as components from '../../../../render/vue/utils/component'
init('utils component', (Vue, helper) => {
const spys = {
@@ -14,14 +15,27 @@ init('utils component', (Vue, helper) => {
}
const id = 'test-first-screen-appear'
+ let vm = null
before(() => {
helper.register('div', div)
+ vm =helper.createVm(firstScreenAppearBundle, id)
})
-
- describe('watchAppear', function () {
+
+ describe('component functions', () => {
+ it('getParentScroller', () => {
+ const { getParentScroller } = components
+ expect(getParentScroller).to.be.a('function')
+ expect(getParentScroller(vm)).to.be.a('undefined')
+ })
+ it('isComponentVisible', () => {
+ const { isComponentVisible } = components
+ expect(isComponentVisible).to.be.a('function')
+ expect(isComponentVisible(vm)).to.be.true
+ })
+ })
+ describe('watchAppear', () => {
it('should work when mounted and updated.', function (done) {
- helper.createVm(firstScreenAppearBundle, id)
helper.registerDone(id, () => {
const { appear: appearSpy, disappear: disappearSpy } = spys
expect(appearSpy.callCount).to.equal(2)
@@ -32,8 +46,11 @@ init('utils component', (Vue, helper) => {
expect(appearSpy.args[0][0].direction).to.not.exist
expect(appearSpy.args[1][0].direction).to.not.exist
expect(disappearSpy.args[0][0].direction).to.not.exist
- helper.unregisterDone(id)
- done()
+ window.dispatchEvent(new Event('scroll'))
+ setTimeout(() => {
+ helper.unregisterDone(id)
+ done()
+ },25)
})
})
})
[16/50] incubator-weex git commit: * [html5] fix eslint wraning
Posted by da...@apache.org.
* [html5] fix eslint wraning
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a60c54fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a60c54fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a60c54fa
Branch: refs/heads/0.15-dev
Commit: a60c54facecf02e0c0926bd1a49c7c3e3ff1a00b
Parents: 75de22e
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 21:12:35 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 21:12:35 2017 +0800
----------------------------------------------------------------------
html5/render/vue/modules/websocket/websocket.js | 1 +
html5/test/render/vue/modules/websocket.js | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a60c54fa/html5/render/vue/modules/websocket/websocket.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/modules/websocket/websocket.js b/html5/render/vue/modules/websocket/websocket.js
index 6488cb8..e79f8de 100644
--- a/html5/render/vue/modules/websocket/websocket.js
+++ b/html5/render/vue/modules/websocket/websocket.js
@@ -19,6 +19,7 @@
/**
* websocket module
*/
+/*global WebSocket*/
export default (function () {
const registerListeners = ['onopen', 'onmessage', 'onerror', 'onclose']
const ws = {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a60c54fa/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index 1a18294..487334a 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-/*global WebSocket*/
import websocket from '../../../../render/vue/modules/websocket/websocket'
const TestUrl = 'ws://echo.websocket.org'
/** @test {webSocket module} */
@@ -47,7 +46,7 @@ describe('webSocket module', function () {
context('should forward native events', function () {
let ws = null
beforeEach(function () {
- ws = websocket.WebSocket(TestUrl,'')
+ ws = websocket.WebSocket(TestUrl, '')
})
afterEach(function () {
websocket.close()
@@ -64,7 +63,7 @@ describe('webSocket module', function () {
}
websocket.onmessage = function (e) {
expect(e.data).to.be.equal(message)
- websocket.close()
+ setTimeout(() => { websocket.close() }, 200)
}
websocket.onopen = function () {
websocket.send(message)
[12/50] incubator-weex git commit: * [html5] export perf value
Posted by da...@apache.org.
* [html5] export perf value
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/57599bde
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/57599bde
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/57599bde
Branch: refs/heads/0.15-dev
Commit: 57599bde817f572d07e2c9891dfaa14fc7dfb5a7
Parents: f55ef8d
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 15:50:11 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 15:50:11 2017 +0800
----------------------------------------------------------------------
html5/render/vue/utils/perf.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/57599bde/html5/render/vue/utils/perf.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/perf.js b/html5/render/vue/utils/perf.js
index 190b78e..0ae04bd 100644
--- a/html5/render/vue/utils/perf.js
+++ b/html5/render/vue/utils/perf.js
@@ -23,9 +23,8 @@
*/
import { debounce, depress, extend } from './func'
-
// performance tracker for weex.
-const perf: {
+export const perf: {
earliestBeforeCreates: Array<number>,
latestMounts: Array<number>,
earliestBeforeUpdates: Array<number>,
[15/50] incubator-weex git commit: * [html5] import perf value from
perf.js
Posted by da...@apache.org.
* [html5] import perf value from perf.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/75de22ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/75de22ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/75de22ed
Branch: refs/heads/0.15-dev
Commit: 75de22ed7881204d0b2a43c75ee574ca6ed8c614
Parents: c671008
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 15:53:53 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 15:53:53 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/perf.js | 34 +++++++++++++-------------------
1 file changed, 14 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/75de22ed/html5/test/render/vue/utils/perf.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/perf.js b/html5/test/render/vue/utils/perf.js
index 87ee213..c3b7ac7 100644
--- a/html5/test/render/vue/utils/perf.js
+++ b/html5/test/render/vue/utils/perf.js
@@ -26,25 +26,25 @@ import {
tagBeforeUpdate,
tagUpdated,
tagBegin,
- tagEnd
+ tagEnd,
+ perf
} from '../../../../render/vue/utils/perf'
describe('utils', function () {
describe('pref', function () {
- before(function () {
+ before(() => {
this.clock = sinon.useFakeTimers()
})
- after(function () {
+ after(() => {
this.clock.restore()
})
- it('collectStatPerf', function () {
- const perf = window._weex_perf
+ it('collectStatPerf', () => {
const time = (new Date()).getTime()
collectStatPerf('totalTime', time)
expect(collectStatPerf).to.be.a('function')
expect(perf.stat['totalTime']).to.be.equal(time)
expect(collectStatPerf()).to.be.a('undefined')
})
- it('tagFirstScreen', function () {
+ it('tagFirstScreen', () => {
const weexEmit = sinon.stub(window.weex, 'emit')
expect(tagFirstScreen).to.be.a('function')
tagFirstScreen()
@@ -56,7 +56,7 @@ describe('utils', function () {
expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
weexEmit.restore()
})
- it('tagImg', function () {
+ it('tagImg', () => {
const weexEmit = sinon.stub(window.weex, 'emit')
tagImg()
this.clock.tick(500)
@@ -64,8 +64,7 @@ describe('utils', function () {
expect(tagImg).to.be.a('function')
weexEmit.restore()
})
- it('tagBeforeCreate', function () {
- const perf = window._weex_perf
+ it('tagBeforeCreate', () => {
tagBeforeCreate()
this.clock.tick(25)
const time = perf.earliestBeforeCreates[perf.earliestBeforeCreates.length - 1]
@@ -73,16 +72,14 @@ describe('utils', function () {
expect(perf.earliestBeforeCreates).to.have.lengthOf(1)
expect(tagBeforeCreate).to.be.a('function')
})
- it('tagRootMounted', function () {
- const perf = window._weex_perf
+ it('tagRootMounted', () => {
tagRootMounted()
const time = perf.latestMounts[perf.latestMounts.length - 1]
expect(time).to.be.a('number')
expect(perf.stat['totalTime']).to.be.equal(parseInt(time))
expect(tagRootMounted).to.be.a('function')
})
- it('tagMounted', function () {
- const perf = window._weex_perf
+ it('tagMounted', () => {
perf.firstAllMountedTime = 0
tagMounted()
this.clock.tick(25)
@@ -92,15 +89,13 @@ describe('utils', function () {
expect(perf.createTime[perf.createTime.length - 1]).to.have.all.keys('start', 'end', 'duration')
expect(perf.firstAllMountedTime).to.be.above(0)
})
- it('tagBeforeUpdate', function () {
- const perf = window._weex_perf
+ it('tagBeforeUpdate', () => {
tagBeforeUpdate()
this.clock.tick(25)
expect(tagBeforeUpdate).to.be.a('function')
expect(perf.earliestBeforeUpdates).to.have.lengthOf(1)
})
- it('tagUpdated', function () {
- const perf = window._weex_perf
+ it('tagUpdated', () => {
tagUpdated()
this.clock.tick(25)
expect(tagUpdated).to.be.a('function')
@@ -108,13 +103,12 @@ describe('utils', function () {
expect(perf.updateTime).to.have.lengthOf(1)
expect(perf.updateTime[perf.updateTime.length - 1]).to.have.all.keys('start', 'end', 'duration')
})
- it('tagBegin', function () {
+ it('tagBegin', () => {
const name = 'test'
tagBegin(name)
expect(tagBegin).to.be.a('function')
})
- it('tagEnd', function () {
- const perf = window._weex_perf
+ it('tagEnd', () => {
const name = 'test'
tagEnd(name)
expect(tagEnd).to.be.a('function')
[49/50] incubator-weex git commit: * [html5] update code formate
Posted by da...@apache.org.
* [html5] update code formate
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2211546f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2211546f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2211546f
Branch: refs/heads/0.15-dev
Commit: 2211546fb2b9532aabd9fe9cb2ff276f2403cf04
Parents: 5507e9f
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 20 11:07:48 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 20 11:07:48 2017 +0800
----------------------------------------------------------------------
build/config.js | 2 +-
html5/render/vue/utils/func.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2211546f/build/config.js
----------------------------------------------------------------------
diff --git a/build/config.js b/build/config.js
index 4325f2b..e2de931 100644
--- a/build/config.js
+++ b/build/config.js
@@ -149,4 +149,4 @@ function now () {
return (new Date(time)).toISOString().replace('T', ' ').substring(0, 16)
}
-module.exports = getConfig
\ No newline at end of file
+module.exports = getConfig
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2211546f/html5/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/func.js b/html5/render/vue/utils/func.js
index bfea8df..d4112c47 100644
--- a/html5/render/vue/utils/func.js
+++ b/html5/render/vue/utils/func.js
@@ -133,7 +133,7 @@ export function throttle (func: Function, wait: number, callLastTime: boolean) {
let last = 0
let lastTimer = null
const lastTimeDuration = wait + (wait > 25 ? wait : 25) // plus half wait time.
- return function (...args: Array <mixed>) {
+ return function (...args: Array<mixed>) {
const context = this
const time = new Date().getTime()
if (time - last > wait) {
[46/50] incubator-weex git commit: * [html5] dispatch some event
Posted by da...@apache.org.
* [html5] dispatch some event
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dac01e3f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dac01e3f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dac01e3f
Branch: refs/heads/0.15-dev
Commit: dac01e3f3ec415d69697d9208cf0bd038a0e0af4
Parents: fdad32f
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 17:44:38 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 17:44:38 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/component.js | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dac01e3f/html5/test/render/vue/utils/component.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/component.js b/html5/test/render/vue/utils/component.js
index ed6df2e..0f0b4f1 100644
--- a/html5/test/render/vue/utils/component.js
+++ b/html5/test/render/vue/utils/component.js
@@ -66,6 +66,10 @@ init('utils component', (Vue, helper) => {
expect(appearSpy.args[1][0].direction).to.not.exist
expect(disappearSpy.args[0][0].direction).to.not.exist
window.dispatchEvent(new Event('scroll'))
+ vm.$el.dispatchEvent(new Event('touchstart'))
+ vm.$el.dispatchEvent(new Event('touchmove'))
+ vm.$el.dispatchEvent(new Event('touchend'))
+ vm.$el.dispatchEvent(new Event('touchcancel'))
setTimeout(() => {
helper.unregisterDone(id)
done()
[48/50] incubator-weex git commit: * [html5] improve
validater/index.js unit test case
Posted by da...@apache.org.
* [html5] improve validater/index.js unit test 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/5507e9f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5507e9f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5507e9f2
Branch: refs/heads/0.15-dev
Commit: 5507e9f2e15082af28ade7ca846372beebeda8db
Parents: 3103148
Author: erha19 <fa...@gmail.com>
Authored: Wed Jul 19 11:52:07 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Jul 19 11:52:07 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/validator/index.js | 28 ++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5507e9f2/html5/test/render/vue/validator/index.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/validator/index.js b/html5/test/render/vue/validator/index.js
index e525cf7..c5c657a 100644
--- a/html5/test/render/vue/validator/index.js
+++ b/html5/test/render/vue/validator/index.js
@@ -27,14 +27,32 @@ describe('validator', function () {
})
it('validateStyles', () => {
- const styles = {
+ const textStyles = {
position: 'absolute',
- color: '#dddddd'
+ opacity: 1,
+ 'font-style': 'normal',
+ 'font-weight': 'bold',
+ 'text-decoration': 'none',
+ 'text-align': 'center',
+ 'text-overflow': 'clip',
+ color: '#dddddd',
+ 'font-size': '12px'
+ }
+ const divStyles = {
+ position: 'absolute',
+ 'flex-direction': 'row',
+ 'justify-content': 'center',
+ 'align-items': 'center',
+ flex: 3,
+ width: '100px',
+ top: 0,
+ 'border-top-width': '1px',
+ 'border-top-style': 'solid',
+ 'margin-left': '10px'
}
-
expect(validateStyles).to.be.a('function')
- expect(validateStyles('text', styles)).to.be.true
- expect(validateStyles('text', { opacity: 0.2 })).to.be.true
+ expect(validateStyles('text', textStyles)).to.be.true
+ expect(validateStyles('div', divStyles)).to.be.true
})
it('validateStyles (invalid)', () => {
[27/50] incubator-weex git commit: * [html5] fix phantomjs don't
support customer event bug
Posted by da...@apache.org.
* [html5] fix phantomjs don't support customer event bug
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/92bf1d3b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/92bf1d3b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/92bf1d3b
Branch: refs/heads/0.15-dev
Commit: 92bf1d3bd968c5a2acfb83de56f490026ad5a0a1
Parents: 1a77685
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 17:52:32 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 17:52:32 2017 +0800
----------------------------------------------------------------------
html5/render/vue/utils/event.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/92bf1d3b/html5/render/vue/utils/event.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/event.js b/html5/render/vue/utils/event.js
index ac84c87..94b7a94 100644
--- a/html5/render/vue/utils/event.js
+++ b/html5/render/vue/utils/event.js
@@ -39,7 +39,10 @@ export function createEvent (target, type, props) {
// event.stopPropagation()
extend(event, props)
-
+ // phantomjs don't support customer event
+ if (window.navigator.userAgent.indexOf('PhantomJS') !== -1) {
+ return event
+ }
try {
Object.defineProperty(event, 'target', {
enumerable: true,
@@ -49,7 +52,6 @@ export function createEvent (target, type, props) {
catch (err) {
return extend({}, event, { target: target || null })
}
-
return event
}
[30/50] incubator-weex git commit: Merge branch '0.15-dev' of
https://github.com/apache/incubator-weex into 0.15-dev
Posted by da...@apache.org.
Merge branch '0.15-dev' of https://github.com/apache/incubator-weex into 0.15-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b66b6263
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b66b6263
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b66b6263
Branch: refs/heads/0.15-dev
Commit: b66b62637be4a3debb8ce1412e82a4f3f9532991
Parents: f0dd9d0 3bf348d
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 17:54:49 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 17:54:49 2017 +0800
----------------------------------------------------------------------
.../com/taobao/weex/CreateFinishListener.java | 27 +++
.../com/taobao/weex/UpdateFinishListener.java | 27 +++
.../java/com/taobao/weex/WXSDKInstance.java | 39 +++++
.../com/taobao/weex/dom/WXTextDomObject.java | 4 +-
.../com/taobao/weex/ui/component/WXSlider.java | 28 +++
doc/source/cn/references/modules/timer.md | 47 +++++
doc/source/references/modules/timer.md | 59 +++++++
examples/vue/hello.vue | 2 +-
.../vue/components/scrollable/list/index.js | 3 +-
.../vue/components/scrollable/scroller.js | 3 +-
.../vue/components/scrollable/waterfall.js | 3 +-
.../render/vue/components/slider/slideMixin.js | 17 +-
html5/render/vue/core/node.js | 172 ++++++++++++++-----
html5/render/vue/env/wx-env.js | 2 +-
html5/render/vue/mixins/base.js | 16 +-
html5/render/vue/mixins/scrollable.js | 18 +-
html5/render/vue/utils/style.js | 30 +++-
html5/test/render/vue/core/node.js | 22 ++-
.../WeexSDK/Sources/Bridge/WXBridgeContext.m | 33 ++--
.../WeexSDK/Sources/Component/WXAComponent.m | 2 +-
.../Sources/Component/WXImageComponent.m | 4 +-
.../WeexSDK/Sources/Component/WXListComponent.m | 55 ++++--
.../WeexSDK/Sources/Component/WXTextComponent.m | 54 +++---
.../Sources/Component/WXVideoComponent.m | 2 +-
.../WeexSDK/Sources/Component/WXWebComponent.m | 2 +-
.../Sources/Handler/WXURLRewriteDefaultImpl.m | 2 +-
.../WeexSDK/Sources/Layout/WXComponent+Layout.m | 2 +-
ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m | 2 +-
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 2 +-
ios/sdk/WeexSDK/Sources/Module/WXDomModule.m | 8 +-
ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m | 2 +-
.../Sources/Protocol/WXURLRewriteProtocol.h | 2 +-
.../Sources/View/WXComponent+ViewManagement.m | 4 +
package.json | 2 +-
packages/weex-vue-render/package.json | 8 +-
35 files changed, 545 insertions(+), 160 deletions(-)
----------------------------------------------------------------------
[24/50] incubator-weex git commit: - [html5] remove useless test
Posted by da...@apache.org.
- [html5] remove useless test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ab67cf8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ab67cf8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ab67cf8e
Branch: refs/heads/0.15-dev
Commit: ab67cf8e49649ff90605fa7fbc220f4bcd7db900
Parents: 8bc53ca
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 15:16:14 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 15:16:14 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ab67cf8e/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index 05a2fca..257bb56 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -50,7 +50,7 @@ describe('webSocket module', function () {
context('should forward native events', function () {
let ws = null
before(() => {
- ws = websocket.WebSocket(TestUrl, '')
+ ws = websocket.WebSocket(TestUrl, 'ws')
})
after(() => {
websocket.close()
@@ -81,10 +81,6 @@ describe('webSocket module', function () {
websocket.WebSocket('')
expect(websocket.INSTANCE).to.be.null
})
- it('both url and protocol is defined', (done) => {
- websocket.WebSocket(TestUrl, 'ws')
- expect(websocket.INSTANCE).not.to.be.null
- })
})
})
})
[43/50] incubator-weex git commit: * [html5] update function
interface formate
Posted by da...@apache.org.
* [html5] update function interface formate
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/646ce6ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/646ce6ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/646ce6ba
Branch: refs/heads/0.15-dev
Commit: 646ce6babfdc2325b4874092c2596b998468bfb1
Parents: 8527a0e
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 15:16:58 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 15:16:58 2017 +0800
----------------------------------------------------------------------
html5/render/vue/utils/func.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/646ce6ba/html5/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/func.js b/html5/render/vue/utils/func.js
index 386a932..bfea8df 100644
--- a/html5/render/vue/utils/func.js
+++ b/html5/render/vue/utils/func.js
@@ -133,7 +133,7 @@ export function throttle (func: Function, wait: number, callLastTime: boolean) {
let last = 0
let lastTimer = null
const lastTimeDuration = wait + (wait > 25 ? wait : 25) // plus half wait time.
- return function (...args: Array < mixed >) {
+ return function (...args: Array <mixed>) {
const context = this
const time = new Date().getTime()
if (time - last > wait) {
[10/50] incubator-weex git commit: * [html5] move tool function into
func.js
Posted by da...@apache.org.
* [html5] move tool function into func.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5c1dc226
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5c1dc226
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5c1dc226
Branch: refs/heads/0.15-dev
Commit: 5c1dc2262a75382437edd8c76c07118de264d754
Parents: 7c42710
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:07:52 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:07:52 2017 +0800
----------------------------------------------------------------------
html5/render/vue/utils/index.js | 104 -----------------------------------
1 file changed, 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5c1dc226/html5/render/vue/utils/index.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/index.js b/html5/render/vue/utils/index.js
index 032c472..7d5dfbd 100644
--- a/html5/render/vue/utils/index.js
+++ b/html5/render/vue/utils/index.js
@@ -22,107 +22,3 @@ export * from './component'
export * from './lazyload'
export * from './style'
export * from './type'
-
-/**
- * Create a cached version of a pure function.
- */
-export function cached (fn) {
- const cache = Object.create(null)
- return function cachedFn (str) {
- const hit = cache[str]
- return hit || (cache[str] = fn(str))
- }
-}
-
-/**
- * Camelize a hyphen-delmited string.
- */
-const camelizeRE = /-(\w)/g
-export const camelize = cached(str => {
- return str.replace(camelizeRE, (_, c) => c.toUpperCase())
-})
-
-export function camelizeKeys (obj) {
- const res = {}
- for (const key in obj) {
- res[camelize(key)] = obj[key]
- }
- return res
-}
-
-/**
- * Capitalize a string.
- */
-export const capitalize = cached(str => {
- return str.charAt(0).toUpperCase() + str.slice(1)
-})
-
-/**
- * Hyphenate a camelCase string.
- */
-const hyphenateRE = /([^-])([A-Z])/g
-export const hyphenate = cached(str => {
- return str
- .replace(hyphenateRE, '$1-$2')
- .replace(hyphenateRE, '$1-$2')
- .toLowerCase()
-})
-
-export function hyphenateKeys (obj) {
- const res = {}
- for (const key in obj) {
- res[hyphenate(key)] = obj[key]
- }
- return res
-}
-
-const vendorsReg = /webkit-|moz-|o-|ms-/
-export function hyphenateStyleKeys (obj) {
- const res = {}
- for (const key in obj) {
- const hk = hyphenate(key).replace(vendorsReg, function ($0) {
- return '-' + $0
- })
- res[hk] = obj[key]
- }
- return res
-}
-
-export function camelToKebab (name) {
- if (!name) { return '' }
- return name.replace(/([A-Z])/g, function (g, g1) {
- return `-${g1.toLowerCase()}`
- })
-}
-
-export function appendCss (css, cssId, replace) {
- let style = document.getElementById(cssId)
- if (style && replace) {
- style.parentNode.removeChild(style)
- style = null
- }
- if (!style) {
- style = document.createElement('style')
- style.type = 'text/css'
- cssId && (style.id = cssId)
- document.getElementsByTagName('head')[0].appendChild(style)
- }
- style.appendChild(document.createTextNode(css))
-}
-
-export function nextFrame (callback) {
- const runner = window.requestAnimationFrame
- || window.webkitRequestAnimationFrame
- || (cb => setTimeout(cb, 16))
- runner(callback)
-}
-
-export function toCSSText (object) {
- if (!object) { return }
- const obj = hyphenateStyleKeys(object)
- let cssText = ''
- for (const key in obj) {
- cssText += `${key}:${obj[key]};`
- }
- return cssText
-}
[19/50] incubator-weex git commit: + [html5] update lazyload unit test
Posted by da...@apache.org.
+ [html5] update lazyload unit test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5521172b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5521172b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5521172b
Branch: refs/heads/0.15-dev
Commit: 5521172b0a2d7b3ce74fb4e7596a9778c5807825
Parents: 1bbe886
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 13:17:18 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 13:17:18 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/lazyload.js | 42 +++++++++++++++++-----------
1 file changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5521172b/html5/test/render/vue/utils/lazyload.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/lazyload.js b/html5/test/render/vue/utils/lazyload.js
index 8576ffc..59c5593 100644
--- a/html5/test/render/vue/utils/lazyload.js
+++ b/html5/test/render/vue/utils/lazyload.js
@@ -25,34 +25,42 @@ describe('utils', function () {
after(() => {
this.clock.restore()
})
- // it('applySrc', () => {
-
- // })
+ it('applySrc', () => {
+ const {
+ applySrc
+ } = lazyload
+ const node = document.createElement('figure')
+ node.setAttribute('img-src', 'http://via.placeholder.com/1x1')
+ node.setAttribute('img-placeholder', 'http://via.placeholder.com/2x2')
+ document.body.appendChild(node)
+ expect(applySrc(node, '')).to.be.a('undefined')
+ expect(node.attributes[0].name).to.be.equal('img-src')
+ })
it('fireLazyload', () => {
- // const {
- // fireLazyload
- // } = lazyload
- // const node = document.createElement('figure')
- // node.setAttribute('img-src', 'http://some-domain/image-src.jpg')
- // node.setAttribute('img-placeholder', 'http://some-domain/image-placeholder')
- // document.body.appendChild(node)
- // fireLazyload(node, true)
- // expect(node.style.backgroundImage).to.be.equal('url(http://some-domain/image-src.jpg)')
+ const {
+ fireLazyload
+ } = lazyload
+ const node = document.createElement('figure')
+ node.setAttribute('img-src', 'http://via.placeholder.com/1x1')
+ node.setAttribute('img-placeholder', 'http://via.placeholder.com/2x2')
+ document.body.appendChild(node)
+ fireLazyload(node, true)
+ expect(node.style.backgroundImage).to.be.equal('url(http://via.placeholder.com/1x1)')
})
it('getThrottleLazyload', () => {
const {
getThrottleLazyload
} = lazyload
const node = document.createElement('figure')
- node.setAttribute('img-src', 'http://some-domain/image-src.jpg')
- node.setAttribute('img-placeholder', 'http://some-domain/image-placeholder')
+ node.setAttribute('img-src', 'http://via.placeholder.com/1x1')
+ node.setAttribute('img-placeholder', 'http://via.placeholder.com/2x2')
document.body.appendChild(node)
const throttle = getThrottleLazyload(100, node)
expect(throttle).to.be.a('function')
throttle()
- // this.clock.tick(100)
- // console.log(node.style.backgroundImage)
- // expect(node.style.backgroundImage).to.be.equal('url(http://localhost:9876/img-src.jpg)')
+ // this.clock.tick(100)
+ // console.log(node.style.backgroundImage)
+ // expect(node.style.backgroundImage).to.be.equal('url(http://localhost:9876/img-src.jpg)')
})
})
})
[26/50] incubator-weex git commit: * [html5] fix lazyload test case
Posted by da...@apache.org.
* [html5] fix lazyload test 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/1a77685a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1a77685a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1a77685a
Branch: refs/heads/0.15-dev
Commit: 1a77685a027d0261ebb8a4f871e380d2a1a66cf0
Parents: f00356a
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 22:38:14 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 22:38:14 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/lazyload.js | 49 ++++++++++++++--------------
1 file changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1a77685a/html5/test/render/vue/utils/lazyload.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/lazyload.js b/html5/test/render/vue/utils/lazyload.js
index 59c5593..5f5eeaa 100644
--- a/html5/test/render/vue/utils/lazyload.js
+++ b/html5/test/render/vue/utils/lazyload.js
@@ -19,48 +19,49 @@
import * as lazyload from '../../../../render/vue/utils/lazyload'
describe('utils', function () {
describe('lazyload', function () {
+ const validImage_transparent = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
+ const validImage_black = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
+ const invalidImage = 'data:image/jpeg;base64,'
before(() => {
- this.clock = sinon.useFakeTimers()
+ // this.clock = sinon.useFakeTimers()
})
after(() => {
- this.clock.restore()
- })
- it('applySrc', () => {
- const {
- applySrc
- } = lazyload
- const node = document.createElement('figure')
- node.setAttribute('img-src', 'http://via.placeholder.com/1x1')
- node.setAttribute('img-placeholder', 'http://via.placeholder.com/2x2')
- document.body.appendChild(node)
- expect(applySrc(node, '')).to.be.a('undefined')
- expect(node.attributes[0].name).to.be.equal('img-src')
+ // this.clock.restore()
})
it('fireLazyload', () => {
const {
fireLazyload
} = lazyload
const node = document.createElement('figure')
- node.setAttribute('img-src', 'http://via.placeholder.com/1x1')
- node.setAttribute('img-placeholder', 'http://via.placeholder.com/2x2')
+ const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
+ node.style.height = '10px'
+ node.setAttribute('img-src', validImage_transparent)
+ node.setAttribute('img-placeholder', validImage_transparent)
document.body.appendChild(node)
+ fireLazyload([node])
+ setTimeout(() => {
+ console.log(node)
+ },200)
+ expect(node.style.backgroundImage.replace(urlReg,'')).to.be.equal('url('+validImage_transparent+')')
+ node.setAttribute('img-src', validImage_black)
fireLazyload(node, true)
- expect(node.style.backgroundImage).to.be.equal('url(http://via.placeholder.com/1x1)')
+ expect(node.style.backgroundImage.replace(urlReg,'')).to.be.equal('url('+validImage_black+')')
+ document.body.removeChild(node)
})
it('getThrottleLazyload', () => {
const {
getThrottleLazyload
} = lazyload
const node = document.createElement('figure')
- node.setAttribute('img-src', 'http://via.placeholder.com/1x1')
- node.setAttribute('img-placeholder', 'http://via.placeholder.com/2x2')
+ const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
+ const wait = 100,duration = wait + (wait > 25 ? wait : 25)
+ node.style.height = '10px'
+ node.setAttribute('img-src', validImage_transparent)
+ node.setAttribute('img-placeholder', validImage_transparent)
document.body.appendChild(node)
- const throttle = getThrottleLazyload(100, node)
- expect(throttle).to.be.a('function')
- throttle()
- // this.clock.tick(100)
- // console.log(node.style.backgroundImage)
- // expect(node.style.backgroundImage).to.be.equal('url(http://localhost:9876/img-src.jpg)')
+ getThrottleLazyload(wait, node)()
+ document.body.removeChild(node)
+ expect(node.style.backgroundImage.replace(urlReg,'')).to.be.equal('url('+validImage_transparent+')')
})
})
})
[32/50] incubator-weex git commit: * [html5] improve lazyload unit
test case
Posted by da...@apache.org.
* [html5] improve lazyload unit test 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/30a52ef4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/30a52ef4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/30a52ef4
Branch: refs/heads/0.15-dev
Commit: 30a52ef4f742e7f3dabcfb840c4a3fa3599392a0
Parents: abb4d66
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 20:49:32 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 20:49:32 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/lazyload.js | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/30a52ef4/html5/test/render/vue/utils/lazyload.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/lazyload.js b/html5/test/render/vue/utils/lazyload.js
index 7fc25a7..6f574d4 100644
--- a/html5/test/render/vue/utils/lazyload.js
+++ b/html5/test/render/vue/utils/lazyload.js
@@ -23,9 +23,11 @@ describe('utils', function () {
const validImageBlack = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
const invalidImage = 'data:image/jpeg;base64,'
before(() => {
+ this.weexEmit = sinon.stub(window.weex, 'emit')
// this.clock = sinon.useFakeTimers()
})
after(() => {
+ this.weexEmit.restore()
// this.clock.restore()
})
it('fireLazyload', (done) => {
@@ -34,20 +36,24 @@ describe('utils', function () {
} = lazyload
const node = document.createElement('figure')
const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
- // const IMG_REC_INDENT = 500
+ const IMG_REC_INDENT = 500
node.setAttribute('img-src', invalidImage)
node.setAttribute('img-placeholder', validImageBlack)
node.style.height = '10px'
- // coverage branch if (item._src_loading)
+ // coverage branch if (item._src_loading)
node._src_loading = true
- // coverage branch if (Array.isArray(el))
+ // coverage branch if (Array.isArray(el))
fireLazyload([node])
node._src_loading = false
fireLazyload(node, true)
setTimeout(() => {
expect(node.style.backgroundImage.replace(urlReg, '')).to.be.equal('url(' + validImageBlack + ')')
- done()
- document.body.removeChild(node)
+ setTimeout(() => {
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
+ done()
+ document.body.removeChild(node)
+ }, IMG_REC_INDENT)
}, 100)
})
it('getThrottleLazyload', (done) => {
@@ -57,16 +63,21 @@ describe('utils', function () {
const node = document.createElement('figure')
const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
const wait = 100
+ const IMG_REC_INDENT = 500
node.style.height = '10px'
node.setAttribute('img-src', validImageTransparent)
node.setAttribute('img-placeholder', validImageBlack)
document.body.appendChild(node)
- window._weex_perf.renderTime.length = 3
+ window._first_screen_detected = false
getThrottleLazyload(wait, node)()
setTimeout(() => {
expect(node.style.backgroundImage.replace(urlReg, '')).to.be.equal('url(' + validImageTransparent + ')')
- done()
- document.body.removeChild(node)
+ setTimeout(() => {
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
+ expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
+ done()
+ document.body.removeChild(node)
+ }, IMG_REC_INDENT)
}, 100)
})
})
[23/50] incubator-weex git commit: * [html5] update webSocket formate
Posted by da...@apache.org.
* [html5] update webSocket formate
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8bc53ca3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8bc53ca3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8bc53ca3
Branch: refs/heads/0.15-dev
Commit: 8bc53ca36f3b07033df3f6bcfbb53189327ccd39
Parents: cfcf769
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 14:39:43 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 14:39:43 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 31 +++++++++++--------------
1 file changed, 13 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8bc53ca3/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index d5a3c0d..05a2fca 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -18,11 +18,10 @@
*/
import websocket from '../../../../render/vue/modules/websocket/websocket'
const TestUrl = 'ws://echo.websocket.org'
-/** @test {webSocket module} */
-describe('webSocket module', () => {
-
- describe('extends Standard WebSocket API', () => {
- context('should inherit', () => {
+ /** @test {webSocket module} */
+describe('webSocket module', function () {
+ describe('extends Standard WebSocket API', function () {
+ context('should inherit', function () {
let ws = null
before(() => {
ws = websocket.WebSocket(TestUrl)
@@ -48,45 +47,41 @@ describe('webSocket module', () => {
expect(websocket, 'should INSTANCE to be defined').to.have.property('INSTANCE')
})
})
- context('should forward native events', () => {
+ context('should forward native events', function () {
let ws = null
before(() => {
- ws = websocket.WebSocket(TestUrl,'')
+ ws = websocket.WebSocket(TestUrl, '')
})
after(() => {
websocket.close()
})
it('open', function () {
- const open = () => {
- }
+ const open = () => {}
websocket.onopen = open
expect(ws.onopen).to.be.deep.equal(open)
})
it('close', function () {
- const close = () => {
- }
+ const close = () => {}
websocket.onclose = close
expect(ws.onclose).to.be.deep.equal(close)
})
it('error', function () {
- const error = () => {
- }
+ const error = () => {}
websocket.onerror = error
expect(ws.onerror).to.be.deep.equal(error)
})
it('message', function () {
- const message = () => {
- }
+ const message = () => {}
websocket.onmessage = message
expect(ws.onmessage).to.be.deep.equal(message)
})
})
- describe('should ignore', () => {
- it('url is undefined', function (done) {
+ describe('should ignore', function () {
+ it('url is undefined', (done) => {
websocket.WebSocket('')
expect(websocket.INSTANCE).to.be.null
})
- it('both url and protocol is defined', function (done) {
+ it('both url and protocol is defined', (done) => {
websocket.WebSocket(TestUrl, 'ws')
expect(websocket.INSTANCE).not.to.be.null
})
[45/50] incubator-weex git commit: * [html5] fix collectStat test case
Posted by da...@apache.org.
* [html5] fix collectStat test 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/fdad32f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/fdad32f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/fdad32f4
Branch: refs/heads/0.15-dev
Commit: fdad32f47e4b7049aa30bdfb615e3a0719e5bb9d
Parents: 9c84d23
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 17:29:19 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 17:29:19 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/lazyload.js | 82 ++++++++++++++++++----------
html5/test/render/vue/utils/perf.js | 12 ++++
2 files changed, 64 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/fdad32f4/html5/test/render/vue/utils/lazyload.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/lazyload.js b/html5/test/render/vue/utils/lazyload.js
index 6f574d4..b390468 100644
--- a/html5/test/render/vue/utils/lazyload.js
+++ b/html5/test/render/vue/utils/lazyload.js
@@ -16,33 +16,44 @@
* specific language governing permissions and limitations
* under the License.
*/
-import * as lazyload from '../../../../render/vue/utils/lazyload'
+import {
+ fireLazyload,
+ getThrottleLazyload
+} from '../../../../render/vue/utils/lazyload'
describe('utils', function () {
describe('lazyload', function () {
const validImageTransparent = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
const validImageBlack = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
const invalidImage = 'data:image/jpeg;base64,'
before(() => {
+ // for test collectStat in utils/perf.js
+ window.performance = {
+ getEntries: () => {
+ return [{
+ entryType: 'resource',
+ name: 'weex-invalid.jpg'
+ }, {
+ entryType: 'resource',
+ name: 'weex-test.jpg'
+ }]
+ }
+ }
+ window.history.pushState(null, null, '?_wx_tpl=./weex-test.jpg')
this.weexEmit = sinon.stub(window.weex, 'emit')
- // this.clock = sinon.useFakeTimers()
})
after(() => {
this.weexEmit.restore()
- // this.clock.restore()
})
it('fireLazyload', (done) => {
- const {
- fireLazyload
- } = lazyload
const node = document.createElement('figure')
const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
const IMG_REC_INDENT = 500
node.setAttribute('img-src', invalidImage)
node.setAttribute('img-placeholder', validImageBlack)
node.style.height = '10px'
- // coverage branch if (item._src_loading)
+ // coverage branch if (item._src_loading)
node._src_loading = true
- // coverage branch if (Array.isArray(el))
+ // coverage branch if (Array.isArray(el))
fireLazyload([node])
node._src_loading = false
fireLazyload(node, true)
@@ -56,29 +67,40 @@ describe('utils', function () {
}, IMG_REC_INDENT)
}, 100)
})
- it('getThrottleLazyload', (done) => {
- const {
- getThrottleLazyload
- } = lazyload
- const node = document.createElement('figure')
- const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
- const wait = 100
- const IMG_REC_INDENT = 500
- node.style.height = '10px'
- node.setAttribute('img-src', validImageTransparent)
- node.setAttribute('img-placeholder', validImageBlack)
- document.body.appendChild(node)
- window._first_screen_detected = false
- getThrottleLazyload(wait, node)()
- setTimeout(() => {
- expect(node.style.backgroundImage.replace(urlReg, '')).to.be.equal('url(' + validImageTransparent + ')')
+ describe('getThrottleLazyload', () => {
+ it('should use default value while parmas is undefined', (done) => {
+ const IMG_REC_INDENT = 500
+ window._first_screen_detected = true
+ getThrottleLazyload()()
setTimeout(() => {
- expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
- expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
- done()
- document.body.removeChild(node)
- }, IMG_REC_INDENT)
- }, 100)
+ setTimeout(() => {
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
+ done()
+ }, IMG_REC_INDENT)
+ }, 16)
+ })
+ it('should be work', (done) => {
+ const node = document.createElement('figure')
+ const urlReg = /http(s)?:\/\/(\S+):(\d+)\//
+ const wait = 100
+ const IMG_REC_INDENT = 500
+ node.style.height = '10px'
+ node.setAttribute('img-src', validImageTransparent)
+ node.setAttribute('img-placeholder', validImageBlack)
+ document.body.appendChild(node)
+ window._first_screen_detected = false
+ getThrottleLazyload(wait, node)()
+ setTimeout(() => {
+ expect(node.style.backgroundImage.replace(urlReg, '')).to.be.equal('url(' + validImageTransparent + ')')
+ setTimeout(() => {
+ expect(this.weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
+ expect(this.weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
+ done()
+ document.body.removeChild(node)
+ }, IMG_REC_INDENT)
+ }, 100)
+ })
})
})
})
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/fdad32f4/html5/test/render/vue/utils/perf.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/perf.js b/html5/test/render/vue/utils/perf.js
index 824daa3..c582334 100644
--- a/html5/test/render/vue/utils/perf.js
+++ b/html5/test/render/vue/utils/perf.js
@@ -44,6 +44,18 @@ describe('utils', function () {
this.weexEmit.restore()
})
it('collectStatPerf', () => {
+ window.performance = {
+ getEntries: () => {
+ return [{
+ entryType: 'resource',
+ name: 'weex-invalid.jpg'
+ }, {
+ entryType: 'resource',
+ name: 'weex-test.jpg'
+ }]
+ }
+ }
+ window.history.pushState(null, null, '?_wx_tpl=./weex-test.jpg')
const time = (new Date()).getTime()
collectStatPerf('totalTime', time)
expect(collectStatPerf).to.be.a('function')
[21/50] incubator-weex git commit: Merge branch '0.15-dev' of
https://github.com/apache/incubator-weex into 0.15-dev
Posted by da...@apache.org.
Merge branch '0.15-dev' of https://github.com/apache/incubator-weex into 0.15-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/cfcf769c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/cfcf769c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/cfcf769c
Branch: refs/heads/0.15-dev
Commit: cfcf769cddc01f1bfc3298bb5a476b93355cb633
Parents: a1a6b2c 3d97c00
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 13:19:29 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 13:19:29 2017 +0800
----------------------------------------------------------------------
.../Sources/Component/WXCycleSliderComponent.m | 6 ++++
.../WeexSDK/Sources/Component/WXEditComponent.m | 2 +-
ios/sdk/WeexSDK/Sources/Component/WXTransform.m | 8 +++---
ios/sdk/WeexSDKTests/WXAnimationModuleTests.m | 29 ++++++++++++++++++++
4 files changed, 40 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[42/50] incubator-weex git commit: * [html5] improve unit test case
Posted by da...@apache.org.
* [html5] improve unit test 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/8527a0e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8527a0e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8527a0e5
Branch: refs/heads/0.15-dev
Commit: 8527a0e5fc6423e941f4cab82f47b3c554f15830
Parents: a2e8b08
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 15:16:34 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 15:16:34 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/style.js | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8527a0e5/html5/test/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/style.js b/html5/test/render/vue/utils/style.js
index b968826..6bc1a78 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -66,7 +66,21 @@ describe('style', function () {
})
it('should normalize style object', () => {
- //
+ const style = {
+ width: '200px',
+ flexDirection: 'row',
+ flex: 1,
+ fontSize: 12,
+ transform: 'translate3d(100px, 100px, 0)'
+ }
+ const res = normalizeStyle(style)
+ console.log(res)
+ expect(normalizeString('transform', style.transform)).to.equal(res.transform)
+ expect(normalizeString('width', style.width)).to.equal(res.width)
+ expect(normalizeString('flexDirection', style.flexDirection)).to.equal(res.flexDirection)
+ expect(normalizeNumber('fontSize', style.fontSize)).to.equal(res.fontSize)
+ // flex is in noUnitsNumberKeys array
+ expect(style.flex).to.equal(res.flex)
})
it('should trim comment in style.', () => {
@@ -75,21 +89,6 @@ describe('style', function () {
expect(trimComment(cssText)).to.equal(trimmed)
})
})
-describe('normalizeStyle', () => {
- const style = {
- width: '200px',
- flexDirection: 'row',
- flex: 1,
- transform: 'translate3d(100px, 100px, 0)'
- }
- it('should switch to suitble case', () => {
- const res = normalizeStyle(style)
- expect(normalizeString('transform', style.transform)).to.equal(res.transform)
- expect(normalizeString('width', style.width)).to.equal(res.width)
- expect(normalizeString('flexDirection', style.flexDirection)).to.equal(res.flexDirection)
- expect(style.flex).to.equal(res.flex)
- })
-})
describe('autoPrefix', () => {
const style = {
width: '200px',
[09/50] incubator-weex git commit: + [html5] rename filename and add
more unit test
Posted by da...@apache.org.
+ [html5] rename filename and add more unit test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7c42710b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7c42710b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7c42710b
Branch: refs/heads/0.15-dev
Commit: 7c42710b9e883b31ab4f8eee532048f42e428d6d
Parents: 9591b24
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:06:06 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:06:06 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/perf.js | 124 +++++++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7c42710b/html5/test/render/vue/utils/perf.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/perf.js b/html5/test/render/vue/utils/perf.js
new file mode 100644
index 0000000..87ee213
--- /dev/null
+++ b/html5/test/render/vue/utils/perf.js
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import {
+ collectStatPerf,
+ tagFirstScreen,
+ tagImg,
+ tagBeforeCreate,
+ tagRootMounted,
+ tagMounted,
+ tagBeforeUpdate,
+ tagUpdated,
+ tagBegin,
+ tagEnd
+} from '../../../../render/vue/utils/perf'
+describe('utils', function () {
+ describe('pref', function () {
+ before(function () {
+ this.clock = sinon.useFakeTimers()
+ })
+ after(function () {
+ this.clock.restore()
+ })
+ it('collectStatPerf', function () {
+ const perf = window._weex_perf
+ const time = (new Date()).getTime()
+ collectStatPerf('totalTime', time)
+ expect(collectStatPerf).to.be.a('function')
+ expect(perf.stat['totalTime']).to.be.equal(time)
+ expect(collectStatPerf()).to.be.a('undefined')
+ })
+ it('tagFirstScreen', function () {
+ const weexEmit = sinon.stub(window.weex, 'emit')
+ expect(tagFirstScreen).to.be.a('function')
+ tagFirstScreen()
+ expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
+ window._first_screen_detected = false
+ tagFirstScreen()
+ expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
+ expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
+ weexEmit.restore()
+ })
+ it('tagImg', function () {
+ const weexEmit = sinon.stub(window.weex, 'emit')
+ tagImg()
+ this.clock.tick(500)
+ expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
+ expect(tagImg).to.be.a('function')
+ weexEmit.restore()
+ })
+ it('tagBeforeCreate', function () {
+ const perf = window._weex_perf
+ tagBeforeCreate()
+ this.clock.tick(25)
+ const time = perf.earliestBeforeCreates[perf.earliestBeforeCreates.length - 1]
+ expect(time).to.be.a('number')
+ expect(perf.earliestBeforeCreates).to.have.lengthOf(1)
+ expect(tagBeforeCreate).to.be.a('function')
+ })
+ it('tagRootMounted', function () {
+ const perf = window._weex_perf
+ tagRootMounted()
+ const time = perf.latestMounts[perf.latestMounts.length - 1]
+ expect(time).to.be.a('number')
+ expect(perf.stat['totalTime']).to.be.equal(parseInt(time))
+ expect(tagRootMounted).to.be.a('function')
+ })
+ it('tagMounted', function () {
+ const perf = window._weex_perf
+ perf.firstAllMountedTime = 0
+ tagMounted()
+ this.clock.tick(25)
+ expect(tagMounted).to.be.a('function')
+ expect(perf.latestMounts).to.have.lengthOf(2)
+ expect(perf.createTime).to.have.lengthOf(1)
+ expect(perf.createTime[perf.createTime.length - 1]).to.have.all.keys('start', 'end', 'duration')
+ expect(perf.firstAllMountedTime).to.be.above(0)
+ })
+ it('tagBeforeUpdate', function () {
+ const perf = window._weex_perf
+ tagBeforeUpdate()
+ this.clock.tick(25)
+ expect(tagBeforeUpdate).to.be.a('function')
+ expect(perf.earliestBeforeUpdates).to.have.lengthOf(1)
+ })
+ it('tagUpdated', function () {
+ const perf = window._weex_perf
+ tagUpdated()
+ this.clock.tick(25)
+ expect(tagUpdated).to.be.a('function')
+ expect(perf.latestUpdates).to.have.lengthOf(1)
+ expect(perf.updateTime).to.have.lengthOf(1)
+ expect(perf.updateTime[perf.updateTime.length - 1]).to.have.all.keys('start', 'end', 'duration')
+ })
+ it('tagBegin', function () {
+ const name = 'test'
+ tagBegin(name)
+ expect(tagBegin).to.be.a('function')
+ })
+ it('tagEnd', function () {
+ const perf = window._weex_perf
+ const name = 'test'
+ tagEnd(name)
+ expect(tagEnd).to.be.a('function')
+ expect(perf.time[name]).to.be.a('number')
+ })
+ })
+})
[25/50] incubator-weex git commit: * [html5] remove too much
websocket linker
Posted by da...@apache.org.
* [html5] remove too much websocket linker
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f00356a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f00356a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f00356a1
Branch: refs/heads/0.15-dev
Commit: f00356a1c3a2b82c31db84a2ab7e1636cf7a536a
Parents: ab67cf8
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 22:37:39 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 22:37:39 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f00356a1/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index 257bb56..8731957 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -76,11 +76,5 @@ describe('webSocket module', function () {
expect(ws.onmessage).to.be.deep.equal(message)
})
})
- describe('should ignore', function () {
- it('url is undefined', (done) => {
- websocket.WebSocket('')
- expect(websocket.INSTANCE).to.be.null
- })
- })
})
})
[40/50] incubator-weex git commit: * [html5] update style unit test
case @notdanger
Posted by da...@apache.org.
* [html5] update style unit test case @notdanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d2aacf73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d2aacf73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d2aacf73
Branch: refs/heads/0.15-dev
Commit: d2aacf73c658735f3ac9e1bfb242b6d9a01c59f6
Parents: b8606a4
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 14:41:09 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 14:41:09 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/style.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2aacf73/html5/test/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/style.js b/html5/test/render/vue/utils/style.js
index 1f1e78f..b968826 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -87,7 +87,7 @@ describe('normalizeStyle', () => {
expect(normalizeString('transform', style.transform)).to.equal(res.transform)
expect(normalizeString('width', style.width)).to.equal(res.width)
expect(normalizeString('flexDirection', style.flexDirection)).to.equal(res.flexDirection)
- expect(normalizeNumber('flex', style.flex)).to.equal(res.flex)
+ expect(style.flex).to.equal(res.flex)
})
})
describe('autoPrefix', () => {
[04/50] incubator-weex git commit: * [html5] move intro config to
config file for test
Posted by da...@apache.org.
* [html5] move intro config to config file for test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5addc15c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5addc15c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5addc15c
Branch: refs/heads/0.15-dev
Commit: 5addc15c86558ec8ee1e2d1c34fb52f9344c8fc6
Parents: 500a3b0
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 14:31:38 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 14:31:38 2017 +0800
----------------------------------------------------------------------
build/config.js | 15 +++++------
build/karma.vue.conf.js | 64 ++++++++++++++++++++------------------------
2 files changed, 35 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5addc15c/build/config.js
----------------------------------------------------------------------
diff --git a/build/config.js b/build/config.js
index 9ad7506..4325f2b 100644
--- a/build/config.js
+++ b/build/config.js
@@ -1,3 +1,4 @@
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -83,13 +84,9 @@ const configs = {
moduleName: 'WeexVueRender',
entry: absolute('html5/render/vue/index.js'),
dest: absolute('packages/weex-vue-render/dist/index.js'),
- intro:`describe('ignore inject function from postcss', function () {
- it('ignore', function () {
- var shouldBe = 'test'
- var expected = __$styleInject('.body{}',shouldBe)
- expect(shouldBe).to.be.equal(expected)
- })
- })`,
+ banner:`
+console.log('START WEEX VUE RENDER: ${subversion['vue-render']}, Build ${now()}.');
+window._jslib_init_start = window.performance && window.performance.now && window.performance.now() || +new Date();\n\n`,
format: 'umd',
plugins: [
postcss(),
@@ -112,7 +109,7 @@ function getConfig (name, minify) {
entry: opt.entry,
dest: minify ? opt.dest.replace(/\.js$/, '.min.js') : opt.dest,
format: opt.format,
- intro: opt.intro,
+ banner: opt.banner,
plugins: opt.plugins.concat([
json(),
replace({
@@ -152,4 +149,4 @@ function now () {
return (new Date(time)).toISOString().replace('T', ' ').substring(0, 16)
}
-module.exports = getConfig
+module.exports = getConfig
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5addc15c/build/karma.vue.conf.js
----------------------------------------------------------------------
diff --git a/build/karma.vue.conf.js b/build/karma.vue.conf.js
index 0e750af..7a69d35 100644
--- a/build/karma.vue.conf.js
+++ b/build/karma.vue.conf.js
@@ -20,20 +20,16 @@ var rollupConfig = require('./config')('weex-vue-render', true)
var path = require('path')
var flow = require('rollup-plugin-flow')
-function absolute (pa) {
+function absolute(pa) {
return path.resolve(__dirname, pa)
}
-
var removeConfigs = ['entry', 'dest', 'banner']
var removePlugins = ['eslint', 'uglify', 'flow-remove-type']
-
removeConfigs.forEach(cfg => {
delete rollupConfig[cfg]
})
-
var plugins = rollupConfig.plugins.slice()
rollupConfig.plugins = []
-
for (var i = 0, l = plugins.length; i < l; i++) {
var plg = plugins[i]
var isRemove = false
@@ -45,57 +41,55 @@ for (var i = 0, l = plugins.length; i < l; i++) {
isRemove = true
}
})
- if (!isRemove) { rollupConfig.plugins.push(plg) }
+ if (!isRemove) {
+ rollupConfig.plugins.push(plg)
+ }
}
-
/**
* rollup-plugin-flow-no-whiitespace cause fatial error.
* use rollup-plugin-flow instead, since no soucemap needed, it's acceptable for extra whitespaces.
*/
rollupConfig.plugins.splice(-2, 1, flow())
-
rollupConfig.format = 'iife'
rollupConfig.sourceMap = 'inline'
-
+rollupConfig.intro = `describe('ignore inject function from postcss', function () {
+ it('ignore', function () {
+ var shouldBe = 'test'
+ var expected = __$styleInject('.body{}',shouldBe)
+ expect(shouldBe).to.be.equal(expected)
+ })
+ })`
+
module.exports = function (config) {
config.set({
frameworks: ['mocha', 'sinon-chai'],
browsers: ['PhantomJS'],
- files: [
- '../html5/test/render/vue/utils/*.js',
- '../html5/test/render/vue/core/*.js',
- '../html5/test/render/vue/!(utils|core)/*.js'
- ],
- exclude: [
- '../html5/test/render/vue/helper/*.js',
- '../html5/test/render/vue/vender/**/*.js',
- '../html5/test/render/vue/data/**/*.js'
+ files: ['../html5/test/render/vue/utils/*.js',
+ // '../html5/test/render/vue/core/*.js',
+ // '../html5/test/render/vue/!(utils|core)/*.js'
],
-
- // singleRun: false,
- singleRun: true,
-
+ exclude: ['../html5/test/render/vue/helper/*.js', '../html5/test/render/vue/vender/**/*.js', '../html5/test/render/vue/data/**/*.js'],
+ singleRun: false,
+ // singleRun: true,
reporters: ['mocha', 'coverage'],
coverageReporter: {
- reporters: [
- { type: 'html', dir: absolute('../coverage'), subdir: 'vue-renderer' },
- { type: 'text-summary', dir: absolute('../coverage'), subdir: 'vue-renderer' }
- ]
+ reporters: [{
+ type: 'html',
+ dir: absolute('../coverage'),
+ subdir: 'vue-renderer'
+ }, {
+ type: 'text-summary',
+ dir: absolute('../coverage'),
+ subdir: 'vue-renderer'
+ }]
},
- browserDisconnectTimeout:10000,
+ browserDisconnectTimeout: 10000,
preprocessors: {
'../html5/test/**/*.js': ['rollup'],
'../html5/test/**/!(components|examples|core)/*.js': ['rollup', 'coverage']
},
rollupPreprocessor: rollupConfig,
-
- plugins: [
- 'karma-coverage',
- 'karma-mocha',
- 'karma-mocha-reporter',
- 'karma-phantomjs-launcher',
- 'karma-rollup-preprocessor',
- 'karma-sinon-chai'
+ plugins: ['karma-coverage', 'karma-mocha', 'karma-mocha-reporter', 'karma-phantomjs-launcher', 'karma-rollup-preprocessor', 'karma-sinon-chai'
// 'karma-sourcemap-loader',
// 'karma-webpack'
]
[31/50] incubator-weex git commit: Merge branch '0.15-dev' of
https://github.com/simplefatty/incubator-weex into 0.15-dev
Posted by da...@apache.org.
Merge branch '0.15-dev' of https://github.com/simplefatty/incubator-weex into 0.15-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/abb4d667
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/abb4d667
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/abb4d667
Branch: refs/heads/0.15-dev
Commit: abb4d667e92e38529fbfbf998324545fe0b8c30d
Parents: b66b626 8a84fa6
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 17 17:56:30 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 17 17:56:30 2017 +0800
----------------------------------------------------------------------
----------------------------------------------------------------------
[08/50] incubator-weex git commit: - [html5] rename file name
Posted by da...@apache.org.
- [html5] rename file name
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9591b247
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9591b247
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9591b247
Branch: refs/heads/0.15-dev
Commit: 9591b2474ef66d3a31a6e1bad9953a4644bd2c36
Parents: c96f0e3
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:05:33 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:05:33 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/pref.js | 104 -------------------------------
1 file changed, 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9591b247/html5/test/render/vue/utils/pref.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/pref.js b/html5/test/render/vue/utils/pref.js
deleted file mode 100644
index 431ce33..0000000
--- a/html5/test/render/vue/utils/pref.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import {
- collectStatPerf,
- tagFirstScreen,
- tagImg,
- tagBeforeCreate,
- tagRootMounted,
- tagMounted,
- tagBeforeUpdate,
- tagUpdated,
- tagBegin,
- tagEnd
-} from '../../../../render/vue/utils/perf'
-describe('utils', function () {
- before(function () {})
- describe('pref', function () {
- before(function () {
- this.clock = sinon.useFakeTimers()
- })
- after(function () {
- this.clock.restore()
- })
- it('collectStatPerf', function () {
- expect(collectStatPerf).to.be.a('function')
- expect(collectStatPerf('totalTime', (new Date()).getTime())).to.be.a('undefined')
- expect(collectStatPerf()).to.be.a('undefined')
- })
- it('tagFirstScreen', function () {
- const weexEmit = sinon.stub(window.weex, 'emit')
- expect(tagFirstScreen).to.be.a('function')
- tagFirstScreen()
- expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
- expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0)
- window._first_screen_detected = false
- tagFirstScreen()
- expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(2)
- expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1)
- weexEmit.restore()
- })
- it('tagImg', function () {
- const weexEmit = sinon.stub(window.weex, 'emit')
- tagImg()
- this.clock.tick(500)
- expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1)
- expect(tagImg).to.be.a('function')
- weexEmit.restore()
- })
- it('tagBeforeCreate', function () {
- const shouldBe = tagBeforeCreate()
- this.clock.tick(25)
- expect(shouldBe).to.be.a('undefined')
- expect(tagBeforeCreate).to.be.a('function')
- })
- it('tagRootMounted', function () {
- expect(tagRootMounted()).to.be.a('undefined')
- expect(tagRootMounted).to.be.a('function')
- })
- it('tagMounted', function () {
- const tagmount = tagMounted()
- this.clock.tick(25)
- expect(tagMounted).to.be.a('function')
- expect(tagmount).to.be.a('undefined')
- })
- it('tagBeforeUpdate', function () {
- const tagbeforeupdate = tagBeforeUpdate()
- this.clock.tick(25)
- expect(tagBeforeUpdate).to.be.a('function')
- expect(tagbeforeupdate).to.be.a('undefined')
- })
- it('tagUpdated', function () {
- const tagupdated = tagUpdated()
- this.clock.tick(25)
- expect(tagUpdated).to.be.a('function')
- expect(tagupdated).to.be.a('undefined')
- })
- it('tagBegin', function () {
- const tagbegin = tagBegin()
- expect(tagbegin).to.be.a('undefined')
- expect(tagBegin).to.be.a('function')
- })
- it('tagEnd', function () {
- const tagend = tagEnd()
- expect(tagend).to.be.a('undefined')
- expect(tagEnd).to.be.a('function')
- })
- })
-})
[06/50] incubator-weex git commit: * [html5] add unit test
Posted by da...@apache.org.
* [html5] add unit test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/0378b369
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/0378b369
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/0378b369
Branch: refs/heads/0.15-dev
Commit: 0378b36973b9107b61d31b49a65efd2f480eb32b
Parents: 7baff11
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:03:44 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:03:44 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/func.js | 135 +++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0378b369/html5/test/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/func.js b/html5/test/render/vue/utils/func.js
index 246178d..1c50bac 100644
--- a/html5/test/render/vue/utils/func.js
+++ b/html5/test/render/vue/utils/func.js
@@ -164,5 +164,140 @@ describe('utils', function () {
expect(loopArray([1, 2, 3], -1)).to.be.deep.equal([2, 3, 1])
expect(loopArray([1, 2, 3], 0)).to.be.deep.equal([1, 2, 3])
})
+ it('cached', function () {
+ expect(utils.cached).to.be.a('function')
+ })
+ it('camelize', function () {
+ const {
+ camelize
+ } = utils
+ expect(camelize).to.be.a('function')
+ expect(camelize('')).to.be.equal('')
+ expect(camelize('dispaly')).to.be.equal('dispaly')
+ expect(camelize('-webkit-transform')).to.be.equal('WebkitTransform')
+ expect(camelize('text-overflow')).to.be.equal('textOverflow')
+ expect(camelize('a-b-c-d')).to.be.equal('aBCD')
+ })
+ it('camelizeKeys', function () {
+ const {
+ camelizeKeys
+ } = utils
+ const camelizeobj = {
+ dispaly: 'none',
+ '-webkit-transform': 'all 1s ease'
+ }
+ const shouldBe = camelizeKeys(camelizeobj)
+ const expected = {
+ dispaly: 'none',
+ WebkitTransform: 'all 1s ease'
+ }
+ expect(camelizeKeys).to.be.a('function')
+ expect(shouldBe).to.be.deep.equal(expected)
+ })
+ it('capitalize', function () {
+ const {
+ capitalize
+ } = utils
+ expect(capitalize).to.be.a('function')
+ expect(capitalize('')).to.be.equal('')
+ expect(capitalize('string')).to.be.equal('String')
+ expect(capitalize('string object')).to.be.equal('String object')
+ expect(capitalize('[string object]')).to.be.equal('[string object]')
+ expect(capitalize('I have an apple')).to.be.equal('I have an apple')
+ })
+ it('hyphenate', function () {
+ const {
+ hyphenate
+ } = utils
+ expect(hyphenate).to.be.a('function')
+ expect(hyphenate('')).to.be.equal('')
+ expect(hyphenate('dispaly')).to.be.equal('dispaly')
+ expect(hyphenate('WebkitTransform')).to.be.equal('webkit-transform')
+ expect(hyphenate('textOverflow')).to.be.equal('text-overflow')
+ expect(hyphenate('aBCD')).to.be.equal('a-b-c-d')
+ })
+ it('hyphenateKeys', function () {
+ const {
+ hyphenateKeys
+ } = utils
+ const hyphenateobj = {
+ dispaly: 'none',
+ WebkitTransform: 'all 1s ease'
+ }
+ const shouldBe = hyphenateKeys(hyphenateobj)
+ const expected = {
+ dispaly: 'none',
+ 'webkit-transform': 'all 1s ease'
+ }
+ expect(hyphenateKeys).to.be.a('function')
+ expect(shouldBe).to.be.deep.equal(expected)
+ })
+ it('hyphenateStyleKeys', function () {
+ const {
+ hyphenateStyleKeys
+ } = utils
+ const hyphenateStyleObj = {
+ dispaly: 'none',
+ 'webkit-transform': 'all 1s ease'
+ }
+ const shouldBe = hyphenateStyleKeys(hyphenateStyleObj)
+ const expected = {
+ dispaly: 'none',
+ '-webkit-transform': 'all 1s ease'
+ }
+ expect(hyphenateStyleKeys).to.be.a('function')
+ expect(shouldBe).to.be.deep.equal(expected)
+ })
+ it('camelToKebab', function () {
+ const {
+ camelToKebab
+ } = utils
+ expect(camelToKebab).to.be.a('function')
+ expect(camelToKebab('')).to.be.equal('')
+ expect(camelToKebab('ABC')).to.be.equal('-a-b-c')
+ })
+ it('appendCss', function () {
+ const {
+ appendCss
+ } = utils
+ const cssid = 'append-test'
+ const css = '.test{font-size:12px}'
+ expect(appendCss).to.be.a('function')
+ appendCss(css, cssid, true)
+ let handler = document.querySelector('#' + cssid)
+ expect(handler.textContent).to.be.equal(css)
+ const anothercss = '.test2{font-size:16px}'
+ appendCss(anothercss, cssid, true)
+ handler = document.querySelector('#' + cssid)
+ expect(handler.textContent).to.be.equal(anothercss)
+ })
+ it('nextFrame', function (done) {
+ const {
+ nextFrame
+ } = utils
+ let shouldBe
+ const expected = 'test'
+ const cb = function () {
+ shouldBe = expected
+ }
+ expect(nextFrame).to.be.a('function')
+ this.clock.restore()
+ nextFrame(cb)
+ setTimeout(() => {
+ expect(shouldBe).to.be.equal(expected)
+ done()
+ }, 10)
+ })
+ it('toCSSText', function () {
+ const {
+ toCSSText
+ } = utils
+ const expected = 'font-size:12px;'
+ const shouldBe = toCSSText({
+ 'font-size': '12px'
+ })
+ expect(toCSSText).to.be.a('function')
+ expect(shouldBe).to.be.equal(expected)
+ })
})
})
[20/50] incubator-weex git commit: - [html5] remove useless code
Posted by da...@apache.org.
- [html5] remove useless code
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a1a6b2cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a1a6b2cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a1a6b2cc
Branch: refs/heads/0.15-dev
Commit: a1a6b2cc5fb57649961ef0e6338be93739639a6b
Parents: 5521172
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 13:18:49 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 13:18:49 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a1a6b2cc/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index 3b34c51..d5a3c0d 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -85,12 +85,10 @@ describe('webSocket module', () => {
it('url is undefined', function (done) {
websocket.WebSocket('')
expect(websocket.INSTANCE).to.be.null
- done()
})
it('both url and protocol is defined', function (done) {
websocket.WebSocket(TestUrl, 'ws')
expect(websocket.INSTANCE).not.to.be.null
- done()
})
})
})
[18/50] incubator-weex git commit: * [html5] update webSocket unit
test
Posted by da...@apache.org.
* [html5] update webSocket unit test
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1bbe8866
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1bbe8866
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1bbe8866
Branch: refs/heads/0.15-dev
Commit: 1bbe8866fc537f39368ae04b241fbbaf2a4e24a6
Parents: b978273
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 13:16:49 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 13:16:49 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 72 +++++++++++++------------
1 file changed, 39 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1bbe8866/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index 487334a..3b34c51 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -19,63 +19,69 @@
import websocket from '../../../../render/vue/modules/websocket/websocket'
const TestUrl = 'ws://echo.websocket.org'
/** @test {webSocket module} */
-describe('webSocket module', function () {
- describe('extends Standard WebSocket API', function () {
- context('should inherit', function () {
- const ws = websocket.WebSocket(TestUrl)
- it('methods', function () {
+describe('webSocket module', () => {
+
+ describe('extends Standard WebSocket API', () => {
+ context('should inherit', () => {
+ let ws = null
+ before(() => {
+ ws = websocket.WebSocket(TestUrl)
+ })
+ after(() => {
+ websocket.close()
+ })
+ it('methods', () => {
expect(websocket, 'should close method to be defined').to.have.property('close')
expect(websocket, 'should send method to be defined').to.have.property('send')
})
- it('attributes', function () {
+ it('attributes', () => {
expect(websocket, 'should onerror to be defined').to.have.property('onerror')
expect(websocket, 'should onmessage to be defined').to.have.property('onmessage')
expect(websocket, 'should onopen to be defined').to.have.property('onopen')
expect(websocket, 'should onclose to be defined').to.have.property('onclose')
expect(ws, 'should binaryType to be defined').to.have.property('binaryType')
- expect(ws, 'should bufferdAmount to be defined').to.have.property('bufferedAmount')
- expect(ws, 'should extensions to be defined').to.have.property('extensions')
expect(ws, 'should protocol to be defined').to.have.property('protocol')
expect(ws, 'should readyState to be defined').to.have.property('readyState')
expect(ws, 'should url to be defined').to.have.property('url')
})
- it('constants', function () {
+ it('constants', () => {
expect(websocket, 'should INSTANCE to be defined').to.have.property('INSTANCE')
})
})
- context('should forward native events', function () {
+ context('should forward native events', () => {
let ws = null
- beforeEach(function () {
- ws = websocket.WebSocket(TestUrl, '')
+ before(() => {
+ ws = websocket.WebSocket(TestUrl,'')
})
- afterEach(function () {
+ after(() => {
websocket.close()
})
- it('open && message && close', function (done) {
- let closed = false
- const message = 'Test'
- ws.onclose = function () {
- if (!closed) {
- closed = true
- }
- expect(closed).to.be.true
- done()
+ it('open', function () {
+ const open = () => {
}
- websocket.onmessage = function (e) {
- expect(e.data).to.be.equal(message)
- setTimeout(() => { websocket.close() }, 200)
+ websocket.onopen = open
+ expect(ws.onopen).to.be.deep.equal(open)
+ })
+ it('close', function () {
+ const close = () => {
}
- websocket.onopen = function () {
- websocket.send(message)
+ websocket.onclose = close
+ expect(ws.onclose).to.be.deep.equal(close)
+ })
+ it('error', function () {
+ const error = () => {
}
+ websocket.onerror = error
+ expect(ws.onerror).to.be.deep.equal(error)
})
- })
- describe('should ignore', function () {
- it('protocol is undefined', function (done) {
- websocket.WebSocket(TestUrl)
- expect(websocket.INSTANCE).not.to.be.null
- done()
+ it('message', function () {
+ const message = () => {
+ }
+ websocket.onmessage = message
+ expect(ws.onmessage).to.be.deep.equal(message)
})
+ })
+ describe('should ignore', () => {
it('url is undefined', function (done) {
websocket.WebSocket('')
expect(websocket.INSTANCE).to.be.null
[05/50] incubator-weex git commit: * [html5] add some tool function
into func.js
Posted by da...@apache.org.
* [html5] add some tool function into func.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7baff110
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7baff110
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7baff110
Branch: refs/heads/0.15-dev
Commit: 7baff110fbf12650fb7a8968d1eaf66267b8bce6
Parents: 5addc15
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:03:20 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:03:20 2017 +0800
----------------------------------------------------------------------
html5/render/vue/utils/func.js | 146 +++++++++++++++++++++++++++++-------
1 file changed, 118 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7baff110/html5/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/func.js b/html5/render/vue/utils/func.js
index 38a0435..5018b09 100644
--- a/html5/render/vue/utils/func.js
+++ b/html5/render/vue/utils/func.js
@@ -16,35 +16,41 @@
* specific language governing permissions and limitations
* under the License.
*/
-
// @flow
-
-import { isArray } from './type'
-
+import {
+ isArray
+} from './type'
/**
* Mix properties into target object.
* the rightest object's value has the highest priority.
*/
-export function extend (to: {}, ...args: Array<{}>): {} {
- if (!args || args.length <= 0) { return to }
+export function extend (to: {}, ...args: Array < {} >): {} {
+ if (!args || args.length <= 0) {
+ return to
+ }
args.forEach(from => {
- if (typeof from !== 'object') { return }
+ if (typeof from !== 'object') {
+ return
+ }
for (const key in from) {
to[key] = from[key]
}
})
return to
}
-
/**
* Mix truthy or '' property values into target object.
* mostly for merging styles. (that's why '' is falsy but still should be counted in.)
* the rightest object's value has the highest priority.
*/
-export function extendTruthy (to: {}, ...args: Array<{}>): {} {
- if (!args || args.length <= 0) { return to }
+export function extendTruthy (to: {}, ...args: Array < {} >): {} {
+ if (!args || args.length <= 0) {
+ return to
+ }
args.forEach(from => {
- if (typeof from !== 'object') { return }
+ if (typeof from !== 'object') {
+ return
+ }
let i
for (const key in from) {
if (((i = from[key]) || i === '' || i === 0) && i !== 'undefined') {
@@ -54,29 +60,28 @@ export function extendTruthy (to: {}, ...args: Array<{}>): {} {
})
return to
}
-
/**
* Mix specified properties into target object.
*/
-export function extendKeys (to: {}, from: {} = {}, keys: Array<string>): {} {
+export function extendKeys (to: {}, from: {} = {}, keys: Array < string >): {} {
(keys || []).forEach(key => {
from && (to[key] = from[key])
})
return to
}
-
/**
* Extract specified properties from src to target object.
*/
-export function extractKeys (to: {}, from: {} = {}, keys: Array<string>) {
- if (!from) { return to }
+export function extractKeys (to: {}, from: {} = {}, keys: Array < string >) {
+ if (!from) {
+ return to
+ }
(keys || []).forEach(key => {
from && (to[key] = from[key])
from && (delete from[key])
})
return to
}
-
/**
* Simple bind, faster than native
*
@@ -87,14 +92,9 @@ export function extractKeys (to: {}, from: {} = {}, keys: Array<string>) {
export function bind (fn: Function, ctx: mixed) {
return function (a: mixed) {
const l = arguments.length
- return l
- ? l > 1
- ? fn.apply(ctx, arguments)
- : fn.call(ctx, a)
- : fn.call(ctx)
+ return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx)
}
}
-
/**
* Only call the func the last time before it's not that frequently called.
*/
@@ -109,12 +109,12 @@ export function debounce (func: Function, wait: number) {
timerId = setTimeout(later, wait)
}
}
-
/**
* Only call the func the first time before a series frequently function calls happen.
*/
export function depress (func: Function, wait: number) {
let timerId
+
function later () {
timerId = null
}
@@ -126,15 +126,14 @@ export function depress (func: Function, wait: number) {
timerId = setTimeout(later, wait)
}
}
-
/**
* Only call the func every time after a wait milliseconds if it's too frequently called.
*/
export function throttle (func: Function, wait: number, callLastTime: boolean) {
let last = 0
let lastTimer = null
- const lastTimeDuration = wait + (wait > 25 ? wait : 25) // plus half wait time.
- return function (...args: Array<mixed>) {
+ const lastTimeDuration = wait + (wait > 25 ? wait : 25) // plus half wait time.
+ return function (...args: Array < mixed >) {
const context = this
const time = new Date().getTime()
if (time - last > wait) {
@@ -150,7 +149,6 @@ export function throttle (func: Function, wait: number, callLastTime: boolean) {
}
}
}
-
// direction: 'l' | 'r', default is 'r'
// num: how many times to loop, should be a positive integer
export function loopArray (arr: any, num: number, direction: string) {
@@ -178,3 +176,95 @@ export function loopArray (arr: any, num: number, direction: string) {
}
return rp.concat(lp)
}
+/**
+ * Create a cached version of a pure function.
+ */
+export function cached (fn: any) {
+ const cache = Object.create(null)
+ return function cachedFn (str: string) {
+ const hit = cache[str]
+ return hit || (cache[str] = fn(str))
+ }
+}
+/**
+ * Camelize a hyphen-delmited string.
+ */
+const camelizeRE = /-(\w)/g
+export const camelize = cached(str => {
+ return str.replace(camelizeRE, (_, c) => c.toUpperCase())
+})
+export function camelizeKeys (obj: any) {
+ const res = {}
+ for (const key in obj) {
+ res[camelize(key)] = obj[key]
+ }
+ return res
+}
+/**
+ * Capitalize a string.
+ */
+export const capitalize = cached(str => {
+ return str.charAt(0).toUpperCase() + str.slice(1)
+})
+ /**
+ * Hyphenate a camelCase string.
+ */
+const hyphenateRE = /([^-])([A-Z])/g
+export const hyphenate = cached(str => {
+ return str.replace(hyphenateRE, '$1-$2').replace(hyphenateRE, '$1-$2').toLowerCase()
+})
+export function hyphenateKeys (obj: any) {
+ const res = {}
+ for (const key in obj) {
+ res[hyphenate(key)] = obj[key]
+ }
+ return res
+}
+const vendorsReg = /webkit-|moz-|o-|ms-/
+export function hyphenateStyleKeys (obj: any) {
+ const res = {}
+ for (const key in obj) {
+ const hk = hyphenate(key).replace(vendorsReg, function ($0) {
+ return '-' + $0
+ })
+ res[hk] = obj[key]
+ }
+ return res
+}
+export function camelToKebab (name: string) {
+ if (!name) {
+ return ''
+ }
+ return name.replace(/([A-Z])/g, function (g, g1) {
+ return `-${g1.toLowerCase()}`
+ })
+}
+export function appendCss (css: string, cssId: string, replace: boolean) {
+ let style: any = document.getElementById(cssId)
+ if (style && replace) {
+ style.parentNode.removeChild(style)
+ style = null
+ }
+ if (!style) {
+ style = document.createElement('style')
+ style.type = 'text/css'
+ cssId && (style.id = cssId)
+ document.getElementsByTagName('head')[0].appendChild(style)
+ }
+ style.appendChild(document.createTextNode(css))
+}
+export function nextFrame (callback: any) {
+ const runner = window.requestAnimationFrame || window.webkitRequestAnimationFrame || (cb => setTimeout(cb, 16))
+ runner(callback)
+}
+export function toCSSText (object: any) {
+ if (!object) {
+ return
+ }
+ const obj = hyphenateStyleKeys(object)
+ let cssText = ''
+ for (const key in obj) {
+ cssText += `${key}:${obj[key]};`
+ }
+ return cssText
+}
[36/50] incubator-weex git commit: * [html5] fix component visible
case
Posted by da...@apache.org.
* [html5] fix component visible 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/e878c2d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e878c2d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e878c2d4
Branch: refs/heads/0.15-dev
Commit: e878c2d4ac70938bb6c5016e76d89f47ba8e4561
Parents: a1db177
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 18 10:40:34 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 18 10:40:34 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/component.js | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e878c2d4/html5/test/render/vue/utils/component.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/component.js b/html5/test/render/vue/utils/component.js
index 9de64b0..a8aee77 100644
--- a/html5/test/render/vue/utils/component.js
+++ b/html5/test/render/vue/utils/component.js
@@ -21,6 +21,7 @@ init('utils component', (Vue, helper) => {
before(() => {
helper.register('div', div)
vm = helper.createVm(firstScreenAppearBundle, id)
+ vm.$el.style.height = '100px'
})
describe('component functions', () => {
it('getParentScroller', () => {
[22/50] incubator-weex git commit: * [html5] update webSocket formate
Posted by da...@apache.org.
* [html5] update webSocket formate
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8a84fa6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8a84fa6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8a84fa6d
Branch: refs/heads/0.15-dev
Commit: 8a84fa6de3a68bfb4b990bf40c26e6e0025ae0e9
Parents: cfcf769
Author: erha19 <fa...@gmail.com>
Authored: Thu Jul 13 14:30:22 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Thu Jul 13 14:30:22 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8a84fa6d/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index d5a3c0d..b07205e 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -18,9 +18,8 @@
*/
import websocket from '../../../../render/vue/modules/websocket/websocket'
const TestUrl = 'ws://echo.websocket.org'
-/** @test {webSocket module} */
+ /** @test {webSocket module} */
describe('webSocket module', () => {
-
describe('extends Standard WebSocket API', () => {
context('should inherit', () => {
let ws = null
@@ -51,32 +50,28 @@ describe('webSocket module', () => {
context('should forward native events', () => {
let ws = null
before(() => {
- ws = websocket.WebSocket(TestUrl,'')
+ ws = websocket.WebSocket(TestUrl, '')
})
after(() => {
websocket.close()
})
it('open', function () {
- const open = () => {
- }
+ const open = () => {}
websocket.onopen = open
expect(ws.onopen).to.be.deep.equal(open)
})
it('close', function () {
- const close = () => {
- }
+ const close = () => {}
websocket.onclose = close
expect(ws.onclose).to.be.deep.equal(close)
})
it('error', function () {
- const error = () => {
- }
+ const error = () => {}
websocket.onerror = error
expect(ws.onerror).to.be.deep.equal(error)
})
it('message', function () {
- const message = () => {
- }
+ const message = () => {}
websocket.onmessage = message
expect(ws.onmessage).to.be.deep.equal(message)
})
[11/50] incubator-weex git commit: * [html5] update karam test config
Posted by da...@apache.org.
* [html5] update karam test config
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f55ef8da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f55ef8da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f55ef8da
Branch: refs/heads/0.15-dev
Commit: f55ef8da30dc1534d0ed9bacd361aaa0ef2eaaec
Parents: 5c1dc22
Author: erha19 <fa...@gmail.com>
Authored: Mon Jul 10 15:18:23 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Mon Jul 10 15:18:23 2017 +0800
----------------------------------------------------------------------
build/karma.vue.conf.js | 59 +++++++++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f55ef8da/build/karma.vue.conf.js
----------------------------------------------------------------------
diff --git a/build/karma.vue.conf.js b/build/karma.vue.conf.js
index 7a69d35..31dd819 100644
--- a/build/karma.vue.conf.js
+++ b/build/karma.vue.conf.js
@@ -20,16 +20,20 @@ var rollupConfig = require('./config')('weex-vue-render', true)
var path = require('path')
var flow = require('rollup-plugin-flow')
-function absolute(pa) {
+function absolute (pa) {
return path.resolve(__dirname, pa)
}
+
var removeConfigs = ['entry', 'dest', 'banner']
var removePlugins = ['eslint', 'uglify', 'flow-remove-type']
+
removeConfigs.forEach(cfg => {
delete rollupConfig[cfg]
})
+
var plugins = rollupConfig.plugins.slice()
rollupConfig.plugins = []
+
for (var i = 0, l = plugins.length; i < l; i++) {
var plg = plugins[i]
var isRemove = false
@@ -41,55 +45,64 @@ for (var i = 0, l = plugins.length; i < l; i++) {
isRemove = true
}
})
- if (!isRemove) {
- rollupConfig.plugins.push(plg)
- }
+ if (!isRemove) { rollupConfig.plugins.push(plg) }
}
+
/**
* rollup-plugin-flow-no-whiitespace cause fatial error.
* use rollup-plugin-flow instead, since no soucemap needed, it's acceptable for extra whitespaces.
*/
rollupConfig.plugins.splice(-2, 1, flow())
+
rollupConfig.format = 'iife'
rollupConfig.sourceMap = 'inline'
rollupConfig.intro = `describe('ignore inject function from postcss', function () {
- it('ignore', function () {
+ it('ignore', function () {
var shouldBe = 'test'
var expected = __$styleInject('.body{}',shouldBe)
expect(shouldBe).to.be.equal(expected)
})
})`
-
+
module.exports = function (config) {
config.set({
frameworks: ['mocha', 'sinon-chai'],
browsers: ['PhantomJS'],
- files: ['../html5/test/render/vue/utils/*.js',
- // '../html5/test/render/vue/core/*.js',
- // '../html5/test/render/vue/!(utils|core)/*.js'
+ files: [
+ '../html5/test/render/vue/utils/*.js',
+ '../html5/test/render/vue/core/*.js',
+ '../html5/test/render/vue/!(utils|core)/*.js'
+ ],
+ exclude: [
+ '../html5/test/render/vue/helper/*.js',
+ '../html5/test/render/vue/vender/**/*.js',
+ '../html5/test/render/vue/data/**/*.js'
],
- exclude: ['../html5/test/render/vue/helper/*.js', '../html5/test/render/vue/vender/**/*.js', '../html5/test/render/vue/data/**/*.js'],
- singleRun: false,
- // singleRun: true,
+
+ // singleRun: false,
+ singleRun: true,
+
reporters: ['mocha', 'coverage'],
coverageReporter: {
- reporters: [{
- type: 'html',
- dir: absolute('../coverage'),
- subdir: 'vue-renderer'
- }, {
- type: 'text-summary',
- dir: absolute('../coverage'),
- subdir: 'vue-renderer'
- }]
+ reporters: [
+ { type: 'html', dir: absolute('../coverage'), subdir: 'vue-renderer' },
+ { type: 'text-summary', dir: absolute('../coverage'), subdir: 'vue-renderer' }
+ ]
},
- browserDisconnectTimeout: 10000,
+ browserDisconnectTimeout:10000,
preprocessors: {
'../html5/test/**/*.js': ['rollup'],
'../html5/test/**/!(components|examples|core)/*.js': ['rollup', 'coverage']
},
rollupPreprocessor: rollupConfig,
- plugins: ['karma-coverage', 'karma-mocha', 'karma-mocha-reporter', 'karma-phantomjs-launcher', 'karma-rollup-preprocessor', 'karma-sinon-chai'
+
+ plugins: [
+ 'karma-coverage',
+ 'karma-mocha',
+ 'karma-mocha-reporter',
+ 'karma-phantomjs-launcher',
+ 'karma-rollup-preprocessor',
+ 'karma-sinon-chai'
// 'karma-sourcemap-loader',
// 'karma-webpack'
]
[14/50] incubator-weex git commit: * [html5] change code to es6 arrow
functions
Posted by da...@apache.org.
* [html5] change code to es6 arrow functions
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c6710081
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c6710081
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c6710081
Branch: refs/heads/0.15-dev
Commit: c671008155bc30ee8b505d4d068230949a1b1d28
Parents: bca5422
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 15:52:32 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 15:52:32 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/utils/event.js | 12 +++----
html5/test/render/vue/utils/func.js | 54 ++++++++++++++--------------
html5/test/render/vue/utils/lazyload.js | 36 ++++++++++---------
html5/test/render/vue/utils/style.js | 14 ++++----
html5/test/render/vue/utils/type.js | 8 ++---
5 files changed, 63 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6710081/html5/test/render/vue/utils/event.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/event.js b/html5/test/render/vue/utils/event.js
index 5be2e7f..837242e 100644
--- a/html5/test/render/vue/utils/event.js
+++ b/html5/test/render/vue/utils/event.js
@@ -19,7 +19,7 @@
import * as event from '../../../../render/vue/utils/event'
describe('utils', function () {
describe('event', function () {
- it('createEvent', function () {
+ it('createEvent', () => {
const {
createEvent
} = event
@@ -28,7 +28,7 @@ describe('utils', function () {
expect(clickEvent.type).to.be.equal('click')
expect(clickEvent.target).to.be.a('null')
})
- it('createCustomEvent', function () {
+ it('createCustomEvent', () => {
const {
createCustomEvent
} = event
@@ -37,7 +37,7 @@ describe('utils', function () {
expect(customEvent.type).to.be.equal('customEvent')
expect(customEvent.target).to.be.a('null')
})
- it('dispatchEvent', function (done) {
+ it('dispatchEvent', (done) => {
const {
dispatchEvent
} = event
@@ -45,7 +45,7 @@ describe('utils', function () {
let expected
const shouldBe = 'test'
document.body.appendChild(node)
- node.addEventListener('click', function () {
+ node.addEventListener('click', () => {
expected = shouldBe
document.body.removeChild(node)
expect(expected).to.be.equal(shouldBe)
@@ -56,7 +56,7 @@ describe('utils', function () {
dispatchEvent(node, clickevent)
expected(dispatchEvent).to.be.a('function')
})
- it('mapFormEvents', function () {
+ it('mapFormEvents', () => {
const {
mapFormEvents
} = event
@@ -64,7 +64,7 @@ describe('utils', function () {
$el: {
value: 'test'
},
- $emit: function () {}
+ $emit: () => {}
}
const spy = sinon.spy(context, '$emit')
const map = mapFormEvents(context)
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6710081/html5/test/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/func.js b/html5/test/render/vue/utils/func.js
index 1c50bac..ca8a2c5 100644
--- a/html5/test/render/vue/utils/func.js
+++ b/html5/test/render/vue/utils/func.js
@@ -19,13 +19,13 @@
import * as utils from '../../../../render/vue/utils/func'
describe('utils', function () {
describe('function', function () {
- before(function () {
+ before(() => {
this.clock = sinon.useFakeTimers()
})
- after(function () {
+ after(() => {
this.clock.restore()
})
- it('extend', function () {
+ it('extend', () => {
const {
extend
} = utils
@@ -45,7 +45,7 @@ describe('utils', function () {
})
expect(extend(abc, {})).to.be.deep.equal(abc)
})
- it('extendTruthy', function () {
+ it('extendTruthy', () => {
const {
extendTruthy
} = utils
@@ -59,7 +59,7 @@ describe('utils', function () {
expect(extendTruthy({}, [from])[0]).to.be.deep.equal(from)
expect(extendTruthy({}, [])).to.be.deep.equal({})
})
- it('extendKeys', function () {
+ it('extendKeys', () => {
const {
extendKeys
} = utils
@@ -73,7 +73,7 @@ describe('utils', function () {
}
expect(extendKeys({}, from, ['test1'])).to.be.deep.equal(expected)
})
- it('extractKeys', function () {
+ it('extractKeys', () => {
const {
extractKeys
} = utils
@@ -92,7 +92,7 @@ describe('utils', function () {
expect(from).to.be.deep.equal(fromExpected)
expect(extractKeys({}, {}, [])).to.be.deep.equal({})
})
- it('bind', function () {
+ it('bind', () => {
const {
bind
} = utils
@@ -102,40 +102,40 @@ describe('utils', function () {
}
return this.name ? this.name : ''
}
- const TEST = function () {
+ function TEST () {
this.name = 'test'
}
const shouldBe = bind(testfn, new TEST())()
expect(bind).to.be.a('function')
expect(shouldBe).to.be.equal('test')
})
- it('debounce', function () {
+ it('debounce', () => {
const {
debounce
} = utils
const shouldBe = 'test'
let expected
- debounce(function () {
+ debounce(() => {
expected = shouldBe
}, 500)()
this.clock.tick(500)
expect(shouldBe).to.be.equal(expected)
expect(debounce).to.be.a('function')
})
- it('depress', function () {
+ it('depress', () => {
const {
depress
} = utils
const shouldBe = 'test'
let expected
- depress(function () {
+ depress(() => {
expected = shouldBe
}, 100)()
this.clock.tick(100)
expect(shouldBe).to.be.equal(expected)
expect(depress).to.be.a('function')
})
- it('throttle', function () {
+ it('throttle', () => {
const {
throttle
} = utils
@@ -145,7 +145,7 @@ describe('utils', function () {
expected = parmas
}, wait, true)
throttlecb('test1')
- setTimeout(function () {
+ setTimeout(() => {
throttlecb('test2')
}, 50)
this.clock.tick(wait)
@@ -154,7 +154,7 @@ describe('utils', function () {
expect(expected).to.be.equal('test1')
expect(throttle).to.be.a('function')
})
- it('loopArray', function () {
+ it('loopArray', () => {
const {
loopArray
} = utils
@@ -164,10 +164,10 @@ describe('utils', function () {
expect(loopArray([1, 2, 3], -1)).to.be.deep.equal([2, 3, 1])
expect(loopArray([1, 2, 3], 0)).to.be.deep.equal([1, 2, 3])
})
- it('cached', function () {
+ it('cached', () => {
expect(utils.cached).to.be.a('function')
})
- it('camelize', function () {
+ it('camelize', () => {
const {
camelize
} = utils
@@ -178,7 +178,7 @@ describe('utils', function () {
expect(camelize('text-overflow')).to.be.equal('textOverflow')
expect(camelize('a-b-c-d')).to.be.equal('aBCD')
})
- it('camelizeKeys', function () {
+ it('camelizeKeys', () => {
const {
camelizeKeys
} = utils
@@ -194,7 +194,7 @@ describe('utils', function () {
expect(camelizeKeys).to.be.a('function')
expect(shouldBe).to.be.deep.equal(expected)
})
- it('capitalize', function () {
+ it('capitalize', () => {
const {
capitalize
} = utils
@@ -205,7 +205,7 @@ describe('utils', function () {
expect(capitalize('[string object]')).to.be.equal('[string object]')
expect(capitalize('I have an apple')).to.be.equal('I have an apple')
})
- it('hyphenate', function () {
+ it('hyphenate', () => {
const {
hyphenate
} = utils
@@ -216,7 +216,7 @@ describe('utils', function () {
expect(hyphenate('textOverflow')).to.be.equal('text-overflow')
expect(hyphenate('aBCD')).to.be.equal('a-b-c-d')
})
- it('hyphenateKeys', function () {
+ it('hyphenateKeys', () => {
const {
hyphenateKeys
} = utils
@@ -232,7 +232,7 @@ describe('utils', function () {
expect(hyphenateKeys).to.be.a('function')
expect(shouldBe).to.be.deep.equal(expected)
})
- it('hyphenateStyleKeys', function () {
+ it('hyphenateStyleKeys', () => {
const {
hyphenateStyleKeys
} = utils
@@ -248,7 +248,7 @@ describe('utils', function () {
expect(hyphenateStyleKeys).to.be.a('function')
expect(shouldBe).to.be.deep.equal(expected)
})
- it('camelToKebab', function () {
+ it('camelToKebab', () => {
const {
camelToKebab
} = utils
@@ -256,7 +256,7 @@ describe('utils', function () {
expect(camelToKebab('')).to.be.equal('')
expect(camelToKebab('ABC')).to.be.equal('-a-b-c')
})
- it('appendCss', function () {
+ it('appendCss', () => {
const {
appendCss
} = utils
@@ -271,13 +271,13 @@ describe('utils', function () {
handler = document.querySelector('#' + cssid)
expect(handler.textContent).to.be.equal(anothercss)
})
- it('nextFrame', function (done) {
+ it('nextFrame', done => {
const {
nextFrame
} = utils
let shouldBe
const expected = 'test'
- const cb = function () {
+ const cb = () => {
shouldBe = expected
}
expect(nextFrame).to.be.a('function')
@@ -288,7 +288,7 @@ describe('utils', function () {
done()
}, 10)
})
- it('toCSSText', function () {
+ it('toCSSText', () => {
const {
toCSSText
} = utils
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6710081/html5/test/render/vue/utils/lazyload.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/lazyload.js b/html5/test/render/vue/utils/lazyload.js
index 276b0d2..8576ffc 100644
--- a/html5/test/render/vue/utils/lazyload.js
+++ b/html5/test/render/vue/utils/lazyload.js
@@ -19,35 +19,37 @@
import * as lazyload from '../../../../render/vue/utils/lazyload'
describe('utils', function () {
describe('lazyload', function () {
- before(function () {
+ before(() => {
this.clock = sinon.useFakeTimers()
})
- after(function () {
+ after(() => {
this.clock.restore()
})
- it('applySrc', function () {})
- it('fireLazyload', function () {
- const {
- fireLazyload
- } = lazyload
- const node = document.createElement('figure')
- node.setAttribute('img-src', 'img-src.jpg')
- node.setAttribute('img-placeholder', 'img-placeholder.jpg')
- document.body.appendChild(node)
- fireLazyload(node, true)
- expect(node.style.backgroundImage).to.be.equal('url(http://localhost:9876/img-src.jpg)')
+ // it('applySrc', () => {
+
+ // })
+ it('fireLazyload', () => {
+ // const {
+ // fireLazyload
+ // } = lazyload
+ // const node = document.createElement('figure')
+ // node.setAttribute('img-src', 'http://some-domain/image-src.jpg')
+ // node.setAttribute('img-placeholder', 'http://some-domain/image-placeholder')
+ // document.body.appendChild(node)
+ // fireLazyload(node, true)
+ // expect(node.style.backgroundImage).to.be.equal('url(http://some-domain/image-src.jpg)')
})
- it('getThrottleLazyload', function () {
+ it('getThrottleLazyload', () => {
const {
getThrottleLazyload
} = lazyload
const node = document.createElement('figure')
- node.setAttribute('img-src', 'img-src.jpg')
- node.setAttribute('img-placeholder', 'img-placeholder.jpg')
+ node.setAttribute('img-src', 'http://some-domain/image-src.jpg')
+ node.setAttribute('img-placeholder', 'http://some-domain/image-placeholder')
document.body.appendChild(node)
const throttle = getThrottleLazyload(100, node)
expect(throttle).to.be.a('function')
- // throttle()
+ throttle()
// this.clock.tick(100)
// console.log(node.style.backgroundImage)
// expect(node.style.backgroundImage).to.be.equal('url(http://localhost:9876/img-src.jpg)')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6710081/html5/test/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/style.js b/html5/test/render/vue/utils/style.js
index 4344f01..4ef26c0 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -31,19 +31,19 @@ describe('style', function () {
// const info = {}
const { scale, dpr } = init()
- it('should normalize units numbers', function () {
+ it('should normalize units numbers', () => {
expect(normalizeUnitsNum('100px')).to.equal(100 * scale + 'px')
expect(normalizeUnitsNum('100')).to.equal(100 * scale + 'px')
expect(normalizeUnitsNum('100wx')).to.equal(100 * scale * dpr + 'px')
expect(normalizeUnitsNum('20wm')).to.equal('')
})
- it('should normalize number style vals', function () {
+ it('should normalize number style vals', () => {
expect(normalizeNumber('width', 10)).to.equal(10 * scale + 'px')
expect(normalizeNumber('width', 1.2)).to.equal(1.2 * scale + 'px')
})
- it('should normalize string style vals', function () {
+ it('should normalize string style vals', () => {
expect(normalizeString('width', '100%')).to.equal('100%')
expect(normalizeString('transform', 'translate3d(10px, 10px, 10px)'))
.to.equal(`translate3d(${10 * scale}px, ${10 * scale}px, ${10 * scale}px)`)
@@ -53,25 +53,25 @@ describe('style', function () {
.to.equal(`${4 * scale * dpr}px dotted red`)
})
- it('should normalize style object', function () {
+ it('should normalize style object', () => {
//
})
- it('should trim comment in style.', function () {
+ it('should trim comment in style.', () => {
const cssText = '.ani-point0[data-v-4c05cc1a] {\n left: 88px;\n top: 88px;\n}\n.ani-point1[data-v-4c05cc1a] {\n /* left: 43px;\n top: 71px;*/\n}'
const trimmed = '.ani-point0[data-v-4c05cc1a] {\n left: 88px;\n top: 88px;\n}\n.ani-point1[data-v-4c05cc1a] {\n \n}'
expect(trimComment(cssText)).to.equal(trimmed)
})
})
-describe('autoPrefix', function () {
+describe('autoPrefix', () => {
const style = {
width: '200px',
flexDirection: 'row',
transform: 'translate3d(100px, 100px, 0)'
}
- it('should add prefix for styles.', function () {
+ it('should add prefix for styles.', () => {
const res = autoPrefix(style)
const {
WebkitBoxDirection,
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6710081/html5/test/render/vue/utils/type.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/type.js b/html5/test/render/vue/utils/type.js
index 4941f24..991f569 100644
--- a/html5/test/render/vue/utils/type.js
+++ b/html5/test/render/vue/utils/type.js
@@ -19,7 +19,7 @@
import * as type from '../../../../render/vue/utils/type'
describe('utils', function () {
describe('type', function () {
- it('isPlainObject', function () {
+ it('isPlainObject', () => {
const {
isPlainObject
} = type
@@ -29,10 +29,10 @@ describe('utils', function () {
expect(isPlainObject([1, 2, 3])).to.be.equal(false)
expect(isPlainObject('1')).to.be.equal(false)
expect(isPlainObject(new Date())).to.be.equal(false)
- expect(isPlainObject(function () {})).to.be.equal(false)
+ expect(isPlainObject(() => {})).to.be.equal(false)
expect(isPlainObject(new RegExp('/^.?/'))).to.be.equal(false)
})
- it('isArray', function () {
+ it('isArray', () => {
const {
isArray
} = type
@@ -42,7 +42,7 @@ describe('utils', function () {
expect(isArray('1')).to.be.equal(false)
expect(isArray({})).to.be.equal(false)
expect(isArray(new Date())).to.be.equal(false)
- expect(isArray(function () {})).to.be.equal(false)
+ expect(isArray(() => {})).to.be.equal(false)
expect(isArray(new RegExp('/^.?/'))).to.be.equal(false)
})
})
[47/50] incubator-weex git commit: * [html5] fix copy right error
Posted by da...@apache.org.
* [html5] fix copy right error
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/31031488
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/31031488
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/31031488
Branch: refs/heads/0.15-dev
Commit: 310314884a16507d2563ec0615f328afbe1b974b
Parents: dac01e3
Author: erha19 <fa...@gmail.com>
Authored: Wed Jul 19 11:26:06 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Wed Jul 19 11:26:06 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 2 +-
html5/test/render/vue/utils/component.js | 2 +-
html5/test/render/vue/utils/event.js | 2 +-
html5/test/render/vue/utils/func.js | 2 +-
html5/test/render/vue/utils/perf.js | 2 +-
html5/test/render/vue/utils/type.js | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/31031488/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index 8731957..881f352 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
+ * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/31031488/html5/test/render/vue/utils/component.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/component.js b/html5/test/render/vue/utils/component.js
index 0f0b4f1..fc70be2 100644
--- a/html5/test/render/vue/utils/component.js
+++ b/html5/test/render/vue/utils/component.js
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
+ * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/31031488/html5/test/render/vue/utils/event.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/event.js b/html5/test/render/vue/utils/event.js
index 837242e..9834d16 100644
--- a/html5/test/render/vue/utils/event.js
+++ b/html5/test/render/vue/utils/event.js
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
+ * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/31031488/html5/test/render/vue/utils/func.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/func.js b/html5/test/render/vue/utils/func.js
index ca8a2c5..57eb32f 100644
--- a/html5/test/render/vue/utils/func.js
+++ b/html5/test/render/vue/utils/func.js
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
+ * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/31031488/html5/test/render/vue/utils/perf.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/perf.js b/html5/test/render/vue/utils/perf.js
index c582334..602da08 100644
--- a/html5/test/render/vue/utils/perf.js
+++ b/html5/test/render/vue/utils/perf.js
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
+ * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/31031488/html5/test/render/vue/utils/type.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/utils/type.js b/html5/test/render/vue/utils/type.js
index 991f569..fd37944 100644
--- a/html5/test/render/vue/utils/type.js
+++ b/html5/test/render/vue/utils/type.js
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
+ * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
[17/50] incubator-weex git commit: Merge branch '0.15-dev' of
https://github.com/apache/incubator-weex into 0.15-dev
Posted by da...@apache.org.
Merge branch '0.15-dev' of https://github.com/apache/incubator-weex into 0.15-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b9782739
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b9782739
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b9782739
Branch: refs/heads/0.15-dev
Commit: b978273983975de68915e4e8dc85e8a7d7e56d02
Parents: a60c54f 7f247fc
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 21:15:03 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 21:15:03 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 4 ++--
ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m | 14 +++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------