@@ -76,6 +76,54 @@ describe('@ngtools/webpack transformers', () => {
76
76
expect ( oneLine `${ result } ` ) . toEqual ( oneLine `${ output } ` ) ;
77
77
} ) ;
78
78
79
+ it ( 'should keep other decorators on class member' , ( ) => {
80
+ const input = stripIndent `
81
+ import { Component, HostListener } from '@angular/core';
82
+ import { AnotherDecorator } from 'another-lib';
83
+
84
+ @Component({
85
+ selector: 'app-root',
86
+ templateUrl: './app.component.html',
87
+ styleUrls: ['./app.component.css']
88
+ })
89
+ export class AppComponent {
90
+ title = 'app';
91
+
92
+ @HostListener('document:keydown.escape')
93
+ @AnotherDecorator()
94
+ onEscape() {
95
+ console.log('run');
96
+ }
97
+ }
98
+ ` ;
99
+ const output = stripIndent `
100
+ import * as tslib_1 from "tslib";
101
+ import { AnotherDecorator } from 'another-lib';
102
+
103
+ export class AppComponent {
104
+ constructor() {
105
+ this.title = 'app';
106
+ }
107
+
108
+ onEscape() {
109
+ console.log('run');
110
+ }
111
+ }
112
+ tslib_1.__decorate([
113
+ AnotherDecorator()
114
+ ], AppComponent.prototype, "onEscape", null);
115
+ ` ;
116
+
117
+ const { program, compilerHost } = createTypescriptContext ( input ) ;
118
+ const transformer = removeDecorators (
119
+ ( ) => true ,
120
+ ( ) => program . getTypeChecker ( ) ,
121
+ ) ;
122
+ const result = transformTypescript ( undefined , [ transformer ] , program , compilerHost ) ;
123
+
124
+ expect ( oneLine `${ result } ` ) . toEqual ( oneLine `${ output } ` ) ;
125
+ } ) ;
126
+
79
127
it ( 'should remove imports for identifiers within the decorator' , ( ) => {
80
128
const input = stripIndent `
81
129
import { Component } from '@angular/core';
0 commit comments