File tree 2 files changed +12
-28
lines changed
2 files changed +12
-28
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ describe('vue-class-component with Babel', () => {
30
30
31
31
it ( 'should collect decorated class properties' , ( ) => {
32
32
33
- const decorator1 = ( value ) => ( ) => {
33
+ const valueDecorator = ( value ) => ( ) => {
34
34
return {
35
35
enumerable : true ,
36
36
value : value
37
37
}
38
38
}
39
39
40
- const decorator2 = ( value ) => ( ) => {
40
+ const getterDecorator = ( value ) => ( ) => {
41
41
return {
42
42
enumerable : true ,
43
43
get ( ) {
@@ -46,28 +46,20 @@ describe('vue-class-component with Babel', () => {
46
46
}
47
47
}
48
48
49
- @Component ( {
50
- props : [ 'foo' ]
51
- } )
49
+ @Component
52
50
class MyComp extends Vue {
53
51
54
- @decorator1 ( 'field1' )
52
+ @valueDecorator ( 'field1' )
55
53
field1
56
54
57
- @decorator2 ( 'field2' )
55
+ @getterDecorator ( 'field2' )
58
56
field2
59
57
60
- foo
61
58
}
62
59
63
- const c = new MyComp ( {
64
- propsData : {
65
- foo : 1
66
- }
67
- } )
60
+ const c = new MyComp ( )
68
61
expect ( c . field1 ) . to . equal ( 'field1' )
69
62
expect ( c . field2 ) . to . equal ( 'field2' )
70
- expect ( c . foo ) . to . equal ( 1 )
71
63
} )
72
64
73
65
it ( 'should not collect uninitialized class properties' , ( ) => {
Original file line number Diff line number Diff line change @@ -62,14 +62,14 @@ describe('vue-class-component', () => {
62
62
63
63
it ( 'data: should collect from decorated class properties' , ( ) => {
64
64
65
- const decorator1 = ( value : any ) => ( _ : any , __ :any ) : any => {
65
+ const valueDecorator = ( value : any ) => ( _ : any , __ : any ) : any => {
66
66
return {
67
67
enumerable : true ,
68
68
value
69
69
}
70
70
}
71
71
72
- const decorator2 = ( value : any ) => ( _ : any , __ :any ) : any => {
72
+ const getterDecorator = ( value : any ) => ( _ : any , __ : any ) : any => {
73
73
return {
74
74
enumerable : true ,
75
75
get ( ) {
@@ -78,28 +78,20 @@ describe('vue-class-component', () => {
78
78
}
79
79
}
80
80
81
- @Component ( {
82
- props : [ 'foo' ]
83
- } )
81
+ @Component
84
82
class MyComp extends Vue {
85
83
86
- @decorator1 ( 'field1' )
84
+ @valueDecorator ( 'field1' )
87
85
field1 ! : string
88
86
89
- @decorator2 ( 'field2' )
87
+ @getterDecorator ( 'field2' )
90
88
field2 ! : string
91
89
92
- foo ! : number
93
90
}
94
91
95
- const c = new MyComp ( {
96
- propsData : {
97
- foo : 1
98
- }
99
- } )
92
+ const c = new MyComp ( )
100
93
expect ( c . field1 ) . to . equal ( 'field1' )
101
94
expect ( c . field2 ) . to . equal ( 'field2' )
102
- expect ( c . foo ) . to . equal ( 1 )
103
95
} )
104
96
105
97
it ( 'data: should collect custom property defined on beforeCreate' , ( ) => {
You can’t perform that action at this time.
0 commit comments