@storybook/angular 8.0.0-alpha.8 → 8.0.0-beta.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/dist/builders/build-storybook/index.d.ts +2 -2
- package/dist/builders/build-storybook/index.js +5 -4
- package/dist/builders/build-storybook/index.spec.js +8 -10
- package/dist/builders/start-storybook/index.js +3 -4
- package/dist/builders/start-storybook/index.spec.js +2 -4
- package/dist/builders/utils/run-compodoc.js +2 -2
- package/dist/builders/utils/run-compodoc.spec.js +1 -1
- package/dist/client/angular-beta/AbstractRenderer.d.ts +0 -6
- package/dist/client/angular-beta/AbstractRenderer.js +11 -59
- package/dist/client/angular-beta/CanvasRenderer.d.ts +0 -1
- package/dist/client/angular-beta/CanvasRenderer.js +0 -3
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +65 -66
- package/dist/client/angular-beta/DocsRenderer.d.ts +0 -1
- package/dist/client/angular-beta/DocsRenderer.js +0 -3
- package/dist/client/angular-beta/RendererFactory.test.js +33 -2
- package/dist/client/angular-beta/StorybookModule.test.js +36 -35
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +0 -1
- package/dist/client/angular-beta/StorybookWrapperComponent.js +11 -22
- package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +14 -0
- package/dist/client/angular-beta/utils/BootstrapQueue.js +81 -0
- package/dist/client/angular-beta/utils/BootstrapQueue.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/BootstrapQueue.test.js +162 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +66 -65
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +8 -7
- package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -1
- package/dist/client/angular-beta/utils/PropertyExtractor.test.js +0 -2
- package/dist/client/argsToTemplate.test.js +20 -19
- package/dist/client/decorateStory.test.js +28 -27
- package/dist/client/docs/__testfixtures__/doc-button/input.js +2 -3
- package/dist/client/docs/angular-properties.test.js +4 -26
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +0 -3
- package/dist/client/public-types.d.ts +1 -11
- package/dist/preset.d.ts +2 -3
- package/dist/preset.js +0 -1
- package/dist/preset.mjs +0 -1
- package/dist/server/angular-cli-webpack.js +0 -1
- package/dist/server/framework-preset-angular-ivy.js +0 -1
- package/package.json +12 -14
- package/dist/client/public-api.d.ts +0 -1
- package/dist/client/public-api.js +0 -17
|
@@ -12,26 +12,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const core_1 = require("@angular/core");
|
|
13
13
|
const testing_1 = require("@angular/core/testing");
|
|
14
14
|
const testing_2 = require("@angular/platform-browser-dynamic/testing");
|
|
15
|
+
const vitest_1 = require("vitest");
|
|
15
16
|
const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
|
|
16
|
-
describe('getComponentInputsOutputs', () => {
|
|
17
|
-
it('should return empty if no I/O found', () => {
|
|
17
|
+
(0, vitest_1.describe)('getComponentInputsOutputs', () => {
|
|
18
|
+
(0, vitest_1.it)('should return empty if no I/O found', () => {
|
|
18
19
|
let FooComponent = class FooComponent {
|
|
19
20
|
};
|
|
20
21
|
FooComponent = __decorate([
|
|
21
22
|
(0, core_1.Component)({})
|
|
22
23
|
], FooComponent);
|
|
23
|
-
expect((0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent)).toEqual({
|
|
24
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent)).toEqual({
|
|
24
25
|
inputs: [],
|
|
25
26
|
outputs: [],
|
|
26
27
|
});
|
|
27
28
|
class BarComponent {
|
|
28
29
|
}
|
|
29
|
-
expect((0, NgComponentAnalyzer_1.getComponentInputsOutputs)(BarComponent)).toEqual({
|
|
30
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentInputsOutputs)(BarComponent)).toEqual({
|
|
30
31
|
inputs: [],
|
|
31
32
|
outputs: [],
|
|
32
33
|
});
|
|
33
34
|
});
|
|
34
|
-
it('should return I/O', () => {
|
|
35
|
+
(0, vitest_1.it)('should return I/O', () => {
|
|
35
36
|
let FooComponent = class FooComponent {
|
|
36
37
|
constructor() {
|
|
37
38
|
this.output = new core_1.EventEmitter();
|
|
@@ -63,7 +64,7 @@ describe('getComponentInputsOutputs', () => {
|
|
|
63
64
|
], FooComponent);
|
|
64
65
|
const fooComponentFactory = resolveComponentFactory(FooComponent);
|
|
65
66
|
const { inputs, outputs } = (0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent);
|
|
66
|
-
expect({ inputs, outputs }).toEqual({
|
|
67
|
+
(0, vitest_1.expect)({ inputs, outputs }).toEqual({
|
|
67
68
|
inputs: [
|
|
68
69
|
{ propName: 'inputInComponentMetadata', templateName: 'inputInComponentMetadata' },
|
|
69
70
|
{ propName: 'input', templateName: 'input' },
|
|
@@ -75,10 +76,10 @@ describe('getComponentInputsOutputs', () => {
|
|
|
75
76
|
{ propName: 'outputWithBindingPropertyName', templateName: 'outputPropertyName' },
|
|
76
77
|
],
|
|
77
78
|
});
|
|
78
|
-
expect(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
79
|
-
expect(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
79
|
+
(0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
80
|
+
(0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
80
81
|
});
|
|
81
|
-
it("should return I/O when some of component metadata has the same name as one of component's properties", () => {
|
|
82
|
+
(0, vitest_1.it)("should return I/O when some of component metadata has the same name as one of component's properties", () => {
|
|
82
83
|
let FooComponent = class FooComponent {
|
|
83
84
|
constructor() {
|
|
84
85
|
this.output = new core_1.EventEmitter();
|
|
@@ -110,10 +111,10 @@ describe('getComponentInputsOutputs', () => {
|
|
|
110
111
|
], FooComponent);
|
|
111
112
|
const fooComponentFactory = resolveComponentFactory(FooComponent);
|
|
112
113
|
const { inputs, outputs } = (0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent);
|
|
113
|
-
expect(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
114
|
-
expect(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
114
|
+
(0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
115
|
+
(0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
115
116
|
});
|
|
116
|
-
it('should return I/O in the presence of multiple decorators', () => {
|
|
117
|
+
(0, vitest_1.it)('should return I/O in the presence of multiple decorators', () => {
|
|
117
118
|
let FooComponent = class FooComponent {
|
|
118
119
|
};
|
|
119
120
|
__decorate([
|
|
@@ -133,17 +134,17 @@ describe('getComponentInputsOutputs', () => {
|
|
|
133
134
|
], FooComponent);
|
|
134
135
|
const fooComponentFactory = resolveComponentFactory(FooComponent);
|
|
135
136
|
const { inputs, outputs } = (0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent);
|
|
136
|
-
expect({ inputs, outputs }).toEqual({
|
|
137
|
+
(0, vitest_1.expect)({ inputs, outputs }).toEqual({
|
|
137
138
|
inputs: [
|
|
138
139
|
{ propName: 'inputPreceedingHostBinding', templateName: 'inputPreceedingHostBinding' },
|
|
139
140
|
{ propName: 'inputFollowingHostBinding', templateName: 'inputFollowingHostBinding' },
|
|
140
141
|
],
|
|
141
142
|
outputs: [],
|
|
142
143
|
});
|
|
143
|
-
expect(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
144
|
-
expect(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
144
|
+
(0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
145
|
+
(0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
145
146
|
});
|
|
146
|
-
it('should return I/O with extending classes', () => {
|
|
147
|
+
(0, vitest_1.it)('should return I/O with extending classes', () => {
|
|
147
148
|
let BarComponent = class BarComponent {
|
|
148
149
|
};
|
|
149
150
|
__decorate([
|
|
@@ -176,7 +177,7 @@ describe('getComponentInputsOutputs', () => {
|
|
|
176
177
|
], FooComponent);
|
|
177
178
|
const fooComponentFactory = resolveComponentFactory(FooComponent);
|
|
178
179
|
const { inputs, outputs } = (0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent);
|
|
179
|
-
expect({ inputs, outputs }).toEqual({
|
|
180
|
+
(0, vitest_1.expect)({ inputs, outputs }).toEqual({
|
|
180
181
|
inputs: [
|
|
181
182
|
{ propName: 'a', templateName: 'a' },
|
|
182
183
|
{ propName: 'b', templateName: 'b' },
|
|
@@ -184,143 +185,143 @@ describe('getComponentInputsOutputs', () => {
|
|
|
184
185
|
],
|
|
185
186
|
outputs: [],
|
|
186
187
|
});
|
|
187
|
-
expect(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
188
|
-
expect(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
188
|
+
(0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
|
|
189
|
+
(0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
|
|
189
190
|
});
|
|
190
191
|
});
|
|
191
|
-
describe('isDeclarable', () => {
|
|
192
|
-
it('should return true with a Component', () => {
|
|
192
|
+
(0, vitest_1.describe)('isDeclarable', () => {
|
|
193
|
+
(0, vitest_1.it)('should return true with a Component', () => {
|
|
193
194
|
let FooComponent = class FooComponent {
|
|
194
195
|
};
|
|
195
196
|
FooComponent = __decorate([
|
|
196
197
|
(0, core_1.Component)({})
|
|
197
198
|
], FooComponent);
|
|
198
|
-
expect((0, NgComponentAnalyzer_1.isDeclarable)(FooComponent)).toEqual(true);
|
|
199
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isDeclarable)(FooComponent)).toEqual(true);
|
|
199
200
|
});
|
|
200
|
-
it('should return true with a Directive', () => {
|
|
201
|
+
(0, vitest_1.it)('should return true with a Directive', () => {
|
|
201
202
|
let FooDirective = class FooDirective {
|
|
202
203
|
};
|
|
203
204
|
FooDirective = __decorate([
|
|
204
205
|
(0, core_1.Directive)({})
|
|
205
206
|
], FooDirective);
|
|
206
|
-
expect((0, NgComponentAnalyzer_1.isDeclarable)(FooDirective)).toEqual(true);
|
|
207
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isDeclarable)(FooDirective)).toEqual(true);
|
|
207
208
|
});
|
|
208
|
-
it('should return true with a Pipe', () => {
|
|
209
|
+
(0, vitest_1.it)('should return true with a Pipe', () => {
|
|
209
210
|
let FooPipe = class FooPipe {
|
|
210
211
|
};
|
|
211
212
|
FooPipe = __decorate([
|
|
212
213
|
(0, core_1.Pipe)({ name: 'pipe' })
|
|
213
214
|
], FooPipe);
|
|
214
|
-
expect((0, NgComponentAnalyzer_1.isDeclarable)(FooPipe)).toEqual(true);
|
|
215
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isDeclarable)(FooPipe)).toEqual(true);
|
|
215
216
|
});
|
|
216
|
-
it('should return false with simple class', () => {
|
|
217
|
+
(0, vitest_1.it)('should return false with simple class', () => {
|
|
217
218
|
class FooPipe {
|
|
218
219
|
}
|
|
219
|
-
expect((0, NgComponentAnalyzer_1.isDeclarable)(FooPipe)).toEqual(false);
|
|
220
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isDeclarable)(FooPipe)).toEqual(false);
|
|
220
221
|
});
|
|
221
|
-
it('should return false with Injectable', () => {
|
|
222
|
+
(0, vitest_1.it)('should return false with Injectable', () => {
|
|
222
223
|
let FooInjectable = class FooInjectable {
|
|
223
224
|
};
|
|
224
225
|
FooInjectable = __decorate([
|
|
225
226
|
(0, core_1.Injectable)()
|
|
226
227
|
], FooInjectable);
|
|
227
|
-
expect((0, NgComponentAnalyzer_1.isDeclarable)(FooInjectable)).toEqual(false);
|
|
228
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isDeclarable)(FooInjectable)).toEqual(false);
|
|
228
229
|
});
|
|
229
230
|
});
|
|
230
|
-
describe('isComponent', () => {
|
|
231
|
-
it('should return true with a Component', () => {
|
|
231
|
+
(0, vitest_1.describe)('isComponent', () => {
|
|
232
|
+
(0, vitest_1.it)('should return true with a Component', () => {
|
|
232
233
|
let FooComponent = class FooComponent {
|
|
233
234
|
};
|
|
234
235
|
FooComponent = __decorate([
|
|
235
236
|
(0, core_1.Component)({})
|
|
236
237
|
], FooComponent);
|
|
237
|
-
expect((0, NgComponentAnalyzer_1.isComponent)(FooComponent)).toEqual(true);
|
|
238
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isComponent)(FooComponent)).toEqual(true);
|
|
238
239
|
});
|
|
239
|
-
it('should return false with simple class', () => {
|
|
240
|
+
(0, vitest_1.it)('should return false with simple class', () => {
|
|
240
241
|
class FooPipe {
|
|
241
242
|
}
|
|
242
|
-
expect((0, NgComponentAnalyzer_1.isComponent)(FooPipe)).toEqual(false);
|
|
243
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isComponent)(FooPipe)).toEqual(false);
|
|
243
244
|
});
|
|
244
|
-
it('should return false with Directive', () => {
|
|
245
|
+
(0, vitest_1.it)('should return false with Directive', () => {
|
|
245
246
|
let FooDirective = class FooDirective {
|
|
246
247
|
};
|
|
247
248
|
FooDirective = __decorate([
|
|
248
249
|
(0, core_1.Directive)()
|
|
249
250
|
], FooDirective);
|
|
250
|
-
expect((0, NgComponentAnalyzer_1.isComponent)(FooDirective)).toEqual(false);
|
|
251
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isComponent)(FooDirective)).toEqual(false);
|
|
251
252
|
});
|
|
252
253
|
});
|
|
253
|
-
describe('isStandaloneComponent', () => {
|
|
254
|
-
it('should return true with a Component with "standalone: true"', () => {
|
|
254
|
+
(0, vitest_1.describe)('isStandaloneComponent', () => {
|
|
255
|
+
(0, vitest_1.it)('should return true with a Component with "standalone: true"', () => {
|
|
255
256
|
let FooComponent = class FooComponent {
|
|
256
257
|
};
|
|
257
258
|
FooComponent = __decorate([
|
|
258
259
|
(0, core_1.Component)({ standalone: true })
|
|
259
260
|
], FooComponent);
|
|
260
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooComponent)).toEqual(true);
|
|
261
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooComponent)).toEqual(true);
|
|
261
262
|
});
|
|
262
|
-
it('should return false with a Component with "standalone: false"', () => {
|
|
263
|
+
(0, vitest_1.it)('should return false with a Component with "standalone: false"', () => {
|
|
263
264
|
let FooComponent = class FooComponent {
|
|
264
265
|
};
|
|
265
266
|
FooComponent = __decorate([
|
|
266
267
|
(0, core_1.Component)({ standalone: false })
|
|
267
268
|
], FooComponent);
|
|
268
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooComponent)).toEqual(false);
|
|
269
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooComponent)).toEqual(false);
|
|
269
270
|
});
|
|
270
|
-
it('should return false with a Component without the "standalone" property', () => {
|
|
271
|
+
(0, vitest_1.it)('should return false with a Component without the "standalone" property', () => {
|
|
271
272
|
let FooComponent = class FooComponent {
|
|
272
273
|
};
|
|
273
274
|
FooComponent = __decorate([
|
|
274
275
|
(0, core_1.Component)({})
|
|
275
276
|
], FooComponent);
|
|
276
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooComponent)).toEqual(false);
|
|
277
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooComponent)).toEqual(false);
|
|
277
278
|
});
|
|
278
|
-
it('should return false with simple class', () => {
|
|
279
|
+
(0, vitest_1.it)('should return false with simple class', () => {
|
|
279
280
|
class FooPipe {
|
|
280
281
|
}
|
|
281
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(false);
|
|
282
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(false);
|
|
282
283
|
});
|
|
283
|
-
it('should return true with a Directive with "standalone: true"', () => {
|
|
284
|
+
(0, vitest_1.it)('should return true with a Directive with "standalone: true"', () => {
|
|
284
285
|
let FooDirective = class FooDirective {
|
|
285
286
|
};
|
|
286
287
|
FooDirective = __decorate([
|
|
287
288
|
(0, core_1.Directive)({ standalone: true })
|
|
288
289
|
], FooDirective);
|
|
289
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooDirective)).toEqual(true);
|
|
290
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooDirective)).toEqual(true);
|
|
290
291
|
});
|
|
291
|
-
it('should return false with a Directive with "standalone: false"', () => {
|
|
292
|
+
(0, vitest_1.it)('should return false with a Directive with "standalone: false"', () => {
|
|
292
293
|
let FooDirective = class FooDirective {
|
|
293
294
|
};
|
|
294
295
|
FooDirective = __decorate([
|
|
295
296
|
(0, core_1.Directive)({ standalone: false })
|
|
296
297
|
], FooDirective);
|
|
297
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooDirective)).toEqual(false);
|
|
298
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooDirective)).toEqual(false);
|
|
298
299
|
});
|
|
299
|
-
it('should return false with Directive without the "standalone" property', () => {
|
|
300
|
+
(0, vitest_1.it)('should return false with Directive without the "standalone" property', () => {
|
|
300
301
|
let FooDirective = class FooDirective {
|
|
301
302
|
};
|
|
302
303
|
FooDirective = __decorate([
|
|
303
304
|
(0, core_1.Directive)()
|
|
304
305
|
], FooDirective);
|
|
305
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooDirective)).toEqual(false);
|
|
306
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooDirective)).toEqual(false);
|
|
306
307
|
});
|
|
307
|
-
it('should return true with a Pipe with "standalone: true"', () => {
|
|
308
|
+
(0, vitest_1.it)('should return true with a Pipe with "standalone: true"', () => {
|
|
308
309
|
let FooPipe = class FooPipe {
|
|
309
310
|
};
|
|
310
311
|
FooPipe = __decorate([
|
|
311
312
|
(0, core_1.Pipe)({ name: 'FooPipe', standalone: true })
|
|
312
313
|
], FooPipe);
|
|
313
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(true);
|
|
314
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(true);
|
|
314
315
|
});
|
|
315
|
-
it('should return false with a Pipe with "standalone: false"', () => {
|
|
316
|
+
(0, vitest_1.it)('should return false with a Pipe with "standalone: false"', () => {
|
|
316
317
|
let FooPipe = class FooPipe {
|
|
317
318
|
};
|
|
318
319
|
FooPipe = __decorate([
|
|
319
320
|
(0, core_1.Pipe)({ name: 'FooPipe', standalone: false })
|
|
320
321
|
], FooPipe);
|
|
321
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(false);
|
|
322
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(false);
|
|
322
323
|
});
|
|
323
|
-
it('should return false with Pipe without the "standalone" property', () => {
|
|
324
|
+
(0, vitest_1.it)('should return false with Pipe without the "standalone" property', () => {
|
|
324
325
|
let FooPipe = class FooPipe {
|
|
325
326
|
};
|
|
326
327
|
FooPipe = __decorate([
|
|
@@ -328,23 +329,23 @@ describe('isStandaloneComponent', () => {
|
|
|
328
329
|
name: 'fooPipe',
|
|
329
330
|
})
|
|
330
331
|
], FooPipe);
|
|
331
|
-
expect((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(false);
|
|
332
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.isStandaloneComponent)(FooPipe)).toEqual(false);
|
|
332
333
|
});
|
|
333
334
|
});
|
|
334
|
-
describe('getComponentDecoratorMetadata', () => {
|
|
335
|
-
it('should return Component with a Component', () => {
|
|
335
|
+
(0, vitest_1.describe)('getComponentDecoratorMetadata', () => {
|
|
336
|
+
(0, vitest_1.it)('should return Component with a Component', () => {
|
|
336
337
|
let FooComponent = class FooComponent {
|
|
337
338
|
};
|
|
338
339
|
FooComponent = __decorate([
|
|
339
340
|
(0, core_1.Component)({ selector: 'foo' })
|
|
340
341
|
], FooComponent);
|
|
341
|
-
expect((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toBeInstanceOf(core_1.Component);
|
|
342
|
-
expect((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toEqual({
|
|
342
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toBeInstanceOf(core_1.Component);
|
|
343
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toEqual({
|
|
343
344
|
changeDetection: 1,
|
|
344
345
|
selector: 'foo',
|
|
345
346
|
});
|
|
346
347
|
});
|
|
347
|
-
it('should return Component with extending classes', () => {
|
|
348
|
+
(0, vitest_1.it)('should return Component with extending classes', () => {
|
|
348
349
|
let BarComponent = class BarComponent {
|
|
349
350
|
};
|
|
350
351
|
BarComponent = __decorate([
|
|
@@ -355,8 +356,8 @@ describe('getComponentDecoratorMetadata', () => {
|
|
|
355
356
|
FooComponent = __decorate([
|
|
356
357
|
(0, core_1.Component)({ selector: 'foo' })
|
|
357
358
|
], FooComponent);
|
|
358
|
-
expect((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toBeInstanceOf(core_1.Component);
|
|
359
|
-
expect((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toEqual({
|
|
359
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toBeInstanceOf(core_1.Component);
|
|
360
|
+
(0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentDecoratorMetadata)(FooComponent)).toEqual({
|
|
360
361
|
changeDetection: 1,
|
|
361
362
|
selector: 'foo',
|
|
362
363
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@angular/core");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
4
5
|
const NgModulesAnalyzer_1 = require("./NgModulesAnalyzer");
|
|
5
6
|
const FooComponent = (0, core_1.Component)({})(class {
|
|
6
7
|
});
|
|
@@ -10,14 +11,14 @@ const BetaModule = (0, core_1.NgModule)({ declarations: [FooComponent] })(class
|
|
|
10
11
|
});
|
|
11
12
|
const AlphaModule = (0, core_1.NgModule)({ imports: [BetaModule] })(class {
|
|
12
13
|
});
|
|
13
|
-
describe('isComponentAlreadyDeclaredInModules', () => {
|
|
14
|
-
it('should return true when the component is already declared in one of modules', () => {
|
|
15
|
-
expect((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(FooComponent, [], [AlphaModule])).toEqual(true);
|
|
14
|
+
(0, vitest_1.describe)('isComponentAlreadyDeclaredInModules', () => {
|
|
15
|
+
(0, vitest_1.it)('should return true when the component is already declared in one of modules', () => {
|
|
16
|
+
(0, vitest_1.expect)((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(FooComponent, [], [AlphaModule])).toEqual(true);
|
|
16
17
|
});
|
|
17
|
-
it('should return true if the component is in moduleDeclarations', () => {
|
|
18
|
-
expect((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(BarComponent, [BarComponent], [AlphaModule])).toEqual(true);
|
|
18
|
+
(0, vitest_1.it)('should return true if the component is in moduleDeclarations', () => {
|
|
19
|
+
(0, vitest_1.expect)((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(BarComponent, [BarComponent], [AlphaModule])).toEqual(true);
|
|
19
20
|
});
|
|
20
|
-
it('should return false if the component is not declared', () => {
|
|
21
|
-
expect((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(BarComponent, [], [AlphaModule])).toEqual(false);
|
|
21
|
+
(0, vitest_1.it)('should return false if the component is not declared', () => {
|
|
22
|
+
(0, vitest_1.expect)((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(BarComponent, [], [AlphaModule])).toEqual(false);
|
|
22
23
|
});
|
|
23
24
|
});
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.PropertyExtractor = exports.uniqueArray = exports.REMOVED_MODULES = exports.reflectionCapabilities = void 0;
|
|
8
|
-
/* eslint-disable no-console */
|
|
9
8
|
const common_1 = require("@angular/common");
|
|
10
9
|
const core_1 = require("@angular/core");
|
|
11
10
|
const platform_browser_1 = require("@angular/platform-browser");
|
|
@@ -17,8 +17,6 @@ const TestComponent2 = (0, core_1.Component)({})(class {
|
|
|
17
17
|
});
|
|
18
18
|
const StandaloneTestComponent = (0, core_1.Component)({ standalone: true })(class {
|
|
19
19
|
});
|
|
20
|
-
const TestDirective = (0, core_1.Directive)({})(class {
|
|
21
|
-
});
|
|
22
20
|
const StandaloneTestDirective = (0, core_1.Directive)({ standalone: true })(class {
|
|
23
21
|
});
|
|
24
22
|
const TestModuleWithDeclarations = (0, core_1.NgModule)({ declarations: [TestComponent1] })(class {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
3
4
|
const argsToTemplate_1 = require("./argsToTemplate"); // adjust path
|
|
4
|
-
describe('argsToTemplate', () => {
|
|
5
|
-
it('should correctly convert args to template string and exclude undefined values', () => {
|
|
5
|
+
(0, vitest_1.describe)('argsToTemplate', () => {
|
|
6
|
+
(0, vitest_1.it)('should correctly convert args to template string and exclude undefined values', () => {
|
|
6
7
|
const args = {
|
|
7
8
|
prop1: 'value1',
|
|
8
9
|
prop2: undefined,
|
|
@@ -10,9 +11,9 @@ describe('argsToTemplate', () => {
|
|
|
10
11
|
};
|
|
11
12
|
const options = {};
|
|
12
13
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
13
|
-
expect(result).toBe('[prop1]="prop1" [prop3]="prop3"');
|
|
14
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1" [prop3]="prop3"');
|
|
14
15
|
});
|
|
15
|
-
it('should include properties from include option', () => {
|
|
16
|
+
(0, vitest_1.it)('should include properties from include option', () => {
|
|
16
17
|
const args = {
|
|
17
18
|
prop1: 'value1',
|
|
18
19
|
prop2: 'value2',
|
|
@@ -22,9 +23,9 @@ describe('argsToTemplate', () => {
|
|
|
22
23
|
include: ['prop1', 'prop3'],
|
|
23
24
|
};
|
|
24
25
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
25
|
-
expect(result).toBe('[prop1]="prop1" [prop3]="prop3"');
|
|
26
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1" [prop3]="prop3"');
|
|
26
27
|
});
|
|
27
|
-
it('should include non-undefined properties from include option', () => {
|
|
28
|
+
(0, vitest_1.it)('should include non-undefined properties from include option', () => {
|
|
28
29
|
const args = {
|
|
29
30
|
prop1: 'value1',
|
|
30
31
|
prop2: 'value2',
|
|
@@ -34,9 +35,9 @@ describe('argsToTemplate', () => {
|
|
|
34
35
|
include: ['prop1', 'prop3'],
|
|
35
36
|
};
|
|
36
37
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
37
|
-
expect(result).toBe('[prop1]="prop1"');
|
|
38
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1"');
|
|
38
39
|
});
|
|
39
|
-
it('should exclude properties from exclude option', () => {
|
|
40
|
+
(0, vitest_1.it)('should exclude properties from exclude option', () => {
|
|
40
41
|
const args = {
|
|
41
42
|
prop1: 'value1',
|
|
42
43
|
prop2: 'value2',
|
|
@@ -46,9 +47,9 @@ describe('argsToTemplate', () => {
|
|
|
46
47
|
exclude: ['prop2'],
|
|
47
48
|
};
|
|
48
49
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
49
|
-
expect(result).toBe('[prop1]="prop1" [prop3]="prop3"');
|
|
50
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1" [prop3]="prop3"');
|
|
50
51
|
});
|
|
51
|
-
it('should exclude properties from exclude option and undefined properties', () => {
|
|
52
|
+
(0, vitest_1.it)('should exclude properties from exclude option and undefined properties', () => {
|
|
52
53
|
const args = {
|
|
53
54
|
prop1: 'value1',
|
|
54
55
|
prop2: 'value2',
|
|
@@ -58,9 +59,9 @@ describe('argsToTemplate', () => {
|
|
|
58
59
|
exclude: ['prop2'],
|
|
59
60
|
};
|
|
60
61
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
61
|
-
expect(result).toBe('[prop1]="prop1"');
|
|
62
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1"');
|
|
62
63
|
});
|
|
63
|
-
it('should prioritize include over exclude when both options are given', () => {
|
|
64
|
+
(0, vitest_1.it)('should prioritize include over exclude when both options are given', () => {
|
|
64
65
|
const args = {
|
|
65
66
|
prop1: 'value1',
|
|
66
67
|
prop2: 'value2',
|
|
@@ -71,25 +72,25 @@ describe('argsToTemplate', () => {
|
|
|
71
72
|
exclude: ['prop2', 'prop3'],
|
|
72
73
|
};
|
|
73
74
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
74
|
-
expect(result).toBe('[prop1]="prop1" [prop2]="prop2"');
|
|
75
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1" [prop2]="prop2"');
|
|
75
76
|
});
|
|
76
|
-
it('should work when neither include nor exclude options are given', () => {
|
|
77
|
+
(0, vitest_1.it)('should work when neither include nor exclude options are given', () => {
|
|
77
78
|
const args = {
|
|
78
79
|
prop1: 'value1',
|
|
79
80
|
prop2: 'value2',
|
|
80
81
|
};
|
|
81
82
|
const options = {};
|
|
82
83
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, options);
|
|
83
|
-
expect(result).toBe('[prop1]="prop1" [prop2]="prop2"');
|
|
84
|
+
(0, vitest_1.expect)(result).toBe('[prop1]="prop1" [prop2]="prop2"');
|
|
84
85
|
});
|
|
85
|
-
it('should bind events correctly when value is a function', () => {
|
|
86
|
+
(0, vitest_1.it)('should bind events correctly when value is a function', () => {
|
|
86
87
|
const args = { event1: () => { }, event2: () => { } };
|
|
87
88
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, {});
|
|
88
|
-
expect(result).toEqual('(event1)="event1($event)" (event2)="event2($event)"');
|
|
89
|
+
(0, vitest_1.expect)(result).toEqual('(event1)="event1($event)" (event2)="event2($event)"');
|
|
89
90
|
});
|
|
90
|
-
it('should mix properties and events correctly', () => {
|
|
91
|
+
(0, vitest_1.it)('should mix properties and events correctly', () => {
|
|
91
92
|
const args = { input: 'Value1', event1: () => { } };
|
|
92
93
|
const result = (0, argsToTemplate_1.argsToTemplate)(args, {});
|
|
93
|
-
expect(result).toEqual('[input]="input" (event1)="event1($event)"');
|
|
94
|
+
(0, vitest_1.expect)(result).toEqual('[input]="input" (event1)="event1($event)"');
|
|
94
95
|
});
|
|
95
96
|
});
|