@@ -3,28 +3,28 @@ import { compile } from '../../../packages/weex-template-compiler'
3
3
describe ( 'compile basic' , ( ) => {
4
4
it ( 'should be compiled' , ( ) => {
5
5
const { render, staticRenderFns, errors } = compile ( `<div>{{hi}}</div>` )
6
- expect ( render ) . toEqual ( `with(this){return _h ('div',[_s(hi)])}` )
6
+ expect ( render ) . toEqual ( `with(this){return _c ('div',[_v( _s(hi) )])}` )
7
7
expect ( staticRenderFns . length ) . toBe ( 0 )
8
8
expect ( errors ) . toEqual ( [ ] )
9
9
} )
10
10
11
11
it ( 'should compile data bindings' , ( ) => {
12
12
const { render, staticRenderFns, errors } = compile ( `<div :a="b"></div>` )
13
- expect ( render ) . toEqual ( `with(this){return _h ('div',{attrs:{"a":b}})}` )
13
+ expect ( render ) . toEqual ( `with(this){return _c ('div',{attrs:{"a":b}})}` )
14
14
expect ( staticRenderFns ) . toEqual ( [ ] )
15
15
expect ( errors ) . toEqual ( [ ] )
16
16
} )
17
17
18
18
it ( 'should compile event bindings' , ( ) => {
19
19
const { render, staticRenderFns, errors } = compile ( `<div @click="x"></div>` )
20
- expect ( render ) . toEqual ( `with(this){return _h ('div',{on:{"click":x}})}` )
20
+ expect ( render ) . toEqual ( `with(this){return _c ('div',{on:{"click":x}})}` )
21
21
expect ( staticRenderFns ) . toEqual ( [ ] )
22
22
expect ( errors ) . toEqual ( [ ] )
23
23
} )
24
24
25
25
it ( 'should compile data bindings with children' , ( ) => {
26
26
const { render, staticRenderFns, errors } = compile ( `<foo :a="b"><text>Hello</text></foo>` )
27
- expect ( render ) . toEqual ( `with(this){return _h ('foo',{attrs:{"a":b}},[_h ('text',["Hello"])])}` )
27
+ expect ( render ) . toEqual ( `with(this){return _c ('foo',{attrs:{"a":b}},[_c ('text',[_v( "Hello") ])])}` )
28
28
expect ( staticRenderFns ) . toEqual ( [ ] )
29
29
expect ( errors ) . toEqual ( [ ] )
30
30
} )
@@ -38,7 +38,7 @@ describe('compile basic', () => {
38
38
<text style="margin-left:36px;color:#eee;">Load more...</text>
39
39
</refresh>
40
40
` )
41
- expect ( render ) . toEqual ( `with(this){return _h ('refresh',{staticClass:["refresh"],staticStyle:{flexDirection:"row"},attrs:{"display":displayRefresh},on:{"refresh":handleRefresh}},[_h ('loading-indicator'),_h ('text',{staticStyle:{marginLeft:"36px",color:"#eee"}},["Load more..."])])}` )
41
+ expect ( render ) . toEqual ( `with(this){return _c ('refresh',{staticClass:["refresh"],staticStyle:{flexDirection:"row"},attrs:{"display":displayRefresh},on:{"refresh":handleRefresh}},[_c ('loading-indicator'),_c ('text',{staticStyle:{marginLeft:"36px",color:"#eee"}},[_v( "Load more...") ])])}` )
42
42
expect ( staticRenderFns ) . toEqual ( [ ] )
43
43
expect ( errors ) . toEqual ( [ ] )
44
44
} )
0 commit comments