Skip to content

Commit f4df893

Browse files
committed
fix weex tests for optimizer adjustments
1 parent 9a65959 commit f4df893

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

test/weex/compiler/class.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ describe('compile class', () => {
66
const { render, staticRenderFns, errors } = compile(`<div class="a b c"></div>`)
77
expect(render).not.toBeUndefined()
88
expect(staticRenderFns).not.toBeUndefined()
9-
expect(staticRenderFns.length).toEqual(1)
10-
expect(staticRenderFns).toMatch(strToRegExp(`staticClass:["a","b","c"]`))
9+
expect(staticRenderFns.length).toEqual(0)
10+
expect(render).toMatch(strToRegExp(`staticClass:["a","b","c"]`))
1111
expect(errors).toEqual([])
1212
})
1313

test/weex/compiler/compile.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { compile } from '../../../packages/weex-template-compiler'
22

3-
describe('compile class', () => {
3+
describe('compile basic', () => {
44
it('should be compiled', () => {
5-
const { render, staticRenderFns, errors } = compile(`<div></div>`)
6-
expect(render).toEqual(`with(this){return _m(0)}`)
7-
expect(staticRenderFns).toEqual([`with(this){return _h('div')}`])
5+
const { render, staticRenderFns, errors } = compile(`<div>{{hi}}</div>`)
6+
expect(render).toEqual(`with(this){return _h('div',[_s(hi)])}`)
7+
expect(staticRenderFns.length).toBe(0)
88
expect(errors).toEqual([])
99
})
1010

test/weex/compiler/style.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@ describe('compile style', () => {
66
const { render, staticRenderFns, errors } = compile(`<div style="a: x; b: y"></div>`)
77
expect(render).not.toBeUndefined()
88
expect(staticRenderFns).not.toBeUndefined()
9-
expect(staticRenderFns.length).toEqual(1)
10-
expect(staticRenderFns).toMatch(strToRegExp(`staticStyle:{a:"x",b:"y"}`))
9+
expect(staticRenderFns.length).toEqual(0)
10+
expect(render).toMatch(strToRegExp(`staticStyle:{a:"x",b:"y"}`))
1111
expect(errors).toEqual([])
1212
})
1313

1414
it('should compile empty style value', () => {
1515
const { render, staticRenderFns, errors } = compile(`<div style=""></div>`)
1616
expect(render).not.toBeUndefined()
1717
expect(staticRenderFns).not.toBeUndefined()
18-
expect(staticRenderFns.length).toEqual(1)
19-
expect(staticRenderFns).toMatch(/[(^style|^staticStyle)]/)
18+
expect(staticRenderFns.length).toEqual(0)
19+
expect(render).toMatch(/[(^style|^staticStyle)]/)
2020
expect(errors).toEqual([])
2121
})
2222

2323
it('should compile style value with trailing semicolon', () => {
2424
const { render, staticRenderFns, errors } = compile(`<div style="a: x; b: y;"></div>`)
2525
expect(render).not.toBeUndefined()
2626
expect(staticRenderFns).not.toBeUndefined()
27-
expect(staticRenderFns.length).toEqual(1)
28-
expect(staticRenderFns).toMatch(strToRegExp(`staticStyle:{a:"x",b:"y"}`))
27+
expect(staticRenderFns.length).toEqual(0)
28+
expect(render).toMatch(strToRegExp(`staticStyle:{a:"x",b:"y"}`))
2929
expect(errors).toEqual([])
3030
})
3131

3232
it('should compile hyphanted style name & value', () => {
3333
const { render, staticRenderFns, errors } = compile(`<div style="-abc-def: x-y; abc-def: x-y"></div>`)
3434
expect(render).not.toBeUndefined()
3535
expect(staticRenderFns).not.toBeUndefined()
36-
expect(staticRenderFns.length).toEqual(1)
37-
expect(staticRenderFns).toMatch(strToRegExp(`staticStyle:{AbcDef:"x-y",abcDef:"x-y"}`))
36+
expect(staticRenderFns.length).toEqual(0)
37+
expect(render).toMatch(strToRegExp(`staticStyle:{AbcDef:"x-y",abcDef:"x-y"}`))
3838
expect(errors).toEqual([])
3939
})
4040

0 commit comments

Comments
 (0)