@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
|
@@ -7,17 +7,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
const core_1 = require("@angular/core");
|
|
10
|
+
const vitest_1 = require("vitest");
|
|
10
11
|
const ComputesTemplateFromComponent_1 = require("./ComputesTemplateFromComponent");
|
|
11
12
|
const input_component_1 = require("./__testfixtures__/input.component");
|
|
12
|
-
describe('angular source decorator', () => {
|
|
13
|
-
it('With no props should generate simple tag', () => {
|
|
13
|
+
(0, vitest_1.describe)('angular source decorator', () => {
|
|
14
|
+
(0, vitest_1.it)('With no props should generate simple tag', () => {
|
|
14
15
|
const component = input_component_1.InputComponent;
|
|
15
16
|
const props = {};
|
|
16
17
|
const argTypes = {};
|
|
17
18
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
18
|
-
expect(source).toEqual('<doc-button></doc-button>');
|
|
19
|
+
(0, vitest_1.expect)(source).toEqual('<doc-button></doc-button>');
|
|
19
20
|
});
|
|
20
|
-
describe('with component without selector', () => {
|
|
21
|
+
(0, vitest_1.describe)('with component without selector', () => {
|
|
21
22
|
let WithoutSelectorComponent = class WithoutSelectorComponent {
|
|
22
23
|
};
|
|
23
24
|
WithoutSelectorComponent = __decorate([
|
|
@@ -25,15 +26,15 @@ describe('angular source decorator', () => {
|
|
|
25
26
|
template: `The content`,
|
|
26
27
|
})
|
|
27
28
|
], WithoutSelectorComponent);
|
|
28
|
-
it('should add component ng-container', async () => {
|
|
29
|
+
(0, vitest_1.it)('should add component ng-container', async () => {
|
|
29
30
|
const component = WithoutSelectorComponent;
|
|
30
31
|
const props = {};
|
|
31
32
|
const argTypes = {};
|
|
32
33
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
33
|
-
expect(source).toEqual(`<ng-container *ngComponentOutlet="WithoutSelectorComponent"></ng-container>`);
|
|
34
|
+
(0, vitest_1.expect)(source).toEqual(`<ng-container *ngComponentOutlet="WithoutSelectorComponent"></ng-container>`);
|
|
34
35
|
});
|
|
35
36
|
});
|
|
36
|
-
describe('with component with attribute selector', () => {
|
|
37
|
+
(0, vitest_1.describe)('with component with attribute selector', () => {
|
|
37
38
|
let WithAttributeComponent = class WithAttributeComponent {
|
|
38
39
|
};
|
|
39
40
|
WithAttributeComponent = __decorate([
|
|
@@ -42,15 +43,15 @@ describe('angular source decorator', () => {
|
|
|
42
43
|
template: '<button></button>',
|
|
43
44
|
})
|
|
44
45
|
], WithAttributeComponent);
|
|
45
|
-
it('should add attribute to template', async () => {
|
|
46
|
+
(0, vitest_1.it)('should add attribute to template', async () => {
|
|
46
47
|
const component = WithAttributeComponent;
|
|
47
48
|
const props = {};
|
|
48
49
|
const argTypes = {};
|
|
49
50
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
50
|
-
expect(source).toEqual(`<doc-button foo></doc-button>`);
|
|
51
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button foo></doc-button>`);
|
|
51
52
|
});
|
|
52
53
|
});
|
|
53
|
-
describe('with component with attribute and value selector', () => {
|
|
54
|
+
(0, vitest_1.describe)('with component with attribute and value selector', () => {
|
|
54
55
|
let WithAttributeValueComponent = class WithAttributeValueComponent {
|
|
55
56
|
};
|
|
56
57
|
WithAttributeValueComponent = __decorate([
|
|
@@ -59,15 +60,15 @@ describe('angular source decorator', () => {
|
|
|
59
60
|
template: '<button></button>',
|
|
60
61
|
})
|
|
61
62
|
], WithAttributeValueComponent);
|
|
62
|
-
it('should add attribute to template', async () => {
|
|
63
|
+
(0, vitest_1.it)('should add attribute to template', async () => {
|
|
63
64
|
const component = WithAttributeValueComponent;
|
|
64
65
|
const props = {};
|
|
65
66
|
const argTypes = {};
|
|
66
67
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
67
|
-
expect(source).toEqual(`<doc-button foo="bar"></doc-button>`);
|
|
68
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button foo="bar"></doc-button>`);
|
|
68
69
|
});
|
|
69
70
|
});
|
|
70
|
-
describe('with component with attribute only selector', () => {
|
|
71
|
+
(0, vitest_1.describe)('with component with attribute only selector', () => {
|
|
71
72
|
let WithAttributeOnlyComponent = class WithAttributeOnlyComponent {
|
|
72
73
|
};
|
|
73
74
|
WithAttributeOnlyComponent = __decorate([
|
|
@@ -76,15 +77,15 @@ describe('angular source decorator', () => {
|
|
|
76
77
|
template: '<button></button>',
|
|
77
78
|
})
|
|
78
79
|
], WithAttributeOnlyComponent);
|
|
79
|
-
it('should create a div and add attribute to template', async () => {
|
|
80
|
+
(0, vitest_1.it)('should create a div and add attribute to template', async () => {
|
|
80
81
|
const component = WithAttributeOnlyComponent;
|
|
81
82
|
const props = {};
|
|
82
83
|
const argTypes = {};
|
|
83
84
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
84
|
-
expect(source).toEqual(`<div foo></div>`);
|
|
85
|
+
(0, vitest_1.expect)(source).toEqual(`<div foo></div>`);
|
|
85
86
|
});
|
|
86
87
|
});
|
|
87
|
-
describe('with component with void element and attribute selector', () => {
|
|
88
|
+
(0, vitest_1.describe)('with component with void element and attribute selector', () => {
|
|
88
89
|
let VoidElementWithAttributeComponent = class VoidElementWithAttributeComponent {
|
|
89
90
|
};
|
|
90
91
|
VoidElementWithAttributeComponent = __decorate([
|
|
@@ -93,15 +94,15 @@ describe('angular source decorator', () => {
|
|
|
93
94
|
template: '<button></button>',
|
|
94
95
|
})
|
|
95
96
|
], VoidElementWithAttributeComponent);
|
|
96
|
-
it('should create without separate closing tag', async () => {
|
|
97
|
+
(0, vitest_1.it)('should create without separate closing tag', async () => {
|
|
97
98
|
const component = VoidElementWithAttributeComponent;
|
|
98
99
|
const props = {};
|
|
99
100
|
const argTypes = {};
|
|
100
101
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
101
|
-
expect(source).toEqual(`<input foo />`);
|
|
102
|
+
(0, vitest_1.expect)(source).toEqual(`<input foo />`);
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
|
-
describe('with component with attribute and value only selector', () => {
|
|
105
|
+
(0, vitest_1.describe)('with component with attribute and value only selector', () => {
|
|
105
106
|
let WithAttributeOnlyComponent = class WithAttributeOnlyComponent {
|
|
106
107
|
};
|
|
107
108
|
WithAttributeOnlyComponent = __decorate([
|
|
@@ -110,15 +111,15 @@ describe('angular source decorator', () => {
|
|
|
110
111
|
template: '<button></button>',
|
|
111
112
|
})
|
|
112
113
|
], WithAttributeOnlyComponent);
|
|
113
|
-
it('should create a div and add attribute to template', async () => {
|
|
114
|
+
(0, vitest_1.it)('should create a div and add attribute to template', async () => {
|
|
114
115
|
const component = WithAttributeOnlyComponent;
|
|
115
116
|
const props = {};
|
|
116
117
|
const argTypes = {};
|
|
117
118
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
118
|
-
expect(source).toEqual(`<div foo="bar"></div>`);
|
|
119
|
+
(0, vitest_1.expect)(source).toEqual(`<div foo="bar"></div>`);
|
|
119
120
|
});
|
|
120
121
|
});
|
|
121
|
-
describe('with component with void element, attribute and value only selector', () => {
|
|
122
|
+
(0, vitest_1.describe)('with component with void element, attribute and value only selector', () => {
|
|
122
123
|
let VoidElementWithAttributeComponent = class VoidElementWithAttributeComponent {
|
|
123
124
|
};
|
|
124
125
|
VoidElementWithAttributeComponent = __decorate([
|
|
@@ -127,15 +128,15 @@ describe('angular source decorator', () => {
|
|
|
127
128
|
template: '<button></button>',
|
|
128
129
|
})
|
|
129
130
|
], VoidElementWithAttributeComponent);
|
|
130
|
-
it('should create and add attribute to template without separate closing tag', async () => {
|
|
131
|
+
(0, vitest_1.it)('should create and add attribute to template without separate closing tag', async () => {
|
|
131
132
|
const component = VoidElementWithAttributeComponent;
|
|
132
133
|
const props = {};
|
|
133
134
|
const argTypes = {};
|
|
134
135
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
135
|
-
expect(source).toEqual(`<input foo="bar" />`);
|
|
136
|
+
(0, vitest_1.expect)(source).toEqual(`<input foo="bar" />`);
|
|
136
137
|
});
|
|
137
138
|
});
|
|
138
|
-
describe('with component with class selector', () => {
|
|
139
|
+
(0, vitest_1.describe)('with component with class selector', () => {
|
|
139
140
|
let WithClassComponent = class WithClassComponent {
|
|
140
141
|
};
|
|
141
142
|
WithClassComponent = __decorate([
|
|
@@ -144,15 +145,15 @@ describe('angular source decorator', () => {
|
|
|
144
145
|
template: '<button></button>',
|
|
145
146
|
})
|
|
146
147
|
], WithClassComponent);
|
|
147
|
-
it('should add class to template', async () => {
|
|
148
|
+
(0, vitest_1.it)('should add class to template', async () => {
|
|
148
149
|
const component = WithClassComponent;
|
|
149
150
|
const props = {};
|
|
150
151
|
const argTypes = {};
|
|
151
152
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
152
|
-
expect(source).toEqual(`<doc-button class="foo"></doc-button>`);
|
|
153
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button class="foo"></doc-button>`);
|
|
153
154
|
});
|
|
154
155
|
});
|
|
155
|
-
describe('with component with class only selector', () => {
|
|
156
|
+
(0, vitest_1.describe)('with component with class only selector', () => {
|
|
156
157
|
let WithClassComponent = class WithClassComponent {
|
|
157
158
|
};
|
|
158
159
|
WithClassComponent = __decorate([
|
|
@@ -161,15 +162,15 @@ describe('angular source decorator', () => {
|
|
|
161
162
|
template: '<button></button>',
|
|
162
163
|
})
|
|
163
164
|
], WithClassComponent);
|
|
164
|
-
it('should create a div and add attribute to template', async () => {
|
|
165
|
+
(0, vitest_1.it)('should create a div and add attribute to template', async () => {
|
|
165
166
|
const component = WithClassComponent;
|
|
166
167
|
const props = {};
|
|
167
168
|
const argTypes = {};
|
|
168
169
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
169
|
-
expect(source).toEqual(`<div class="foo"></div>`);
|
|
170
|
+
(0, vitest_1.expect)(source).toEqual(`<div class="foo"></div>`);
|
|
170
171
|
});
|
|
171
172
|
});
|
|
172
|
-
describe('with component with multiple selectors', () => {
|
|
173
|
+
(0, vitest_1.describe)('with component with multiple selectors', () => {
|
|
173
174
|
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
174
175
|
};
|
|
175
176
|
WithMultipleSelectorsComponent = __decorate([
|
|
@@ -178,15 +179,15 @@ describe('angular source decorator', () => {
|
|
|
178
179
|
template: '<button></button>',
|
|
179
180
|
})
|
|
180
181
|
], WithMultipleSelectorsComponent);
|
|
181
|
-
it('should use the first selector', async () => {
|
|
182
|
+
(0, vitest_1.it)('should use the first selector', async () => {
|
|
182
183
|
const component = WithMultipleSelectorsComponent;
|
|
183
184
|
const props = {};
|
|
184
185
|
const argTypes = {};
|
|
185
186
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
186
|
-
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
187
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button></doc-button>`);
|
|
187
188
|
});
|
|
188
189
|
});
|
|
189
|
-
describe('with component with multiple selectors starting with attribute', () => {
|
|
190
|
+
(0, vitest_1.describe)('with component with multiple selectors starting with attribute', () => {
|
|
190
191
|
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
191
192
|
};
|
|
192
193
|
WithMultipleSelectorsComponent = __decorate([
|
|
@@ -195,15 +196,15 @@ describe('angular source decorator', () => {
|
|
|
195
196
|
template: '<button></button>',
|
|
196
197
|
})
|
|
197
198
|
], WithMultipleSelectorsComponent);
|
|
198
|
-
it('should use the first selector', async () => {
|
|
199
|
+
(0, vitest_1.it)('should use the first selector', async () => {
|
|
199
200
|
const component = WithMultipleSelectorsComponent;
|
|
200
201
|
const props = {};
|
|
201
202
|
const argTypes = {};
|
|
202
203
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
203
|
-
expect(source).toEqual(`<doc-button foo></doc-button>`);
|
|
204
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button foo></doc-button>`);
|
|
204
205
|
});
|
|
205
206
|
});
|
|
206
|
-
describe('with component with multiple selectors starting with attribute and value', () => {
|
|
207
|
+
(0, vitest_1.describe)('with component with multiple selectors starting with attribute and value', () => {
|
|
207
208
|
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
208
209
|
};
|
|
209
210
|
WithMultipleSelectorsComponent = __decorate([
|
|
@@ -212,15 +213,15 @@ describe('angular source decorator', () => {
|
|
|
212
213
|
template: '<button></button>',
|
|
213
214
|
})
|
|
214
215
|
], WithMultipleSelectorsComponent);
|
|
215
|
-
it('should use the first selector', async () => {
|
|
216
|
+
(0, vitest_1.it)('should use the first selector', async () => {
|
|
216
217
|
const component = WithMultipleSelectorsComponent;
|
|
217
218
|
const props = {};
|
|
218
219
|
const argTypes = {};
|
|
219
220
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
220
|
-
expect(source).toEqual(`<doc-button foo="bar"></doc-button>`);
|
|
221
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button foo="bar"></doc-button>`);
|
|
221
222
|
});
|
|
222
223
|
});
|
|
223
|
-
describe('with component with multiple selectors including 2 attributes and a class', () => {
|
|
224
|
+
(0, vitest_1.describe)('with component with multiple selectors including 2 attributes and a class', () => {
|
|
224
225
|
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
225
226
|
};
|
|
226
227
|
WithMultipleSelectorsComponent = __decorate([
|
|
@@ -229,15 +230,15 @@ describe('angular source decorator', () => {
|
|
|
229
230
|
template: '<button></button>',
|
|
230
231
|
})
|
|
231
232
|
], WithMultipleSelectorsComponent);
|
|
232
|
-
it('should use the first selector', async () => {
|
|
233
|
+
(0, vitest_1.it)('should use the first selector', async () => {
|
|
233
234
|
const component = WithMultipleSelectorsComponent;
|
|
234
235
|
const props = {};
|
|
235
236
|
const argTypes = {};
|
|
236
237
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
237
|
-
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
238
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button></doc-button>`);
|
|
238
239
|
});
|
|
239
240
|
});
|
|
240
|
-
describe('with component with multiple selectors with line breaks', () => {
|
|
241
|
+
(0, vitest_1.describe)('with component with multiple selectors with line breaks', () => {
|
|
241
242
|
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
242
243
|
};
|
|
243
244
|
WithMultipleSelectorsComponent = __decorate([
|
|
@@ -247,15 +248,15 @@ describe('angular source decorator', () => {
|
|
|
247
248
|
template: '<button></button>',
|
|
248
249
|
})
|
|
249
250
|
], WithMultipleSelectorsComponent);
|
|
250
|
-
it('should use the first selector', async () => {
|
|
251
|
+
(0, vitest_1.it)('should use the first selector', async () => {
|
|
251
252
|
const component = WithMultipleSelectorsComponent;
|
|
252
253
|
const props = {};
|
|
253
254
|
const argTypes = {};
|
|
254
255
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
255
|
-
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
256
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button></doc-button>`);
|
|
256
257
|
});
|
|
257
258
|
});
|
|
258
|
-
describe('with component with multiple selectors starting with attribute only with line breaks', () => {
|
|
259
|
+
(0, vitest_1.describe)('with component with multiple selectors starting with attribute only with line breaks', () => {
|
|
259
260
|
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
260
261
|
};
|
|
261
262
|
WithMultipleSelectorsComponent = __decorate([
|
|
@@ -265,23 +266,23 @@ describe('angular source decorator', () => {
|
|
|
265
266
|
template: '<button></button>',
|
|
266
267
|
})
|
|
267
268
|
], WithMultipleSelectorsComponent);
|
|
268
|
-
it('should use the first selector', async () => {
|
|
269
|
+
(0, vitest_1.it)('should use the first selector', async () => {
|
|
269
270
|
const component = WithMultipleSelectorsComponent;
|
|
270
271
|
const props = {};
|
|
271
272
|
const argTypes = {};
|
|
272
273
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
273
|
-
expect(source).toEqual(`<div foo></div>`);
|
|
274
|
+
(0, vitest_1.expect)(source).toEqual(`<div foo></div>`);
|
|
274
275
|
});
|
|
275
276
|
});
|
|
276
|
-
describe('no argTypes', () => {
|
|
277
|
-
it('should generate tag-only template with no props', () => {
|
|
277
|
+
(0, vitest_1.describe)('no argTypes', () => {
|
|
278
|
+
(0, vitest_1.it)('should generate tag-only template with no props', () => {
|
|
278
279
|
const component = input_component_1.InputComponent;
|
|
279
280
|
const props = {};
|
|
280
281
|
const argTypes = {};
|
|
281
282
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
282
|
-
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
283
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button></doc-button>`);
|
|
283
284
|
});
|
|
284
|
-
it('With props should generate tag with properties', () => {
|
|
285
|
+
(0, vitest_1.it)('With props should generate tag with properties', () => {
|
|
285
286
|
const component = input_component_1.InputComponent;
|
|
286
287
|
const props = {
|
|
287
288
|
isDisabled: true,
|
|
@@ -291,9 +292,9 @@ describe('angular source decorator', () => {
|
|
|
291
292
|
};
|
|
292
293
|
const argTypes = {};
|
|
293
294
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
294
|
-
expect(source).toEqual(`<doc-button [counter]="4" [accent]="'High'" [isDisabled]="true" [label]="'Hello world'"></doc-button>`);
|
|
295
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button [counter]="4" [accent]="'High'" [isDisabled]="true" [label]="'Hello world'"></doc-button>`);
|
|
295
296
|
});
|
|
296
|
-
it('With props should generate tag with outputs', () => {
|
|
297
|
+
(0, vitest_1.it)('With props should generate tag with outputs', () => {
|
|
297
298
|
const component = input_component_1.InputComponent;
|
|
298
299
|
const props = {
|
|
299
300
|
isDisabled: true,
|
|
@@ -302,20 +303,20 @@ describe('angular source decorator', () => {
|
|
|
302
303
|
};
|
|
303
304
|
const argTypes = {};
|
|
304
305
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
305
|
-
expect(source).toEqual(`<doc-button [isDisabled]="true" [label]="'Hello world'" (onClick)="onClick($event)"></doc-button>`);
|
|
306
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button [isDisabled]="true" [label]="'Hello world'" (onClick)="onClick($event)"></doc-button>`);
|
|
306
307
|
});
|
|
307
|
-
it('should generate correct property for overridden name for Input', () => {
|
|
308
|
+
(0, vitest_1.it)('should generate correct property for overridden name for Input', () => {
|
|
308
309
|
const component = input_component_1.InputComponent;
|
|
309
310
|
const props = {
|
|
310
311
|
color: '#ffffff',
|
|
311
312
|
};
|
|
312
313
|
const argTypes = {};
|
|
313
314
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
314
|
-
expect(source).toEqual(`<doc-button [color]="'#ffffff'"></doc-button>`);
|
|
315
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button [color]="'#ffffff'"></doc-button>`);
|
|
315
316
|
});
|
|
316
317
|
});
|
|
317
|
-
describe('with argTypes (from compodoc)', () => {
|
|
318
|
-
it('Should handle enum as strongly typed enum', () => {
|
|
318
|
+
(0, vitest_1.describe)('with argTypes (from compodoc)', () => {
|
|
319
|
+
(0, vitest_1.it)('Should handle enum as strongly typed enum', () => {
|
|
319
320
|
const component = input_component_1.InputComponent;
|
|
320
321
|
const props = {
|
|
321
322
|
isDisabled: false,
|
|
@@ -340,9 +341,9 @@ describe('angular source decorator', () => {
|
|
|
340
341
|
},
|
|
341
342
|
};
|
|
342
343
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
343
|
-
expect(source).toEqual(`<doc-button [accent]="'High'" [isDisabled]="false" [label]="'Hello world'"></doc-button>`);
|
|
344
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button [accent]="'High'" [isDisabled]="false" [label]="'Hello world'"></doc-button>`);
|
|
344
345
|
});
|
|
345
|
-
it('Should handle enum without values as string', () => {
|
|
346
|
+
(0, vitest_1.it)('Should handle enum without values as string', () => {
|
|
346
347
|
const component = input_component_1.InputComponent;
|
|
347
348
|
const props = {
|
|
348
349
|
isDisabled: false,
|
|
@@ -367,9 +368,9 @@ describe('angular source decorator', () => {
|
|
|
367
368
|
},
|
|
368
369
|
};
|
|
369
370
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
370
|
-
expect(source).toEqual(`<doc-button [accent]="'High'" [isDisabled]="false" [label]="'Hello world'"></doc-button>`);
|
|
371
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button [accent]="'High'" [isDisabled]="false" [label]="'Hello world'"></doc-button>`);
|
|
371
372
|
});
|
|
372
|
-
it('Should handle objects correctly', () => {
|
|
373
|
+
(0, vitest_1.it)('Should handle objects correctly', () => {
|
|
373
374
|
const component = input_component_1.InputComponent;
|
|
374
375
|
const someDataObject = {
|
|
375
376
|
one: 'Hello world',
|
|
@@ -383,9 +384,7 @@ describe('angular source decorator', () => {
|
|
|
383
384
|
'a single quoted string with escaped \'single quotes\'',
|
|
384
385
|
// eslint-disable-next-line prettier/prettier
|
|
385
386
|
"a double quoted string with escaped \"double quotes\"",
|
|
386
|
-
// eslint-disable-next-line no-useless-escape
|
|
387
387
|
`a string literal with \'escaped single quotes\'`,
|
|
388
|
-
// eslint-disable-next-line no-useless-escape
|
|
389
388
|
`a string literal with \"escaped double quotes\"`,
|
|
390
389
|
],
|
|
391
390
|
};
|
|
@@ -397,7 +396,7 @@ describe('angular source decorator', () => {
|
|
|
397
396
|
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, null);
|
|
398
397
|
// Ideally we should stringify the object, but that could cause the story to break because of unescaped values in the JSON object.
|
|
399
398
|
// This will have to do for now
|
|
400
|
-
expect(source).toEqual(`<doc-button [isDisabled]="false" [label]="'Hello world'" [someDataObject]="{one: 'Hello world', two: true, three: ['a string literal with \\'double quotes\\'', 'a string literal with \\'single quotes\\'', 'a single quoted string with \\'double quotes\\'', 'a double quoted string with \\'single quotes\\'', 'a single quoted string with escaped \\'single quotes\\'', 'a double quoted string with escaped \\'double quotes\\'', 'a string literal with \\'escaped single quotes\\'', 'a string literal with \\'escaped double quotes\\'']}"></doc-button>`);
|
|
399
|
+
(0, vitest_1.expect)(source).toEqual(`<doc-button [isDisabled]="false" [label]="'Hello world'" [someDataObject]="{one: 'Hello world', two: true, three: ['a string literal with \\'double quotes\\'', 'a string literal with \\'single quotes\\'', 'a single quoted string with \\'double quotes\\'', 'a double quoted string with \\'single quotes\\'', 'a single quoted string with escaped \\'single quotes\\'', 'a double quoted string with escaped \\'double quotes\\'', 'a string literal with \\'escaped single quotes\\'', 'a string literal with \\'escaped double quotes\\'']}"></doc-button>`);
|
|
401
400
|
});
|
|
402
401
|
});
|
|
403
402
|
});
|
|
@@ -9,6 +9,5 @@ export declare class DocsRenderer extends AbstractRenderer {
|
|
|
9
9
|
targetDOMNode: HTMLElement;
|
|
10
10
|
}): Promise<void>;
|
|
11
11
|
beforeFullRender(domNode?: HTMLElement): Promise<void>;
|
|
12
|
-
afterFullRender(): Promise<void>;
|
|
13
12
|
protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
|
|
14
13
|
}
|
|
@@ -34,9 +34,6 @@ class DocsRenderer extends AbstractRenderer_1.AbstractRenderer {
|
|
|
34
34
|
async beforeFullRender(domNode) {
|
|
35
35
|
DocsRenderer.resetApplications(domNode);
|
|
36
36
|
}
|
|
37
|
-
async afterFullRender() {
|
|
38
|
-
await AbstractRenderer_1.AbstractRenderer.resetCompiledComponents();
|
|
39
|
-
}
|
|
40
37
|
initAngularRootElement(targetDOMNode, targetSelector) {
|
|
41
38
|
super.initAngularRootElement(targetDOMNode, targetSelector);
|
|
42
39
|
targetDOMNode.setAttribute(AbstractRenderer_1.STORY_UID_ATTRIBUTE, (0, StoryUID_1.getNextStoryUID)(targetDOMNode.id));
|
|
@@ -18,7 +18,6 @@ vitest_1.vi.mock('@angular/platform-browser-dynamic');
|
|
|
18
18
|
let rendererFactory;
|
|
19
19
|
let rootTargetDOMNode;
|
|
20
20
|
let rootDocstargetDOMNode;
|
|
21
|
-
let storyInDocstargetDOMNode;
|
|
22
21
|
(0, vitest_1.beforeEach)(async () => {
|
|
23
22
|
rendererFactory = new RendererFactory_1.RendererFactory();
|
|
24
23
|
document.body.innerHTML =
|
|
@@ -29,7 +28,7 @@ vitest_1.vi.mock('@angular/platform-browser-dynamic');
|
|
|
29
28
|
platform_browser_dynamic_1.platformBrowserDynamic.mockImplementation(testing_1.platformBrowserDynamicTesting);
|
|
30
29
|
vitest_1.vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
31
30
|
});
|
|
32
|
-
afterEach(() => {
|
|
31
|
+
(0, vitest_1.afterEach)(() => {
|
|
33
32
|
vitest_1.vi.clearAllMocks();
|
|
34
33
|
// Necessary to avoid this error "Provided value for `preserveWhitespaces` can not be changed once it has been set." :
|
|
35
34
|
// Source: https://github.com/angular/angular/commit/e342ffd855ffeb8af7067b42307ffa320d82177e#diff-92b125e532cc22977b46a91f068d6d7ea81fd61b772842a4a0212f1cfd875be6R28
|
|
@@ -197,5 +196,37 @@ vitest_1.vi.mock('@angular/platform-browser-dynamic');
|
|
|
197
196
|
(0, vitest_1.expect)(global.document.querySelectorAll('#story-1 > story-1')[1].innerHTML).toBe('<foo>🦊</foo><!--container-->');
|
|
198
197
|
});
|
|
199
198
|
});
|
|
199
|
+
(0, vitest_1.describe)('when bootstrapping multiple stories in parallel', () => {
|
|
200
|
+
(0, vitest_1.it)('should render both stories', async () => {
|
|
201
|
+
let FooComponent = class FooComponent {
|
|
202
|
+
};
|
|
203
|
+
FooComponent = __decorate([
|
|
204
|
+
(0, core_1.Component)({ selector: 'foo', template: '🦊' })
|
|
205
|
+
], FooComponent);
|
|
206
|
+
const render = await rendererFactory.getRendererInstance(global.document.getElementById('storybook-docs'));
|
|
207
|
+
const targetDOMNode1 = global.document.createElement('div');
|
|
208
|
+
targetDOMNode1.id = 'story-1';
|
|
209
|
+
global.document.getElementById('storybook-docs').appendChild(targetDOMNode1);
|
|
210
|
+
const targetDOMNode2 = global.document.createElement('div');
|
|
211
|
+
targetDOMNode2.id = 'story-2';
|
|
212
|
+
global.document.getElementById('storybook-docs').appendChild(targetDOMNode2);
|
|
213
|
+
await Promise.all([
|
|
214
|
+
render.render({
|
|
215
|
+
storyFnAngular: {},
|
|
216
|
+
forced: false,
|
|
217
|
+
component: FooComponent,
|
|
218
|
+
targetDOMNode: targetDOMNode1,
|
|
219
|
+
}),
|
|
220
|
+
render.render({
|
|
221
|
+
storyFnAngular: {},
|
|
222
|
+
forced: false,
|
|
223
|
+
component: FooComponent,
|
|
224
|
+
targetDOMNode: targetDOMNode2,
|
|
225
|
+
}),
|
|
226
|
+
]);
|
|
227
|
+
(0, vitest_1.expect)(global.document.querySelector('#story-1 > story-1').innerHTML).toBe('<foo>🦊</foo><!--container-->');
|
|
228
|
+
(0, vitest_1.expect)(global.document.querySelector('#story-2 > story-2').innerHTML).toBe('<foo>🦊</foo><!--container-->');
|
|
229
|
+
});
|
|
230
|
+
});
|
|
200
231
|
});
|
|
201
232
|
});
|