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/24 12:37:00 UTC
[08/50] incubator-weex git commit: * [html5] improve unit test case
* [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.16-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',