File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ export type ReflectionMap = {
10
10
static : StringToArrayMap
11
11
}
12
12
13
- export function reflectionIsSupported ( ) {
13
+ export function reflectionIsSupported ( ) {
14
14
return ( Reflect && Reflect . defineMetadata ) !== undefined
15
15
}
16
16
17
- export function copyReflectionMetadata (
17
+ export function copyReflectionMetadata (
18
18
from : VueConstructor ,
19
19
to : VueConstructor ,
20
20
reflectionMap : ReflectionMap
@@ -24,7 +24,7 @@ export function copyReflectionMetadata(
24
24
shallowCopy ( from , to , { 'constructor' : reflectionMap . constructor } )
25
25
}
26
26
27
- function shallowCopy ( from : VueConstructor , to : VueConstructor , propertyKeys : StringToArrayMap ) {
27
+ function shallowCopy ( from : VueConstructor , to : VueConstructor , propertyKeys : StringToArrayMap ) {
28
28
for ( const propertyKey in propertyKeys ) {
29
29
propertyKeys [ propertyKey ] . forEach ( ( metadataKey ) => {
30
30
if ( propertyKey == 'constructor' ) {
Original file line number Diff line number Diff line change @@ -372,23 +372,27 @@ describe('vue-class-component', () => {
372
372
} )
373
373
374
374
it ( 'copies reflection metadata' , function ( ) {
375
- const trickyDecorator = ( proto : Vue , _ : string ) =>
376
- Reflect . defineMetadata ( 'worksConstructor' , true , proto . constructor )
377
-
378
375
@Component
376
+ @Reflect . metadata ( 'worksConstructor' , true )
379
377
class Test extends Vue {
380
- @trickyDecorator
381
- trickyCase : string = 'trickyCase'
382
-
383
378
@Reflect . metadata ( 'worksStatic' , true )
384
379
static staticValue : string = 'staticValue'
385
380
381
+ private _test : boolean = false ;
382
+
386
383
@Reflect . metadata ( 'worksMethod' , true )
387
- test ( ) : void { }
384
+ test ( ) : void {
385
+ void 0
386
+ }
388
387
389
388
@Reflect . metadata ( 'worksAccessor' , true )
390
- get testAccessor ( ) : boolean { return true }
391
- set testAccessor ( value : boolean ) { void ( value ) }
389
+ get testAccessor ( ) : boolean {
390
+ return this . _test
391
+ }
392
+
393
+ set testAccessor ( value : boolean ) {
394
+ this . _test = value
395
+ }
392
396
}
393
397
394
398
expect ( Reflect . getOwnMetadata ( 'worksConstructor' , Test ) ) . to . equal ( true )
You can’t perform that action at this time.
0 commit comments