8000 :ok_hand: · vuejs/vue-class-component@555e78a · GitHub
[go: up one dir, main page]

Skip to content

Commit 555e78a

Browse files
committed
👌
1 parent 54df892 commit 555e78a

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

test/test-babel.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ describe('vue-class-component with Babel', () => {
3030

3131
it('should collect decorated class properties', () => {
3232

33-
const decorator1 = (value) => () => {
33+
const valueDecorator = (value) => () => {
3434
return {
3535
enumerable: true,
3636
value: value
3737
}
3838
}
3939

40-
const decorator2 = (value) => () => {
40+
const getterDecorator = (value) => () => {
4141
return {
4242
enumerable: true,
4343
get() {
@@ -46,28 +46,20 @@ describe('vue-class-component with Babel', () => {
4646
}
4747
}
4848

49-
@Component({
50-
props: ['foo']
51-
})
49+
@Component
5250
class MyComp extends Vue {
5351

54-
@decorator1('field1')
52+
@valueDecorator('field1')
5553
field1
5654

57-
@decorator2('field2')
55+
@getterDecorator('field2')
5856
field2
5957

60-
foo
6158
}
6259

63-
const c = new MyComp({
64-
propsData: {
65-
foo: 1
66-
}
67-
})
60+
const c = new MyComp()
6861
expect(c.field1).to.equal('field1')
6962
expect(c.field2).to.equal('field2')
70-
expect(c.foo).to.equal(1)
7163
})
7264

7365
it('should not collect uninitialized class properties', () => {

test/test.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ describe('vue-class-component', () => {
6262

6363
it('data: should collect from decorated class properties', () => {
6464

65-
const decorator1 = (value: any) => (_: any, __:any ): any => {
65+
const valueDecorator = (value: any) => (_: any, __: any): any => {
6666
return {
6767
enumerable: true,
6868
value
6969
}
7070
}
7171

72-
const decorator2 = (value: any) => (_: any, __:any ): any => {
72+
const getterDecorator = (value: any) => (_: any, __: any): any => {
7373
return {
7474
enumerable: true,
7575
get() {
@@ -78,28 +78,20 @@ describe('vue-class-component', () => {
7878
}
7979
}
8080

81-
@Component({
82-
props: ['foo']
83-
})
81+
@Component
8482
class MyComp extends Vue {
8583

86-
@decorator1('field1')
84+
@valueDecorator('field1')
8785
field1!: string
8886

89-
@decorator2('field2')
87+
@getterDecorator('field2')
9088
field2!: string
9189

92-
foo!: number
9390
}
9491

95-
const c = new MyComp({
96-
propsData: {
97-
foo: 1
98-
}
99-
})
92+
const c = new MyComp()
10093
expect(c.field1).to.equal('field1')
10194
expect(c.field2).to.equal('field2')
102-
expect(c.foo).to.equal(1)
10395
})
10496

10597
it('data: should collect custom property defined on beforeCreate', () => {

0 commit comments

Comments
 (0)
0