|
| 1 | +import 'reflect-metadata' |
1 | 2 | import Component, { createDecorator, mixins } from '../lib'
|
2 | 3 | import { expect } from 'chai'
|
3 | 4 | import * as td from 'testdouble'
|
@@ -148,4 +149,30 @@ describe('vue-class-component with Babel', () => {
|
148 | 149 | expect(vm.valueA).to.equal('hi')
|
149 | 150 | expect(vm.valueB).to.equal(456)
|
150 | 151 | })
|
| 152 | + |
| 153 | + it('copies reflection metadata', function () { |
| 154 | + @Component |
| 155 | + @Reflect.metadata('worksConstructor', true) |
| 156 | + class Test extends Vue { |
| 157 | + @Reflect.metadata('worksStatic', true) |
| 158 | + static staticValue = 'staticValue' |
| 159 | + |
| 160 | + _test = false |
| 161 | + |
| 162 | + @Reflect.metadata('worksMethod', true) |
| 163 | + test () { |
| 164 | + void 0 |
| 165 | + } |
| 166 | + |
| 167 | + @Reflect.metadata('worksAccessor', true) |
| 168 | + get testAccessor () { |
| 169 | + return this._test |
| 170 | + } |
| 171 | + } |
| 172 | + |
| 173 | + expect(Reflect.getOwnMetadata('worksConstructor', Test)).to.equal(true) |
| 174 | + expect(Reflect.getOwnMetadata('worksStatic', Test, 'staticValue')).to.equal(true) |
| 175 | + expect(Reflect.getOwnMetadata('worksMethod', Test.prototype, 'test')).to.equal(true) |
| 176 | + expect(Reflect.getOwnMetadata('worksAccessor', Test.prototype, 'testAccessor')).to.equal(true) |
| 177 | + }) |
151 | 178 | })
|
0 commit comments