@@ -118,6 +118,49 @@ describe('scrub-file', () => {
118
118
expect ( tags . oneLine `${ transform ( input ) } ` ) . toEqual ( tags . oneLine `${ output } ` ) ;
119
119
} ) ;
120
120
121
+ it ( 'removes Angular decorators calls when __decorate is inlined' , ( ) => {
122
+ const output = tags . stripIndent `
123
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
124
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
125
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
126
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
127
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
128
+ };
129
+
130
+ import { Component, Injectable } from '@angular/core';
131
+ var Clazz = (function () {
132
+ function Clazz() { }
133
+ return Clazz;
134
+ }());
135
+ ` ;
136
+
137
+ const input = tags . stripIndent `
138
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
139
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
140
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
141
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
142
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
143
+ };
144
+
145
+ import { Component, Injectable } from '@angular/core';
146
+ var Clazz = (function () {
147
+ function Clazz() { }
148
+ Clazz = __decorate([
149
+ Injectable(),
150
+ Component({
151
+ selector: 'app-root',
152
+ templateUrl: './app.component.html',
153
+ styleUrls: ['./app.component.css']
154
+ })
155
+ ], Clazz);
156
+ return Clazz;
157
+ }());
158
+ ` ;
159
+
160
+ expect ( testScrubFile ( input ) ) . toBeTruthy ( ) ;
161
+ expect ( tags . oneLine `${ transform ( input ) } ` ) . toEqual ( tags . oneLine `${ output } ` ) ;
162
+ } ) ;
163
+
121
164
it ( 'removes constructor parameter metadata in __decorate' , ( ) => {
122
165
const output = tags . stripIndent `
123
166
import { __decorate, __metadata } from "tslib";
0 commit comments