You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/12/05 06:21:55 UTC
incubator-weex git commit: * [html5] bugfix: the unit wx doesn't work
correctly.
Repository: incubator-weex
Updated Branches:
refs/heads/master ec2d234e5 -> e31e5eb45
* [html5] bugfix: the unit wx doesn't work correctly.
Since the wx unit was designed to match the native unit px, so the '1wx'
should be the same long in any devices or any screens. It doesn't adapt
to screens by multiply a ratio which is `weex.config.env.scale`. Just
keep them in px forms and be their original values.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e31e5eb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e31e5eb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e31e5eb4
Branch: refs/heads/master
Commit: e31e5eb45d2db1e94287fcd1b7503b6b7d68f92e
Parents: ec2d234
Author: MrRaindrop <te...@gmail.com>
Authored: Wed Nov 29 15:40:40 2017 +0800
Committer: cxfeng <cx...@apache.org>
Committed: Tue Dec 5 14:21:36 2017 +0800
----------------------------------------------------------------------
html5/render/vue/README.md | 4 ++++
html5/render/vue/utils/style.js | 4 ++--
html5/test/render/vue/modules/modal.js | 9 +++++----
html5/test/render/vue/utils/style.js | 7 +++----
package.json | 2 +-
packages/weex-vue-render/README.md | 4 ++++
packages/weex-vue-render/package.json | 2 +-
7 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/html5/render/vue/README.md
----------------------------------------------------------------------
diff --git a/html5/render/vue/README.md b/html5/render/vue/README.md
index ed83f59..feddee8 100644
--- a/html5/render/vue/README.md
+++ b/html5/render/vue/README.md
@@ -202,6 +202,10 @@ vue: {
* fix indicator position in one page slider.
+#### 0.12.26
+
+* fix unit wx, which is a straight px value not to adapt to screens.
+
## component -> dom map
| component | dom element | children | note |
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/html5/render/vue/utils/style.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/utils/style.js b/html5/render/vue/utils/style.js
index a992617..5f823d7 100644
--- a/html5/render/vue/utils/style.js
+++ b/html5/render/vue/utils/style.js
@@ -90,10 +90,10 @@ export function normalizeUnitsNum (val: string): string {
}
function getUnitScaleMap () {
- const { scale, dpr } = getViewportInfo()
+ const { scale } = getViewportInfo()
return {
px: scale,
- wx: scale * dpr
+ wx: 1 // use px straight, not adaptable to screens.
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/html5/test/render/vue/modules/modal.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/modal.js b/html5/test/render/vue/modules/modal.js
index a0e10f1..739b7e2 100644
--- a/html5/test/render/vue/modules/modal.js
+++ b/html5/test/render/vue/modules/modal.js
@@ -55,16 +55,17 @@ describe('modal module', function () {
expect(toast.push).to.be.a('function')
expect(toast.show).to.be.a('function')
})
- it('should toast mount on document when push method is called', function () {
+ it('should toast mount on document when push method is called', function (done) {
const TOAST_WIN_CLASS_NAME = '.weex-toast'
let $Toast = null
- const clock = sinon.useFakeTimers()
toast.push(config.message, config.duration)
$Toast = document.querySelector(TOAST_WIN_CLASS_NAME)
expect($Toast.innerText, 'should contain Test message').to.be.equal(config.message)
expect(nodeListToArray($Toast.classList), 'should include hide class').to.include('hide')
- clock.tick(config.duration * 1000)
- expect(nodeListToArray($Toast.classList), 'should remove hide class').to.not.include('hide')
+ setTimeout(function () {
+ expect(nodeListToArray($Toast.classList), 'should remove hide class').to.not.include('hide')
+ done()
+ }, config.duration * 1000)
})
it('call show method while toast queue length < 1', function () {
const TOAST_WIN_CLASS_NAME = '.weex-toast'
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/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 2b2e321..bf74700 100644
--- a/html5/test/render/vue/utils/style.js
+++ b/html5/test/render/vue/utils/style.js
@@ -40,8 +40,7 @@ describe('style', function () {
// const rect = document.documentElement.getBoundingClientRect()
// const info = {}
const {
- scale,
- dpr
+ scale
} = init()
it('should support using 0.5px to paint 1px width border', () => {
expect(supportHairlines()).to.be.false
@@ -56,7 +55,7 @@ describe('style', 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('100wx')).to.equal('100px')
expect(normalizeUnitsNum('20wm')).to.equal('')
})
it('should normalize number style vals', () => {
@@ -67,7 +66,7 @@ describe('style', function () {
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('border-left', '4wx dotted red')).to.equal(`4px dotted red`)
})
it('should normalize style object', () => {
const style = {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index e3eea1c..3b5e638 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"subversion": {
"browser": "0.5.0",
"framework": "0.22.4",
- "vue-render": "0.12.25",
+ "vue-render": "0.12.26",
"transformer": ">=0.1.5 <0.5"
},
"description": "A framework for building Mobile cross-platform UI",
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/packages/weex-vue-render/README.md
----------------------------------------------------------------------
diff --git a/packages/weex-vue-render/README.md b/packages/weex-vue-render/README.md
index ed83f59..feddee8 100644
--- a/packages/weex-vue-render/README.md
+++ b/packages/weex-vue-render/README.md
@@ -202,6 +202,10 @@ vue: {
* fix indicator position in one page slider.
+#### 0.12.26
+
+* fix unit wx, which is a straight px value not to adapt to screens.
+
## component -> dom map
| component | dom element | children | note |
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e31e5eb4/packages/weex-vue-render/package.json
----------------------------------------------------------------------
diff --git a/packages/weex-vue-render/package.json b/packages/weex-vue-render/package.json
index 3b0e034..ae7a1ff 100644
--- a/packages/weex-vue-render/package.json
+++ b/packages/weex-vue-render/package.json
@@ -1,6 +1,6 @@
{
"name": "weex-vue-render",
- "version": "0.12.25",
+ "version": "0.12.26",
"description": "Weex built-in components for Vue 2.x.",
"license": "Apache-2.0",
"main": "dist/index.common.js",