@ihk-gfi/lux-components-update 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +198 -0
- package/README.md +55 -0
- package/package.json +54 -0
- package/src/add-lux-components/files/app/app-routing.module.ts +19 -0
- package/src/add-lux-components/files/app/app.component.html +27 -0
- package/src/add-lux-components/files/app/app.component.spec.ts +19 -0
- package/src/add-lux-components/files/app/app.component.ts +13 -0
- package/src/add-lux-components/files/app/app.module.ts +56 -0
- package/src/add-lux-components/files/app/error/error.component.html +10 -0
- package/src/add-lux-components/files/app/error/error.component.scss +3 -0
- package/src/add-lux-components/files/app/error/error.component.spec.ts +49 -0
- package/src/add-lux-components/files/app/error/error.component.ts +17 -0
- package/src/add-lux-components/files/app/home/home.component.html +7 -0
- package/src/add-lux-components/files/app/home/home.component.scss +0 -0
- package/src/add-lux-components/files/app/home/home.component.ts +13 -0
- package/src/add-lux-components/files/app/profil/profil.component.html +1 -0
- package/src/add-lux-components/files/app/profil/profil.component.scss +0 -0
- package/src/add-lux-components/files/app/profil/profil.component.spec.ts +24 -0
- package/src/add-lux-components/files/app/profil/profil.component.ts +11 -0
- package/src/add-lux-components/files/environments/environment.prod.ts +4 -0
- package/src/add-lux-components/files/environments/environment.ts +17 -0
- package/src/add-lux-components/files/locale/messages.en.xlf +948 -0
- package/src/add-lux-components/files/locale/messages.xlf +822 -0
- package/src/add-lux-components/files/scripts/.browserslistrc +17 -0
- package/src/add-lux-components/files/src/polyfills.ts +68 -0
- package/src/add-lux-components/index.d.ts +10 -0
- package/src/add-lux-components/index.js +143 -0
- package/src/add-lux-components/index.js.map +1 -0
- package/src/add-lux-components/index.ts +183 -0
- package/src/add-lux-components/index_spec.d.ts +1 -0
- package/src/add-lux-components/index_spec.js +51 -0
- package/src/add-lux-components/index_spec.js.map +1 -0
- package/src/add-lux-components/index_spec.ts +55 -0
- package/src/add-lux-components/schema.json +23 -0
- package/src/collection.json +55 -0
- package/src/migrate-to-eslint/files/.eslintrc.json +68 -0
- package/src/migrate-to-eslint/files/.prettierrc +25 -0
- package/src/migrate-to-eslint/index.d.ts +6 -0
- package/src/migrate-to-eslint/index.js +149 -0
- package/src/migrate-to-eslint/index.js.map +1 -0
- package/src/migrate-to-eslint/index.ts +181 -0
- package/src/migrate-to-eslint/index_spec.d.ts +1 -0
- package/src/migrate-to-eslint/index_spec.js +129 -0
- package/src/migrate-to-eslint/index_spec.js.map +1 -0
- package/src/migrate-to-eslint/index_spec.ts +152 -0
- package/src/migrate-to-eslint/schema.json +23 -0
- package/src/migrate-to-webcomponent/index.d.ts +10 -0
- package/src/migrate-to-webcomponent/index.js +278 -0
- package/src/migrate-to-webcomponent/index.js.map +1 -0
- package/src/migrate-to-webcomponent/index.ts +331 -0
- package/src/migrate-to-webcomponent/index_spec.d.ts +1 -0
- package/src/migrate-to-webcomponent/index_spec.js +580 -0
- package/src/migrate-to-webcomponent/index_spec.js.map +1 -0
- package/src/migrate-to-webcomponent/index_spec.ts +703 -0
- package/src/migrate-to-webcomponent/schema.json +23 -0
- package/src/update/files/locale/messages.en.xlf +940 -0
- package/src/update/files/locale/messages.xlf +815 -0
- package/src/update/files/scripts/move-de-files.js +15 -0
- package/src/update/index.d.ts +23 -0
- package/src/update/index.js +635 -0
- package/src/update/index.js.map +1 -0
- package/src/update/index.ts +712 -0
- package/src/update/index_spec.d.ts +1 -0
- package/src/update/index_spec.js +990 -0
- package/src/update/index_spec.js.map +1 -0
- package/src/update/index_spec.ts +1145 -0
- package/src/update/schema.json +23 -0
- package/src/update-dependencies/index.d.ts +5 -0
- package/src/update-dependencies/index.js +113 -0
- package/src/update-dependencies/index.js.map +1 -0
- package/src/update-dependencies/index.ts +114 -0
- package/src/update-dependencies/schema.json +23 -0
- package/src/update110001/index.d.ts +2 -0
- package/src/update110001/index.js +42 -0
- package/src/update110001/index.js.map +1 -0
- package/src/update110001/index.ts +40 -0
- package/src/update110001/index_spec.d.ts +1 -0
- package/src/update110001/index_spec.js +67 -0
- package/src/update110001/index_spec.js.map +1 -0
- package/src/update110001/index_spec.ts +72 -0
- package/src/update110001/schema.json +23 -0
- package/src/update110100/index.d.ts +2 -0
- package/src/update110100/index.js +27 -0
- package/src/update110100/index.js.map +1 -0
- package/src/update110100/index.ts +24 -0
- package/src/update110100/index_spec.d.ts +1 -0
- package/src/update110100/index_spec.js +69 -0
- package/src/update110100/index_spec.js.map +1 -0
- package/src/update110100/index_spec.ts +73 -0
- package/src/update110100/schema.json +23 -0
- package/src/update110101/index.d.ts +2 -0
- package/src/update110101/index.js +24 -0
- package/src/update110101/index.js.map +1 -0
- package/src/update110101/index.ts +21 -0
- package/src/update110101/index_spec.d.ts +1 -0
- package/src/update110101/index_spec.js +65 -0
- package/src/update110101/index_spec.js.map +1 -0
- package/src/update110101/index_spec.ts +69 -0
- package/src/update110101/schema.json +23 -0
- package/src/update110200/index.d.ts +2 -0
- package/src/update110200/index.js +24 -0
- package/src/update110200/index.js.map +1 -0
- package/src/update110200/index.ts +21 -0
- package/src/update110200/index_spec.d.ts +1 -0
- package/src/update110200/index_spec.js +65 -0
- package/src/update110200/index_spec.js.map +1 -0
- package/src/update110200/index_spec.ts +69 -0
- package/src/update110200/schema.json +23 -0
- package/src/update110300/index.d.ts +2 -0
- package/src/update110300/index.js +133 -0
- package/src/update110300/index.js.map +1 -0
- package/src/update110300/index.ts +148 -0
- package/src/update110300/index_spec.d.ts +1 -0
- package/src/update110300/index_spec.js +121 -0
- package/src/update110300/index_spec.js.map +1 -0
- package/src/update110300/index_spec.ts +139 -0
- package/src/update110300/schema.json +23 -0
- package/src/utility/dependencies.d.ts +39 -0
- package/src/utility/dependencies.js +96 -0
- package/src/utility/dependencies.js.map +1 -0
- package/src/utility/dependencies.ts +116 -0
- package/src/utility/files.d.ts +60 -0
- package/src/utility/files.js +299 -0
- package/src/utility/files.js.map +1 -0
- package/src/utility/files.ts +355 -0
- package/src/utility/html.d.ts +49 -0
- package/src/utility/html.js +183 -0
- package/src/utility/html.js.map +1 -0
- package/src/utility/html.ts +212 -0
- package/src/utility/json.d.ts +34 -0
- package/src/utility/json.js +70 -0
- package/src/utility/json.js.map +1 -0
- package/src/utility/json.ts +70 -0
- package/src/utility/logging.d.ts +32 -0
- package/src/utility/logging.js +82 -0
- package/src/utility/logging.js.map +1 -0
- package/src/utility/logging.ts +80 -0
- package/src/utility/test.d.ts +10 -0
- package/src/utility/test.js +24 -0
- package/src/utility/test.js.map +1 -0
- package/src/utility/test.ts +24 -0
- package/src/utility/typescript.d.ts +22 -0
- package/src/utility/typescript.js +521 -0
- package/src/utility/typescript.js.map +1 -0
- package/src/utility/typescript.ts +598 -0
- package/src/utility/typescript_spec.d.ts +1 -0
- package/src/utility/typescript_spec.js +1006 -0
- package/src/utility/typescript_spec.js.map +1 -0
- package/src/utility/typescript_spec.ts +1267 -0
- package/src/utility/util.d.ts +33 -0
- package/src/utility/util.js +139 -0
- package/src/utility/util.js.map +1 -0
- package/src/utility/util.ts +140 -0
- package/src/utility/validation.d.ts +11 -0
- package/src/utility/validation.js +44 -0
- package/src/utility/validation.js.map +1 -0
- package/src/utility/validation.ts +49 -0
- package/tsconfig.json +37 -0
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const test_1 = require("../utility/test");
|
|
15
|
+
const util_1 = require("../utility/util");
|
|
16
|
+
const typescript_1 = require("./typescript");
|
|
17
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
18
|
+
describe('typescript', () => {
|
|
19
|
+
let appTree;
|
|
20
|
+
let runner;
|
|
21
|
+
let context;
|
|
22
|
+
const testOptions = {};
|
|
23
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
25
|
+
appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', test_1.workspaceOptions).toPromise();
|
|
26
|
+
appTree = yield runner
|
|
27
|
+
.runExternalSchematicAsync('@schematics/angular', 'application', test_1.appOptions, appTree)
|
|
28
|
+
.toPromise();
|
|
29
|
+
util_1.UtilConfig.defaultWaitMS = 0;
|
|
30
|
+
testOptions.project = test_1.appOptions.name;
|
|
31
|
+
testOptions.path = test_1.workspaceOptions.newProjectRoot + '/' + test_1.appOptions.name;
|
|
32
|
+
testOptions.verbose = true;
|
|
33
|
+
}));
|
|
34
|
+
describe('[Method] removeProvider', () => {
|
|
35
|
+
it('Sollte den Provider (mehrere Provider - erster Provider) entfernen', (done) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
38
|
+
appTree.create(filePath, `
|
|
39
|
+
import { environment } from '../environments/environment';
|
|
40
|
+
|
|
41
|
+
@NgModule({
|
|
42
|
+
declarations : [
|
|
43
|
+
AppComponent
|
|
44
|
+
],
|
|
45
|
+
imports : [
|
|
46
|
+
HttpClientModule,
|
|
47
|
+
],
|
|
48
|
+
entryComponents: [
|
|
49
|
+
LuxFilePreviewComponent
|
|
50
|
+
],
|
|
51
|
+
providers : [
|
|
52
|
+
LuxStorageService,
|
|
53
|
+
LuxDialogService,
|
|
54
|
+
DatePipe
|
|
55
|
+
],
|
|
56
|
+
bootstrap : [
|
|
57
|
+
AppComponent
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
export class AppModule {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
`);
|
|
64
|
+
typescript_1.removeProvider(appTree, filePath, 'LuxStorageService', false);
|
|
65
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
66
|
+
expect(content).toContain('providers : [\n LuxDialogService,\n DatePipe\n ],');
|
|
67
|
+
done();
|
|
68
|
+
});
|
|
69
|
+
it('Sollte den Provider (mehrere Provider - mittlerer Provider) entfernen', (done) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
72
|
+
appTree.create(filePath, `
|
|
73
|
+
import { environment } from '../environments/environment';
|
|
74
|
+
|
|
75
|
+
@NgModule({
|
|
76
|
+
declarations : [
|
|
77
|
+
AppComponent
|
|
78
|
+
],
|
|
79
|
+
imports : [
|
|
80
|
+
HttpClientModule,
|
|
81
|
+
],
|
|
82
|
+
entryComponents: [
|
|
83
|
+
LuxFilePreviewComponent
|
|
84
|
+
],
|
|
85
|
+
providers : [
|
|
86
|
+
LuxDialogService,
|
|
87
|
+
LuxStorageService,
|
|
88
|
+
DatePipe
|
|
89
|
+
],
|
|
90
|
+
bootstrap : [
|
|
91
|
+
AppComponent
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
export class AppModule {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
`);
|
|
98
|
+
typescript_1.removeProvider(appTree, filePath, 'LuxStorageService', false);
|
|
99
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
100
|
+
expect(content).toContain('providers : [\n LuxDialogService,\n DatePipe\n ],');
|
|
101
|
+
done();
|
|
102
|
+
});
|
|
103
|
+
it('Sollte den Provider (mehrere Provider - mittlerer Provider - komplexer Provider) entfernen', (done) => {
|
|
104
|
+
var _a;
|
|
105
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
106
|
+
appTree.create(filePath, `
|
|
107
|
+
import { environment } from '../environments/environment';
|
|
108
|
+
|
|
109
|
+
@NgModule({
|
|
110
|
+
declarations : [
|
|
111
|
+
AppComponent
|
|
112
|
+
],
|
|
113
|
+
imports : [
|
|
114
|
+
HttpClientModule,
|
|
115
|
+
],
|
|
116
|
+
entryComponents: [
|
|
117
|
+
LuxFilePreviewComponent
|
|
118
|
+
],
|
|
119
|
+
providers : [
|
|
120
|
+
LuxDialogService,
|
|
121
|
+
{
|
|
122
|
+
provide : HTTP_INTERCEPTORS,
|
|
123
|
+
useClass: UnauthorizedInterceptor,
|
|
124
|
+
multi : true
|
|
125
|
+
},
|
|
126
|
+
DatePipe
|
|
127
|
+
],
|
|
128
|
+
bootstrap : [
|
|
129
|
+
AppComponent
|
|
130
|
+
]
|
|
131
|
+
})
|
|
132
|
+
export class AppModule {
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
`);
|
|
136
|
+
typescript_1.removeProvider(appTree, filePath, 'HTTP_INTERCEPTORS', false);
|
|
137
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
138
|
+
expect(content).toContain('providers : [\n LuxDialogService,\n DatePipe\n ],');
|
|
139
|
+
done();
|
|
140
|
+
});
|
|
141
|
+
it('Sollte den Provider (mehrere Provider - letzter Provider) entfernen', (done) => {
|
|
142
|
+
var _a;
|
|
143
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
144
|
+
appTree.create(filePath, `
|
|
145
|
+
import { environment } from '../environments/environment';
|
|
146
|
+
|
|
147
|
+
@NgModule({
|
|
148
|
+
declarations : [
|
|
149
|
+
AppComponent
|
|
150
|
+
],
|
|
151
|
+
imports : [
|
|
152
|
+
HttpClientModule,
|
|
153
|
+
],
|
|
154
|
+
entryComponents: [
|
|
155
|
+
LuxFilePreviewComponent
|
|
156
|
+
],
|
|
157
|
+
providers : [
|
|
158
|
+
LuxDialogService,
|
|
159
|
+
DatePipe,
|
|
160
|
+
LuxStorageService
|
|
161
|
+
],
|
|
162
|
+
bootstrap : [
|
|
163
|
+
AppComponent
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
export class AppModule {
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
`);
|
|
170
|
+
typescript_1.removeProvider(appTree, filePath, 'LuxStorageService', false);
|
|
171
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
172
|
+
expect(content).toContain('providers : [\n LuxDialogService,\n DatePipe\n ],');
|
|
173
|
+
done();
|
|
174
|
+
});
|
|
175
|
+
it('Sollte den Provider (nicht vorhanden) entfernen', (done) => {
|
|
176
|
+
var _a;
|
|
177
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
178
|
+
appTree.create(filePath, `
|
|
179
|
+
import { environment } from '../environments/environment';
|
|
180
|
+
|
|
181
|
+
@NgModule({
|
|
182
|
+
declarations : [
|
|
183
|
+
AppComponent
|
|
184
|
+
],
|
|
185
|
+
imports : [
|
|
186
|
+
HttpClientModule,
|
|
187
|
+
],
|
|
188
|
+
entryComponents: [
|
|
189
|
+
LuxFilePreviewComponent
|
|
190
|
+
],
|
|
191
|
+
providers : [
|
|
192
|
+
LuxDialogService,
|
|
193
|
+
DatePipe
|
|
194
|
+
],
|
|
195
|
+
bootstrap : [
|
|
196
|
+
AppComponent
|
|
197
|
+
]
|
|
198
|
+
})
|
|
199
|
+
export class AppModule {
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
`);
|
|
203
|
+
typescript_1.removeProvider(appTree, filePath, 'LuxStorageService', false);
|
|
204
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
205
|
+
expect(content).toContain('providers : [\n LuxDialogService,\n DatePipe\n ],');
|
|
206
|
+
done();
|
|
207
|
+
});
|
|
208
|
+
it('Sollte den Provider (Provider-Abschnitt fehlt vollständig) entfernen', (done) => {
|
|
209
|
+
var _a;
|
|
210
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
211
|
+
appTree.create(filePath, `
|
|
212
|
+
import { environment } from '../environments/environment';
|
|
213
|
+
|
|
214
|
+
@NgModule({
|
|
215
|
+
declarations : [
|
|
216
|
+
AppComponent
|
|
217
|
+
],
|
|
218
|
+
imports : [
|
|
219
|
+
HttpClientModule,
|
|
220
|
+
],
|
|
221
|
+
entryComponents: [
|
|
222
|
+
LuxFilePreviewComponent
|
|
223
|
+
],
|
|
224
|
+
bootstrap : [
|
|
225
|
+
AppComponent
|
|
226
|
+
]
|
|
227
|
+
})
|
|
228
|
+
export class AppModule {
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
`);
|
|
232
|
+
typescript_1.removeProvider(appTree, filePath, 'LuxStorageService', false);
|
|
233
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
234
|
+
expect(content).not.toContain('providers');
|
|
235
|
+
done();
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
describe('[Method] removeInterface', () => {
|
|
239
|
+
it('Sollte das Interface (mehrere Interfaces - erstes Interface) entfernen', (done) => {
|
|
240
|
+
var _a;
|
|
241
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
242
|
+
appTree.create(filePath, `
|
|
243
|
+
import { OnInit, OnDestroy, Component } from '@angular/core';
|
|
244
|
+
|
|
245
|
+
@Component({
|
|
246
|
+
selector : 'bp-anbindung-lazy',
|
|
247
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
248
|
+
})
|
|
249
|
+
export class AnbindungLazyComponent implements OnInit, OnDestroy {
|
|
250
|
+
|
|
251
|
+
constructor() {
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
ngOnInit() {
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
`);
|
|
260
|
+
typescript_1.removeInterface(appTree, filePath, 'OnInit', false);
|
|
261
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
262
|
+
expect(content).toContain("export class AnbindungLazyComponent implements OnDestroy {");
|
|
263
|
+
done();
|
|
264
|
+
});
|
|
265
|
+
it('Sollte das Interface (mehrere Interfaces - mittleres Interface) entfernen', (done) => {
|
|
266
|
+
var _a;
|
|
267
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
268
|
+
appTree.create(filePath, `
|
|
269
|
+
import { OnChanges, OnInit, OnDestroy, Component } from '@angular/core';
|
|
270
|
+
|
|
271
|
+
@Component({
|
|
272
|
+
selector : 'bp-anbindung-lazy',
|
|
273
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
274
|
+
})
|
|
275
|
+
export class AnbindungLazyComponent implements OnChanges, OnInit, OnDestroy {
|
|
276
|
+
|
|
277
|
+
constructor() {
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
ngOnInit() {
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
`);
|
|
286
|
+
typescript_1.removeInterface(appTree, filePath, 'OnInit', false);
|
|
287
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
288
|
+
expect(content).toContain("export class AnbindungLazyComponent implements OnChanges, OnDestroy {");
|
|
289
|
+
done();
|
|
290
|
+
});
|
|
291
|
+
it('Sollte das Interface (mehrere Interfaces - mittleres Interface - mit extends) entfernen', (done) => {
|
|
292
|
+
var _a;
|
|
293
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
294
|
+
appTree.create(filePath, `
|
|
295
|
+
import { OnChanges, OnInit, OnDestroy, Component } from '@angular/core';
|
|
296
|
+
|
|
297
|
+
@Component({
|
|
298
|
+
selector : 'bp-anbindung-lazy',
|
|
299
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
300
|
+
})
|
|
301
|
+
export class AnbindungLazyComponent extends Aaa implements OnChanges, OnInit, OnDestroy {
|
|
302
|
+
|
|
303
|
+
constructor() {
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
ngOnInit() {
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
`);
|
|
312
|
+
typescript_1.removeInterface(appTree, filePath, 'OnInit', false);
|
|
313
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
314
|
+
expect(content).toContain("export class AnbindungLazyComponent extends Aaa implements OnChanges, OnDestroy {");
|
|
315
|
+
done();
|
|
316
|
+
});
|
|
317
|
+
it('Sollte das Interface (mehrere Interfaces - letztes Interface) entfernen', (done) => {
|
|
318
|
+
var _a;
|
|
319
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
320
|
+
appTree.create(filePath, `
|
|
321
|
+
import { OnChanges, OnInit, OnDestroy, Component } from '@angular/core';
|
|
322
|
+
|
|
323
|
+
@Component({
|
|
324
|
+
selector : 'bp-anbindung-lazy',
|
|
325
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
326
|
+
})
|
|
327
|
+
export class AnbindungLazyComponent implements OnChanges, OnDestroy, OnInit {
|
|
328
|
+
|
|
329
|
+
constructor() {
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
ngOnInit() {
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
`);
|
|
338
|
+
typescript_1.removeInterface(appTree, filePath, 'OnInit', false);
|
|
339
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
340
|
+
expect(content).toContain("export class AnbindungLazyComponent implements OnChanges, OnDestroy {");
|
|
341
|
+
done();
|
|
342
|
+
});
|
|
343
|
+
it('Sollte das Interface (nicht vorhanden) entfernen', (done) => {
|
|
344
|
+
var _a;
|
|
345
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
346
|
+
appTree.create(filePath, `
|
|
347
|
+
import { OnChanges, OnDestroy, Component } from '@angular/core';
|
|
348
|
+
|
|
349
|
+
@Component({
|
|
350
|
+
selector : 'bp-anbindung-lazy',
|
|
351
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
352
|
+
})
|
|
353
|
+
export class AnbindungLazyComponent {
|
|
354
|
+
|
|
355
|
+
constructor() {
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
ngOnInit() {
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
`);
|
|
364
|
+
typescript_1.removeInterface(appTree, filePath, 'OnInit', false);
|
|
365
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
366
|
+
expect(content).toContain("export class AnbindungLazyComponent {");
|
|
367
|
+
done();
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
describe('[Method] addInterface', () => {
|
|
371
|
+
it('Sollte das Interface (mit extends - ohne Interface) hinzufügen', (done) => {
|
|
372
|
+
var _a;
|
|
373
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
374
|
+
appTree.create(filePath, `
|
|
375
|
+
@Component({
|
|
376
|
+
selector : 'bp-anbindung-lazy',
|
|
377
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
378
|
+
})
|
|
379
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
380
|
+
|
|
381
|
+
constructor() {
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
ngOnInit() {
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
`);
|
|
390
|
+
typescript_1.addInterface(appTree, filePath, 'OnChanges', false);
|
|
391
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
392
|
+
expect(content).toContain('export class AnbindungLazyComponent extends Aaa implements OnChanges {');
|
|
393
|
+
done();
|
|
394
|
+
});
|
|
395
|
+
it('Sollte das Interface (mit extends - mit Interface) hinzufügen', (done) => {
|
|
396
|
+
var _a;
|
|
397
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
398
|
+
appTree.create(filePath, `
|
|
399
|
+
@Component({
|
|
400
|
+
selector : 'bp-anbindung-lazy',
|
|
401
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
402
|
+
})
|
|
403
|
+
export class AnbindungLazyComponent extends Aaa implements Bbb {
|
|
404
|
+
|
|
405
|
+
constructor() {
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
ngOnInit() {
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
`);
|
|
414
|
+
typescript_1.addInterface(appTree, filePath, 'OnChanges', false);
|
|
415
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
416
|
+
expect(content).toContain('export class AnbindungLazyComponent extends Aaa implements Bbb, OnChanges {');
|
|
417
|
+
done();
|
|
418
|
+
});
|
|
419
|
+
it('Sollte das Interface (ohne extends - ohne Interface) hinzufügen', (done) => {
|
|
420
|
+
var _a;
|
|
421
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
422
|
+
appTree.create(filePath, `
|
|
423
|
+
@Component({
|
|
424
|
+
selector : 'bp-anbindung-lazy',
|
|
425
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
426
|
+
})
|
|
427
|
+
export class AnbindungLazyComponent {
|
|
428
|
+
|
|
429
|
+
constructor() {
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
ngOnInit() {
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
`);
|
|
438
|
+
typescript_1.addInterface(appTree, filePath, 'OnChanges', false);
|
|
439
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
440
|
+
expect(content).toContain('export class AnbindungLazyComponent implements OnChanges {');
|
|
441
|
+
done();
|
|
442
|
+
});
|
|
443
|
+
it('Sollte das Interface (ohne extends - mit Interface) hinzufügen', (done) => {
|
|
444
|
+
var _a;
|
|
445
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
446
|
+
appTree.create(filePath, `
|
|
447
|
+
@Component({
|
|
448
|
+
selector : 'bp-anbindung-lazy',
|
|
449
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
450
|
+
})
|
|
451
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
452
|
+
|
|
453
|
+
constructor() {
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
ngOnInit() {
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
`);
|
|
462
|
+
typescript_1.addInterface(appTree, filePath, 'OnChanges', false);
|
|
463
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
464
|
+
expect(content).toContain('export class AnbindungLazyComponent implements OnInit, OnChanges {');
|
|
465
|
+
done();
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
describe('[Method] addImport', () => {
|
|
469
|
+
it('Sollte den Import (kein Import vorhanden) hinzufügen', (done) => {
|
|
470
|
+
var _a;
|
|
471
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
472
|
+
appTree.create(filePath, `
|
|
473
|
+
@Component({
|
|
474
|
+
selector : 'bp-anbindung-lazy',
|
|
475
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
476
|
+
})
|
|
477
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
478
|
+
|
|
479
|
+
constructor() {
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
ngOnInit() {
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
`);
|
|
488
|
+
typescript_1.addImport(appTree, filePath, '@angular/core', 'OnChanges', false);
|
|
489
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
490
|
+
expect(content).toContain("import { OnChanges } from '@angular/core';");
|
|
491
|
+
done();
|
|
492
|
+
});
|
|
493
|
+
it('Sollte den Import (bereits vorhanden) hinzufügen', (done) => {
|
|
494
|
+
var _a;
|
|
495
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
496
|
+
appTree.create(filePath, `
|
|
497
|
+
import { OnChanges, OnDestroy, Component } from '@angular/core';
|
|
498
|
+
|
|
499
|
+
@Component({
|
|
500
|
+
selector : 'bp-anbindung-lazy',
|
|
501
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
502
|
+
})
|
|
503
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
504
|
+
|
|
505
|
+
constructor() {
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
ngOnInit() {
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
`);
|
|
514
|
+
typescript_1.addImport(appTree, filePath, '@angular/core', 'OnChanges', false);
|
|
515
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
516
|
+
expect(content).toContain("import { OnChanges, OnDestroy, Component } from '@angular/core';");
|
|
517
|
+
done();
|
|
518
|
+
});
|
|
519
|
+
it('Sollte den Import (ein Import) hinzufügen', (done) => {
|
|
520
|
+
var _a;
|
|
521
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
522
|
+
appTree.create(filePath, `
|
|
523
|
+
import { OnInit } from '@angular/core';
|
|
524
|
+
|
|
525
|
+
@Component({
|
|
526
|
+
selector : 'bp-anbindung-lazy',
|
|
527
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
528
|
+
})
|
|
529
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
530
|
+
|
|
531
|
+
constructor() {
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
ngOnInit() {
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
`);
|
|
540
|
+
typescript_1.addImport(appTree, filePath, '@angular/core', 'OnChanges', false);
|
|
541
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
542
|
+
expect(content).toContain("import { OnInit, OnChanges } from '@angular/core';");
|
|
543
|
+
done();
|
|
544
|
+
});
|
|
545
|
+
it('Sollte den Import (mehrere Imports - einfache Anführungszeichen) hinzufügen', (done) => {
|
|
546
|
+
var _a;
|
|
547
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
548
|
+
appTree.create(filePath, `
|
|
549
|
+
import { OnInit, Component } from '@angular/core';
|
|
550
|
+
|
|
551
|
+
@Component({
|
|
552
|
+
selector : 'bp-anbindung-lazy',
|
|
553
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
554
|
+
})
|
|
555
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
556
|
+
|
|
557
|
+
constructor() {
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
ngOnInit() {
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
`);
|
|
566
|
+
typescript_1.addImport(appTree, filePath, '@angular/core', 'OnChanges', false);
|
|
567
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
568
|
+
expect(content).toContain("import { OnInit, Component, OnChanges } from '@angular/core';");
|
|
569
|
+
done();
|
|
570
|
+
});
|
|
571
|
+
it('Sollte den Import (mehrere Imports - doppelte Anführungszeichen) hinzufügen', (done) => {
|
|
572
|
+
var _a;
|
|
573
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
574
|
+
appTree.create(filePath, `
|
|
575
|
+
import { OnInit, Component } from "@angular/core";
|
|
576
|
+
|
|
577
|
+
@Component({
|
|
578
|
+
selector : 'bp-anbindung-lazy',
|
|
579
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
580
|
+
})
|
|
581
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
582
|
+
|
|
583
|
+
constructor() {
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
ngOnInit() {
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
`);
|
|
592
|
+
typescript_1.addImport(appTree, filePath, '@angular/core', 'OnChanges', false);
|
|
593
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
594
|
+
expect(content).toContain(`import { OnInit, Component, OnChanges } from "@angular/core";`);
|
|
595
|
+
done();
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
describe('[Method] removeImport', () => {
|
|
599
|
+
it('Sollte den Import (mehrere Imports - erster Import) entfernen', (done) => {
|
|
600
|
+
var _a;
|
|
601
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
602
|
+
appTree.create(filePath, `
|
|
603
|
+
import { OnInit, Component } from '@angular/core';
|
|
604
|
+
|
|
605
|
+
@Component({
|
|
606
|
+
selector : 'bp-anbindung-lazy',
|
|
607
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
608
|
+
})
|
|
609
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
610
|
+
|
|
611
|
+
constructor() {
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
ngOnInit() {
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
`);
|
|
620
|
+
typescript_1.removeImport(appTree, filePath, '@angular/core', 'OnInit', false);
|
|
621
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
622
|
+
expect(content).toContain("import { Component } from '@angular/core';");
|
|
623
|
+
done();
|
|
624
|
+
});
|
|
625
|
+
it('Sollte den Import (mehrere Imports - erster Import - doppelte Anführungszeichen) entfernen', (done) => {
|
|
626
|
+
var _a;
|
|
627
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
628
|
+
appTree.create(filePath, `
|
|
629
|
+
import { OnInit, Component } from "@angular/core";
|
|
630
|
+
|
|
631
|
+
@Component({
|
|
632
|
+
selector : 'bp-anbindung-lazy',
|
|
633
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
634
|
+
})
|
|
635
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
636
|
+
|
|
637
|
+
constructor() {
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
ngOnInit() {
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
`);
|
|
646
|
+
typescript_1.removeImport(appTree, filePath, '@angular/core', 'OnInit', false);
|
|
647
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
648
|
+
expect(content).toContain(`import { Component } from "@angular/core";`);
|
|
649
|
+
done();
|
|
650
|
+
});
|
|
651
|
+
it('Sollte den Import (mehrere Imports - mittlerer Import) entfernen', (done) => {
|
|
652
|
+
var _a;
|
|
653
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
654
|
+
appTree.create(filePath, `
|
|
655
|
+
import { OnDestroy, OnInit, Component } from '@angular/core';
|
|
656
|
+
|
|
657
|
+
@Component({
|
|
658
|
+
selector : 'bp-anbindung-lazy',
|
|
659
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
660
|
+
})
|
|
661
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
662
|
+
|
|
663
|
+
constructor() {
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
ngOnInit() {
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
`);
|
|
672
|
+
typescript_1.removeImport(appTree, filePath, '@angular/core', 'OnInit', false);
|
|
673
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
674
|
+
expect(content).toContain("import { OnDestroy, Component } from '@angular/core';");
|
|
675
|
+
done();
|
|
676
|
+
});
|
|
677
|
+
it('Sollte den Import (mehrere Imports - mittlerer Import - ohne Leerzeichen) entfernen', (done) => {
|
|
678
|
+
var _a;
|
|
679
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
680
|
+
appTree.create(filePath, `
|
|
681
|
+
import { OnDestroy,OnInit,Component } from '@angular/core';
|
|
682
|
+
|
|
683
|
+
@Component({
|
|
684
|
+
selector : 'bp-anbindung-lazy',
|
|
685
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
686
|
+
})
|
|
687
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
688
|
+
|
|
689
|
+
constructor() {
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
ngOnInit() {
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
`);
|
|
698
|
+
typescript_1.removeImport(appTree, filePath, '@angular/core', 'OnInit', false);
|
|
699
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
700
|
+
expect(content).toContain("import { OnDestroy,Component } from '@angular/core';");
|
|
701
|
+
done();
|
|
702
|
+
});
|
|
703
|
+
it('Sollte den Import (mehrere Imports - letzter Import) entfernen', (done) => {
|
|
704
|
+
var _a;
|
|
705
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
706
|
+
appTree.create(filePath, `
|
|
707
|
+
import { Component, OnInit } from '@angular/core';
|
|
708
|
+
|
|
709
|
+
@Component({
|
|
710
|
+
selector : 'bp-anbindung-lazy',
|
|
711
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
712
|
+
})
|
|
713
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
714
|
+
|
|
715
|
+
constructor() {
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
ngOnInit() {
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
`);
|
|
724
|
+
typescript_1.removeImport(appTree, filePath, '@angular/core', 'OnInit', false);
|
|
725
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
726
|
+
expect(content).toContain("import { Component } from '@angular/core';");
|
|
727
|
+
done();
|
|
728
|
+
});
|
|
729
|
+
it('Sollte den Import (nur Paketname) entfernen', (done) => {
|
|
730
|
+
var _a;
|
|
731
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
732
|
+
appTree.create(filePath, `
|
|
733
|
+
import '@angular/common/locales/global/de';
|
|
734
|
+
|
|
735
|
+
@Component({
|
|
736
|
+
selector : 'bp-anbindung-lazy',
|
|
737
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
738
|
+
})
|
|
739
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
740
|
+
|
|
741
|
+
constructor() {
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
ngOnInit() {
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
`);
|
|
750
|
+
typescript_1.removeImport(appTree, filePath, '@angular/common/locales/global/de', undefined, false);
|
|
751
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
752
|
+
expect(content).not.toContain("import");
|
|
753
|
+
done();
|
|
754
|
+
});
|
|
755
|
+
it('Sollte den Import (nur Paketname - nicht vorhanden) entfernen', (done) => {
|
|
756
|
+
var _a;
|
|
757
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
758
|
+
appTree.create(filePath, `
|
|
759
|
+
import '@angular/common/locales/global/de';
|
|
760
|
+
|
|
761
|
+
@Component({
|
|
762
|
+
selector : 'bp-anbindung-lazy',
|
|
763
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
764
|
+
})
|
|
765
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
766
|
+
|
|
767
|
+
constructor() {
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
ngOnInit() {
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
`);
|
|
776
|
+
typescript_1.removeImport(appTree, filePath, 'nichtDaAaa', undefined, false);
|
|
777
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
778
|
+
expect(content).toContain("import '@angular/common/locales/global/de';");
|
|
779
|
+
done();
|
|
780
|
+
});
|
|
781
|
+
it('Sollte den Import (nicht vorhanden) entfernen', (done) => {
|
|
782
|
+
var _a;
|
|
783
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
784
|
+
appTree.create(filePath, `
|
|
785
|
+
import { Component } from '@angular/core';
|
|
786
|
+
|
|
787
|
+
@Component({
|
|
788
|
+
selector : 'bp-anbindung-lazy',
|
|
789
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
790
|
+
})
|
|
791
|
+
export class AnbindungLazyComponent implements OnInit {
|
|
792
|
+
|
|
793
|
+
constructor() {
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
ngOnInit() {
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
`);
|
|
802
|
+
typescript_1.removeImport(appTree, filePath, '@angular/core', 'OnInit', false);
|
|
803
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
804
|
+
expect(content).toContain("import { Component } from '@angular/core';");
|
|
805
|
+
done();
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
describe('[Method] addConstructorContent', () => {
|
|
809
|
+
it('Sollte Inhalt im Konstruktor (mit Konstruktor - append=false) hinzufügen', (done) => {
|
|
810
|
+
var _a;
|
|
811
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
812
|
+
appTree.create(filePath, `
|
|
813
|
+
@Component({
|
|
814
|
+
selector : 'bp-anbindung-lazy',
|
|
815
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
816
|
+
})
|
|
817
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
818
|
+
|
|
819
|
+
constructor() {
|
|
820
|
+
console.log();
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
ngOnInit() {
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
`);
|
|
829
|
+
typescript_1.addConstructorContent(appTree, filePath, 'router.initialNavigation();', false);
|
|
830
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
831
|
+
expect(content).toContain('constructor() {\n router.initialNavigation();\n console.log();\n }');
|
|
832
|
+
done();
|
|
833
|
+
});
|
|
834
|
+
it('Sollte Inhalt im Konstruktor (mit Konstruktor - append=true) hinzufügen', (done) => {
|
|
835
|
+
var _a;
|
|
836
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
837
|
+
appTree.create(filePath, `
|
|
838
|
+
@Component({
|
|
839
|
+
selector : 'bp-anbindung-lazy',
|
|
840
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
841
|
+
})
|
|
842
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
843
|
+
|
|
844
|
+
constructor() {
|
|
845
|
+
console.log();
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
ngOnInit() {
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
`);
|
|
854
|
+
typescript_1.addConstructorContent(appTree, filePath, 'router.initialNavigation();', true);
|
|
855
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
856
|
+
expect(content).toContain('constructor() {\n console.log();\n router.initialNavigation();\n }');
|
|
857
|
+
done();
|
|
858
|
+
});
|
|
859
|
+
it('Sollte Inhalt im Konstruktor (mit leerem Konstruktor - append=false) hinzufügen', (done) => {
|
|
860
|
+
var _a;
|
|
861
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
862
|
+
appTree.create(filePath, `
|
|
863
|
+
@Component({
|
|
864
|
+
selector : 'bp-anbindung-lazy',
|
|
865
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
866
|
+
})
|
|
867
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
868
|
+
|
|
869
|
+
constructor() {}
|
|
870
|
+
|
|
871
|
+
ngOnInit() {
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
`);
|
|
877
|
+
typescript_1.addConstructorContent(appTree, filePath, 'router.initialNavigation();', false);
|
|
878
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
879
|
+
expect(content).toContain('constructor() {\n router.initialNavigation();\n }');
|
|
880
|
+
done();
|
|
881
|
+
});
|
|
882
|
+
it('Sollte Inhalt im Konstruktor (mit leerem Konstruktor - append=true) hinzufügen', (done) => {
|
|
883
|
+
var _a;
|
|
884
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
885
|
+
appTree.create(filePath, `
|
|
886
|
+
@Component({
|
|
887
|
+
selector : 'bp-anbindung-lazy',
|
|
888
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
889
|
+
})
|
|
890
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
891
|
+
|
|
892
|
+
constructor() {}
|
|
893
|
+
|
|
894
|
+
ngOnInit() {
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
`);
|
|
900
|
+
typescript_1.addConstructorContent(appTree, filePath, 'router.initialNavigation();', true);
|
|
901
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
902
|
+
expect(content).toContain('constructor() {\n router.initialNavigation();\n }');
|
|
903
|
+
done();
|
|
904
|
+
});
|
|
905
|
+
it('Sollte Inhalt im Konstruktor (ohne Konstruktor - append=false) hinzufügen', (done) => {
|
|
906
|
+
var _a;
|
|
907
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
908
|
+
appTree.create(filePath, `
|
|
909
|
+
@Component({
|
|
910
|
+
selector : 'bp-anbindung-lazy',
|
|
911
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
912
|
+
})
|
|
913
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
914
|
+
|
|
915
|
+
ngOnInit() {
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
`);
|
|
921
|
+
typescript_1.addConstructorContent(appTree, filePath, 'router.initialNavigation();', false);
|
|
922
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
923
|
+
expect(content).toContain('constructor() {\n router.initialNavigation();\n }');
|
|
924
|
+
done();
|
|
925
|
+
});
|
|
926
|
+
it('Sollte Inhalt im Konstruktor (ohne Konstruktor - append=true) hinzufügen', (done) => {
|
|
927
|
+
var _a;
|
|
928
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
929
|
+
appTree.create(filePath, `
|
|
930
|
+
@Component({
|
|
931
|
+
selector : 'bp-anbindung-lazy',
|
|
932
|
+
templateUrl: './anbindung-lazy.component.html'
|
|
933
|
+
})
|
|
934
|
+
export class AnbindungLazyComponent extends Aaa {
|
|
935
|
+
|
|
936
|
+
ngOnInit() {
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
`);
|
|
942
|
+
typescript_1.addConstructorContent(appTree, filePath, 'router.initialNavigation();', true);
|
|
943
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
944
|
+
expect(content).toContain('constructor() {\n router.initialNavigation();\n }');
|
|
945
|
+
done();
|
|
946
|
+
});
|
|
947
|
+
});
|
|
948
|
+
describe('[Method] addClassProperty', () => {
|
|
949
|
+
it('Sollte eine Property (mit Properties) hinzufügen', (done) => {
|
|
950
|
+
var _a;
|
|
951
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
952
|
+
appTree.create(filePath, `
|
|
953
|
+
@Component({
|
|
954
|
+
selector : 'app-root',
|
|
955
|
+
templateUrl: './app.component.html',
|
|
956
|
+
styleUrls : [ './app.component.scss' ]
|
|
957
|
+
})
|
|
958
|
+
export class AppComponent implements OnInit {
|
|
959
|
+
|
|
960
|
+
luxVersion = '';
|
|
961
|
+
isMaintenanceOrUnauthorized = false;
|
|
962
|
+
|
|
963
|
+
constructor(private readonly fachService: AccountFacadeService,
|
|
964
|
+
public router: Router, public window: Window,
|
|
965
|
+
private appService: LuxAppService) {
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
ngOnInit(): void {
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
}
|
|
972
|
+
`);
|
|
973
|
+
typescript_1.addClassProperty(appTree, filePath, '@Input() luxAppHeader: \'normal\' | \'minimal\' | \'none\' = \'normal\';');
|
|
974
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
975
|
+
expect(content).toContain(' @Input() luxAppHeader: \'normal\' | \'minimal\' | \'none\' = \'normal\';');
|
|
976
|
+
done();
|
|
977
|
+
});
|
|
978
|
+
it('Sollte eine Property (ohne Properties) hinzufügen', (done) => {
|
|
979
|
+
var _a;
|
|
980
|
+
const filePath = testOptions.path + '/src/app/test.component.ts';
|
|
981
|
+
appTree.create(filePath, `
|
|
982
|
+
@Component({
|
|
983
|
+
selector : 'app-root',
|
|
984
|
+
templateUrl: './app.component.html',
|
|
985
|
+
styleUrls : [ './app.component.scss' ]
|
|
986
|
+
})
|
|
987
|
+
export class AppComponent implements OnInit {
|
|
988
|
+
|
|
989
|
+
constructor(private readonly fachService: AccountFacadeService,
|
|
990
|
+
public router: Router, public window: Window,
|
|
991
|
+
private appService: LuxAppService) {
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
ngOnInit(): void {
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
}
|
|
998
|
+
`);
|
|
999
|
+
typescript_1.addClassProperty(appTree, filePath, '@Input() luxAppHeader: \'normal\' | \'minimal\' | \'none\' = \'normal\';');
|
|
1000
|
+
const content = (_a = appTree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
1001
|
+
expect(content).toContain(' @Input() luxAppHeader: \'normal\' | \'minimal\' | \'none\' = \'normal\';');
|
|
1002
|
+
done();
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
//# sourceMappingURL=typescript_spec.js.map
|