* [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 <faterr...@gmail.com> Authored: Tue Jul 18 15:16:34 2017 +0800 Committer: erha19 <faterr...@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',