@storybook/angular 9.1.0-alpha.0 → 9.1.0-alpha.10
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/build-schema.json +199 -0
- package/builders.json +14 -0
- package/dist/builders/build-storybook/index.js +31 -80
- package/dist/builders/start-storybook/index.js +31 -101
- package/dist/chunk-CUDJAP6K.mjs +3 -0
- package/dist/chunk-KMSSK3DZ.mjs +6 -0
- package/dist/chunk-LXSTVAFF.mjs +40 -0
- package/dist/client/config.d.ts +20 -6
- package/dist/client/config.js +49 -20
- package/dist/client/config.mjs +10 -13
- package/dist/client/docs/config.d.ts +6 -3
- package/dist/client/docs/config.js +18 -14
- package/dist/client/docs/config.mjs +6 -10
- package/dist/client/index.d.ts +144 -6
- package/dist/client/index.js +47 -30
- package/dist/client/index.mjs +3 -9
- package/dist/client/preview-prod.d.ts +2 -1
- package/dist/client/preview-prod.js +5 -4
- package/dist/client/preview-prod.mjs +1 -0
- package/dist/index.d.ts +59 -2
- package/dist/index.js +47 -29
- package/dist/index.mjs +3 -13
- package/dist/preset.js +8 -38
- package/dist/server/framework-preset-angular-cli.js +20 -83
- package/dist/server/framework-preset-angular-ivy.js +6 -59
- package/dist/{client/types.d.ts → types-3b0b7107.d.ts} +9 -9
- package/package.json +71 -24
- package/start-schema.json +234 -0
- package/dist/builders/build-storybook/index.d.ts +0 -25
- package/dist/builders/build-storybook/index.mjs +0 -78
- package/dist/builders/build-storybook/index.spec.d.ts +0 -1
- package/dist/builders/build-storybook/index.spec.js +0 -222
- package/dist/builders/build-storybook/index.spec.mjs +0 -187
- package/dist/builders/build-storybook/schema.json +0 -199
- package/dist/builders/builders.json +0 -14
- package/dist/builders/start-storybook/index.d.ts +0 -21
- package/dist/builders/start-storybook/index.mjs +0 -99
- package/dist/builders/start-storybook/index.spec.d.ts +0 -1
- package/dist/builders/start-storybook/index.spec.js +0 -188
- package/dist/builders/start-storybook/index.spec.mjs +0 -186
- package/dist/builders/start-storybook/schema.json +0 -234
- package/dist/builders/utils/error-handler.d.ts +0 -2
- package/dist/builders/utils/error-handler.js +0 -38
- package/dist/builders/utils/error-handler.mjs +0 -33
- package/dist/builders/utils/run-compodoc.d.ts +0 -6
- package/dist/builders/utils/run-compodoc.js +0 -35
- package/dist/builders/utils/run-compodoc.mjs +0 -31
- package/dist/builders/utils/run-compodoc.spec.d.ts +0 -1
- package/dist/builders/utils/run-compodoc.spec.js +0 -76
- package/dist/builders/utils/run-compodoc.spec.mjs +0 -74
- package/dist/builders/utils/standalone-options.d.ts +0 -18
- package/dist/builders/utils/standalone-options.js +0 -2
- package/dist/builders/utils/standalone-options.mjs +0 -1
- package/dist/client/angular-beta/AbstractRenderer.d.ts +0 -75
- package/dist/client/angular-beta/AbstractRenderer.js +0 -201
- package/dist/client/angular-beta/AbstractRenderer.mjs +0 -164
- package/dist/client/angular-beta/CanvasRenderer.d.ts +0 -12
- package/dist/client/angular-beta/CanvasRenderer.js +0 -13
- package/dist/client/angular-beta/CanvasRenderer.mjs +0 -9
- package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +0 -24
- package/dist/client/angular-beta/ComputesTemplateFromComponent.js +0 -160
- package/dist/client/angular-beta/ComputesTemplateFromComponent.mjs +0 -154
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +0 -1
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +0 -730
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.mjs +0 -728
- package/dist/client/angular-beta/DocsRenderer.d.ts +0 -13
- package/dist/client/angular-beta/DocsRenderer.js +0 -39
- package/dist/client/angular-beta/DocsRenderer.mjs +0 -35
- package/dist/client/angular-beta/RendererFactory.d.ts +0 -11
- package/dist/client/angular-beta/RendererFactory.js +0 -56
- package/dist/client/angular-beta/RendererFactory.mjs +0 -50
- package/dist/client/angular-beta/RendererFactory.test.d.ts +0 -1
- package/dist/client/angular-beta/RendererFactory.test.js +0 -235
- package/dist/client/angular-beta/RendererFactory.test.mjs +0 -233
- package/dist/client/angular-beta/StorybookModule.d.ts +0 -8
- package/dist/client/angular-beta/StorybookModule.js +0 -27
- package/dist/client/angular-beta/StorybookModule.mjs +0 -23
- package/dist/client/angular-beta/StorybookModule.test.d.ts +0 -1
- package/dist/client/angular-beta/StorybookModule.test.js +0 -321
- package/dist/client/angular-beta/StorybookModule.test.mjs +0 -319
- package/dist/client/angular-beta/StorybookProvider.d.ts +0 -5
- package/dist/client/angular-beta/StorybookProvider.js +0 -26
- package/dist/client/angular-beta/StorybookProvider.mjs +0 -22
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +0 -13
- package/dist/client/angular-beta/StorybookWrapperComponent.js +0 -127
- package/dist/client/angular-beta/StorybookWrapperComponent.mjs +0 -123
- package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +0 -29
- package/dist/client/angular-beta/__testfixtures__/input.component.js +0 -76
- package/dist/client/angular-beta/__testfixtures__/input.component.mjs +0 -73
- package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +0 -2
- package/dist/client/angular-beta/__testfixtures__/test.module.js +0 -20
- package/dist/client/angular-beta/__testfixtures__/test.module.mjs +0 -17
- package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +0 -12
- package/dist/client/angular-beta/utils/BootstrapQueue.js +0 -86
- package/dist/client/angular-beta/utils/BootstrapQueue.mjs +0 -49
- package/dist/client/angular-beta/utils/BootstrapQueue.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/BootstrapQueue.test.js +0 -164
- package/dist/client/angular-beta/utils/BootstrapQueue.test.mjs +0 -162
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -22
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +0 -93
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.mjs +0 -84
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +0 -388
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.mjs +0 -386
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +0 -41
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.mjs +0 -37
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +0 -24
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.mjs +0 -22
- package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +0 -30
- package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -196
- package/dist/client/angular-beta/utils/PropertyExtractor.mjs +0 -158
- package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/PropertyExtractor.test.js +0 -177
- package/dist/client/angular-beta/utils/PropertyExtractor.test.mjs +0 -175
- package/dist/client/angular-beta/utils/StoryUID.d.ts +0 -22
- package/dist/client/angular-beta/utils/StoryUID.js +0 -43
- package/dist/client/angular-beta/utils/StoryUID.mjs +0 -38
- package/dist/client/argsToTemplate.d.ts +0 -56
- package/dist/client/argsToTemplate.js +0 -58
- package/dist/client/argsToTemplate.mjs +0 -55
- package/dist/client/argsToTemplate.test.d.ts +0 -1
- package/dist/client/argsToTemplate.test.js +0 -102
- package/dist/client/argsToTemplate.test.mjs +0 -100
- package/dist/client/compodoc-types.d.ts +0 -102
- package/dist/client/compodoc-types.js +0 -2
- package/dist/client/compodoc-types.mjs +0 -1
- package/dist/client/compodoc.d.ts +0 -12
- package/dist/client/compodoc.js +0 -261
- package/dist/client/compodoc.mjs +0 -248
- package/dist/client/compodoc.test.d.ts +0 -1
- package/dist/client/compodoc.test.js +0 -132
- package/dist/client/compodoc.test.mjs +0 -130
- package/dist/client/decorateStory.d.ts +0 -4
- package/dist/client/decorateStory.js +0 -48
- package/dist/client/decorateStory.mjs +0 -45
- package/dist/client/decorateStory.test.d.ts +0 -1
- package/dist/client/decorateStory.test.js +0 -306
- package/dist/client/decorateStory.test.mjs +0 -301
- package/dist/client/decorators.d.ts +0 -13
- package/dist/client/decorators.js +0 -69
- package/dist/client/decorators.mjs +0 -63
- package/dist/client/decorators.test.d.ts +0 -1
- package/dist/client/decorators.test.js +0 -159
- package/dist/client/decorators.test.mjs +0 -157
- package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +0 -110
- package/dist/client/docs/__testfixtures__/doc-button/input.js +0 -204
- package/dist/client/docs/__testfixtures__/doc-button/input.mjs +0 -201
- package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +0 -7
- package/dist/client/docs/angular-properties.test.d.ts +0 -1
- package/dist/client/docs/angular-properties.test.js +0 -36
- package/dist/client/docs/angular-properties.test.mjs +0 -34
- package/dist/client/docs/sourceDecorator.d.ts +0 -10
- package/dist/client/docs/sourceDecorator.js +0 -53
- package/dist/client/docs/sourceDecorator.mjs +0 -48
- package/dist/client/globals.d.ts +0 -1
- package/dist/client/globals.js +0 -33
- package/dist/client/globals.mjs +0 -31
- package/dist/client/portable-stories.d.ts +0 -23
- package/dist/client/portable-stories.js +0 -62
- package/dist/client/portable-stories.mjs +0 -26
- package/dist/client/public-types.d.ts +0 -54
- package/dist/client/public-types.js +0 -2
- package/dist/client/public-types.mjs +0 -1
- package/dist/client/render.d.ts +0 -7
- package/dist/client/render.js +0 -19
- package/dist/client/render.mjs +0 -14
- package/dist/client/types.js +0 -2
- package/dist/client/types.mjs +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.js +0 -6
- package/dist/node/index.mjs +0 -3
- package/dist/preset.d.ts +0 -5
- package/dist/preset.mjs +0 -34
- package/dist/renderer.d.ts +0 -6
- package/dist/renderer.js +0 -15
- package/dist/renderer.mjs +0 -6
- package/dist/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -4
- package/dist/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -18
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/some-config/angular.json +0 -19
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -64
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/with-lib/angular.json +0 -28
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -20
- package/dist/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/with-nx/angular.json +0 -18
- package/dist/server/__mocks-ng-workspace__/with-nx/nx.json +0 -3
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -8
- package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -14
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -3
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -8
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -14
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -18
- package/dist/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -18
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -5
- package/dist/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -11
- package/dist/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -7
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -3
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -20
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -16
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -13
- package/dist/server/__tests__/angular.json +0 -96
- package/dist/server/angular-cli-webpack.d.ts +0 -1
- package/dist/server/angular-cli-webpack.js +0 -80
- package/dist/server/angular-cli-webpack.mjs +0 -80
- package/dist/server/framework-preset-angular-cli.d.ts +0 -3
- package/dist/server/framework-preset-angular-cli.mjs +0 -81
- package/dist/server/framework-preset-angular-ivy.d.ts +0 -10
- package/dist/server/framework-preset-angular-ivy.mjs +0 -56
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +0 -12
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +0 -55
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.mjs +0 -52
- package/dist/server/preset-options.d.ts +0 -9
- package/dist/server/preset-options.js +0 -2
- package/dist/server/preset-options.mjs +0 -1
- package/dist/server/utils/filter-out-styling-rules.d.ts +0 -2
- package/dist/server/utils/filter-out-styling-rules.js +0 -17
- package/dist/server/utils/filter-out-styling-rules.mjs +0 -13
- package/dist/server/utils/module-is-available.d.ts +0 -1
- package/dist/server/utils/module-is-available.js +0 -13
- package/dist/server/utils/module-is-available.mjs +0 -9
- package/dist/test-setup.d.ts +0 -1
- package/dist/test-setup.js +0 -6
- package/dist/test-setup.mjs +0 -4
- package/dist/types.d.ts +0 -27
- package/dist/types.js +0 -2
- package/dist/types.mjs +0 -1
- package/scripts/postbuild.js +0 -17
- package/template/cli/.eslintrc.json +0 -5
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.InputComponent = exports.ButtonAccent = exports.exportedConstant = void 0;
|
|
13
|
-
const core_1 = require("@angular/core");
|
|
14
|
-
exports.exportedConstant = 'An exported constant';
|
|
15
|
-
var ButtonAccent;
|
|
16
|
-
(function (ButtonAccent) {
|
|
17
|
-
ButtonAccent["Normal"] = "Normal";
|
|
18
|
-
ButtonAccent["High"] = "High";
|
|
19
|
-
})(ButtonAccent || (exports.ButtonAccent = ButtonAccent = {}));
|
|
20
|
-
let InputComponent = class InputComponent {
|
|
21
|
-
constructor() {
|
|
22
|
-
/** Appearance style of the button. */
|
|
23
|
-
this.appearance = 'secondary';
|
|
24
|
-
/** Sets the button to a disabled state. */
|
|
25
|
-
this.isDisabled = false;
|
|
26
|
-
this.onClick = new core_1.EventEmitter();
|
|
27
|
-
this.dashOut = new core_1.EventEmitter();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.InputComponent = InputComponent;
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, core_1.Input)(),
|
|
33
|
-
__metadata("design:type", String)
|
|
34
|
-
], InputComponent.prototype, "appearance", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, core_1.Input)(),
|
|
37
|
-
__metadata("design:type", Number)
|
|
38
|
-
], InputComponent.prototype, "counter", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, core_1.Input)(),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], InputComponent.prototype, "accent", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, core_1.Input)('color'),
|
|
45
|
-
__metadata("design:type", String)
|
|
46
|
-
], InputComponent.prototype, "foregroundColor", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, core_1.Input)(),
|
|
49
|
-
__metadata("design:type", Object)
|
|
50
|
-
], InputComponent.prototype, "isDisabled", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
(0, core_1.Input)(),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], InputComponent.prototype, "label", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
(0, core_1.Input)('aria-label'),
|
|
57
|
-
__metadata("design:type", String)
|
|
58
|
-
], InputComponent.prototype, "ariaLabel", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
(0, core_1.Input)(),
|
|
61
|
-
__metadata("design:type", Object)
|
|
62
|
-
], InputComponent.prototype, "someDataObject", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, core_1.Output)(),
|
|
65
|
-
__metadata("design:type", Object)
|
|
66
|
-
], InputComponent.prototype, "onClick", void 0);
|
|
67
|
-
__decorate([
|
|
68
|
-
(0, core_1.Output)('dash-out'),
|
|
69
|
-
__metadata("design:type", Object)
|
|
70
|
-
], InputComponent.prototype, "dashOut", void 0);
|
|
71
|
-
exports.InputComponent = InputComponent = __decorate([
|
|
72
|
-
(0, core_1.Component)({
|
|
73
|
-
selector: 'doc-button',
|
|
74
|
-
template: '<button>{{ label }}</button>',
|
|
75
|
-
})
|
|
76
|
-
], InputComponent);
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
11
|
-
export const exportedConstant = 'An exported constant';
|
|
12
|
-
export var ButtonAccent;
|
|
13
|
-
(function (ButtonAccent) {
|
|
14
|
-
ButtonAccent["Normal"] = "Normal";
|
|
15
|
-
ButtonAccent["High"] = "High";
|
|
16
|
-
})(ButtonAccent || (ButtonAccent = {}));
|
|
17
|
-
let InputComponent = class InputComponent {
|
|
18
|
-
constructor() {
|
|
19
|
-
/** Appearance style of the button. */
|
|
20
|
-
this.appearance = 'secondary';
|
|
21
|
-
/** Sets the button to a disabled state. */
|
|
22
|
-
this.isDisabled = false;
|
|
23
|
-
this.onClick = new EventEmitter();
|
|
24
|
-
this.dashOut = new EventEmitter();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
__decorate([
|
|
28
|
-
Input(),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], InputComponent.prototype, "appearance", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
Input(),
|
|
33
|
-
__metadata("design:type", Number)
|
|
34
|
-
], InputComponent.prototype, "counter", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
Input(),
|
|
37
|
-
__metadata("design:type", String)
|
|
38
|
-
], InputComponent.prototype, "accent", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
Input('color'),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], InputComponent.prototype, "foregroundColor", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
Input(),
|
|
45
|
-
__metadata("design:type", Object)
|
|
46
|
-
], InputComponent.prototype, "isDisabled", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
Input(),
|
|
49
|
-
__metadata("design:type", String)
|
|
50
|
-
], InputComponent.prototype, "label", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
Input('aria-label'),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], InputComponent.prototype, "ariaLabel", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
Input(),
|
|
57
|
-
__metadata("design:type", Object)
|
|
58
|
-
], InputComponent.prototype, "someDataObject", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
Output(),
|
|
61
|
-
__metadata("design:type", Object)
|
|
62
|
-
], InputComponent.prototype, "onClick", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
Output('dash-out'),
|
|
65
|
-
__metadata("design:type", Object)
|
|
66
|
-
], InputComponent.prototype, "dashOut", void 0);
|
|
67
|
-
InputComponent = __decorate([
|
|
68
|
-
Component({
|
|
69
|
-
selector: 'doc-button',
|
|
70
|
-
template: '<button>{{ label }}</button>',
|
|
71
|
-
})
|
|
72
|
-
], InputComponent);
|
|
73
|
-
export { InputComponent };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.WithOfficialModule = void 0;
|
|
10
|
-
const common_1 = require("@angular/common");
|
|
11
|
-
const http_1 = require("@angular/common/http");
|
|
12
|
-
const core_1 = require("@angular/core");
|
|
13
|
-
let WithOfficialModule = class WithOfficialModule {
|
|
14
|
-
};
|
|
15
|
-
exports.WithOfficialModule = WithOfficialModule;
|
|
16
|
-
exports.WithOfficialModule = WithOfficialModule = __decorate([
|
|
17
|
-
(0, core_1.NgModule)({
|
|
18
|
-
imports: [common_1.CommonModule, http_1.HttpClientModule],
|
|
19
|
-
})
|
|
20
|
-
], WithOfficialModule);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { CommonModule } from '@angular/common';
|
|
8
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
9
|
-
import { NgModule } from '@angular/core';
|
|
10
|
-
let WithOfficialModule = class WithOfficialModule {
|
|
11
|
-
};
|
|
12
|
-
WithOfficialModule = __decorate([
|
|
13
|
-
NgModule({
|
|
14
|
-
imports: [CommonModule, HttpClientModule],
|
|
15
|
-
})
|
|
16
|
-
], WithOfficialModule);
|
|
17
|
-
export { WithOfficialModule };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ApplicationRef } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Queue bootstrapping, so that only one application can be bootstrapped at a time.
|
|
4
|
-
*
|
|
5
|
-
* Bootstrapping multiple applications at once can cause Angular to throw an error that a component
|
|
6
|
-
* is declared in multiple modules. This avoids two stories confusing the Angular compiler, by
|
|
7
|
-
* bootstrapping more that one application at a time.
|
|
8
|
-
*
|
|
9
|
-
* @param fn Callback that should complete the bootstrap process
|
|
10
|
-
* @returns ApplicationRef from the completed bootstrap process
|
|
11
|
-
*/
|
|
12
|
-
export declare const queueBootstrapping: (fn: () => Promise<ApplicationRef>) => Promise<ApplicationRef>;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.queueBootstrapping = void 0;
|
|
37
|
-
const queue = [];
|
|
38
|
-
let isProcessing = false;
|
|
39
|
-
/**
|
|
40
|
-
* Reset compiled components because we often want to compile the same component with more than one
|
|
41
|
-
* NgModule.
|
|
42
|
-
*/
|
|
43
|
-
const resetCompiledComponents = async () => {
|
|
44
|
-
try {
|
|
45
|
-
// Clear global Angular component cache in order to be able to re-render the same component across multiple stories
|
|
46
|
-
//
|
|
47
|
-
// References:
|
|
48
|
-
// https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/webpack/plugins/hmr/hmr-accept.ts#L50
|
|
49
|
-
// https://github.com/angular/angular/blob/2ebe2bcb2fe19bf672316b05f15241fd7fd40803/packages/core/src/render3/jit/module.ts#L377-L384
|
|
50
|
-
const { ɵresetCompiledComponents } = await Promise.resolve().then(() => __importStar(require('@angular/core')));
|
|
51
|
-
ɵresetCompiledComponents();
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
/** Noop catch This means angular removed or modified ɵresetCompiledComponents */
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Queue bootstrapping, so that only one application can be bootstrapped at a time.
|
|
59
|
-
*
|
|
60
|
-
* Bootstrapping multiple applications at once can cause Angular to throw an error that a component
|
|
61
|
-
* is declared in multiple modules. This avoids two stories confusing the Angular compiler, by
|
|
62
|
-
* bootstrapping more that one application at a time.
|
|
63
|
-
*
|
|
64
|
-
* @param fn Callback that should complete the bootstrap process
|
|
65
|
-
* @returns ApplicationRef from the completed bootstrap process
|
|
66
|
-
*/
|
|
67
|
-
const queueBootstrapping = (fn) => {
|
|
68
|
-
return new Promise((resolve, reject) => {
|
|
69
|
-
queue.push(() => fn().then(resolve).catch(reject));
|
|
70
|
-
if (!isProcessing) {
|
|
71
|
-
processQueue();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
exports.queueBootstrapping = queueBootstrapping;
|
|
76
|
-
const processQueue = async () => {
|
|
77
|
-
isProcessing = true;
|
|
78
|
-
while (queue.length > 0) {
|
|
79
|
-
const bootstrappingFn = queue.shift();
|
|
80
|
-
if (bootstrappingFn) {
|
|
81
|
-
await bootstrappingFn();
|
|
82
|
-
await resetCompiledComponents();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
isProcessing = false;
|
|
86
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const queue = [];
|
|
2
|
-
let isProcessing = false;
|
|
3
|
-
/**
|
|
4
|
-
* Reset compiled components because we often want to compile the same component with more than one
|
|
5
|
-
* NgModule.
|
|
6
|
-
*/
|
|
7
|
-
const resetCompiledComponents = async () => {
|
|
8
|
-
try {
|
|
9
|
-
// Clear global Angular component cache in order to be able to re-render the same component across multiple stories
|
|
10
|
-
//
|
|
11
|
-
// References:
|
|
12
|
-
// https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/webpack/plugins/hmr/hmr-accept.ts#L50
|
|
13
|
-
// https://github.com/angular/angular/blob/2ebe2bcb2fe19bf672316b05f15241fd7fd40803/packages/core/src/render3/jit/module.ts#L377-L384
|
|
14
|
-
const { ɵresetCompiledComponents } = await import('@angular/core');
|
|
15
|
-
ɵresetCompiledComponents();
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
/** Noop catch This means angular removed or modified ɵresetCompiledComponents */
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Queue bootstrapping, so that only one application can be bootstrapped at a time.
|
|
23
|
-
*
|
|
24
|
-
* Bootstrapping multiple applications at once can cause Angular to throw an error that a component
|
|
25
|
-
* is declared in multiple modules. This avoids two stories confusing the Angular compiler, by
|
|
26
|
-
* bootstrapping more that one application at a time.
|
|
27
|
-
*
|
|
28
|
-
* @param fn Callback that should complete the bootstrap process
|
|
29
|
-
* @returns ApplicationRef from the completed bootstrap process
|
|
30
|
-
*/
|
|
31
|
-
export const queueBootstrapping = (fn) => {
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
queue.push(() => fn().then(resolve).catch(reject));
|
|
34
|
-
if (!isProcessing) {
|
|
35
|
-
processQueue();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
const processQueue = async () => {
|
|
40
|
-
isProcessing = true;
|
|
41
|
-
while (queue.length > 0) {
|
|
42
|
-
const bootstrappingFn = queue.shift();
|
|
43
|
-
if (bootstrappingFn) {
|
|
44
|
-
await bootstrappingFn();
|
|
45
|
-
await resetCompiledComponents();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
isProcessing = false;
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// @vitest-environment happy-dom
|
|
4
|
-
const vitest_1 = require("vitest");
|
|
5
|
-
const rxjs_1 = require("rxjs");
|
|
6
|
-
const BootstrapQueue_1 = require("./BootstrapQueue");
|
|
7
|
-
const instantWaitFor = (fn) => {
|
|
8
|
-
return vitest_1.vi.waitFor(fn, {
|
|
9
|
-
interval: 0,
|
|
10
|
-
timeout: 10000,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
(0, vitest_1.describe)('BootstrapQueue', { retry: 3 }, () => {
|
|
14
|
-
(0, vitest_1.beforeEach)(async () => {
|
|
15
|
-
vitest_1.vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
16
|
-
});
|
|
17
|
-
(0, vitest_1.afterEach)(() => {
|
|
18
|
-
vitest_1.vi.clearAllMocks();
|
|
19
|
-
});
|
|
20
|
-
(0, vitest_1.it)('@flaky should wait until complete', async () => {
|
|
21
|
-
const pendingSubject = new rxjs_1.Subject();
|
|
22
|
-
const bootstrapApp = vitest_1.vi.fn().mockImplementation(async () => {
|
|
23
|
-
return (0, rxjs_1.lastValueFrom)(pendingSubject);
|
|
24
|
-
});
|
|
25
|
-
const bootstrapAppFinished = vitest_1.vi.fn();
|
|
26
|
-
(0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp).then(() => {
|
|
27
|
-
bootstrapAppFinished();
|
|
28
|
-
});
|
|
29
|
-
await instantWaitFor(() => {
|
|
30
|
-
if (bootstrapApp.mock.calls.length !== 1) {
|
|
31
|
-
throw new Error('bootstrapApp should not have been called yet');
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveBeenCalled();
|
|
35
|
-
(0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
36
|
-
pendingSubject.next();
|
|
37
|
-
pendingSubject.complete();
|
|
38
|
-
await instantWaitFor(() => {
|
|
39
|
-
if (bootstrapAppFinished.mock.calls.length !== 1) {
|
|
40
|
-
throw new Error('bootstrapApp should have been called once');
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
(0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
|
|
44
|
-
});
|
|
45
|
-
(0, vitest_1.it)('should prevent following tasks, until the preview tasks are complete', async () => {
|
|
46
|
-
const pendingSubject = new rxjs_1.Subject();
|
|
47
|
-
const bootstrapApp = vitest_1.vi.fn().mockImplementation(async () => {
|
|
48
|
-
return (0, rxjs_1.lastValueFrom)(pendingSubject);
|
|
49
|
-
});
|
|
50
|
-
const bootstrapAppFinished = vitest_1.vi.fn();
|
|
51
|
-
const pendingSubject2 = new rxjs_1.Subject();
|
|
52
|
-
const bootstrapApp2 = vitest_1.vi.fn().mockImplementation(async () => {
|
|
53
|
-
return (0, rxjs_1.lastValueFrom)(pendingSubject2);
|
|
54
|
-
});
|
|
55
|
-
const bootstrapAppFinished2 = vitest_1.vi.fn();
|
|
56
|
-
const pendingSubject3 = new rxjs_1.Subject();
|
|
57
|
-
const bootstrapApp3 = vitest_1.vi.fn().mockImplementation(async () => {
|
|
58
|
-
return (0, rxjs_1.lastValueFrom)(pendingSubject3);
|
|
59
|
-
});
|
|
60
|
-
const bootstrapAppFinished3 = vitest_1.vi.fn();
|
|
61
|
-
(0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp).then(bootstrapAppFinished);
|
|
62
|
-
(0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp2).then(bootstrapAppFinished2);
|
|
63
|
-
(0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp3).then(bootstrapAppFinished3);
|
|
64
|
-
await instantWaitFor(() => {
|
|
65
|
-
if (bootstrapApp.mock.calls.length !== 1) {
|
|
66
|
-
throw new Error('bootstrapApp should have been called once');
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveBeenCalled();
|
|
70
|
-
(0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
71
|
-
(0, vitest_1.expect)(bootstrapApp2).not.toHaveBeenCalled();
|
|
72
|
-
(0, vitest_1.expect)(bootstrapAppFinished2).not.toHaveBeenCalled();
|
|
73
|
-
(0, vitest_1.expect)(bootstrapApp3).not.toHaveBeenCalled();
|
|
74
|
-
(0, vitest_1.expect)(bootstrapAppFinished3).not.toHaveBeenCalled();
|
|
75
|
-
pendingSubject.next();
|
|
76
|
-
pendingSubject.complete();
|
|
77
|
-
await instantWaitFor(() => {
|
|
78
|
-
if (bootstrapApp2.mock.calls.length !== 1) {
|
|
79
|
-
throw new Error('bootstrapApp2 should have been called once');
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveReturnedTimes(1);
|
|
83
|
-
(0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
|
|
84
|
-
(0, vitest_1.expect)(bootstrapApp2).toHaveBeenCalled();
|
|
85
|
-
(0, vitest_1.expect)(bootstrapAppFinished2).not.toHaveBeenCalled();
|
|
86
|
-
(0, vitest_1.expect)(bootstrapApp3).not.toHaveBeenCalled();
|
|
87
|
-
(0, vitest_1.expect)(bootstrapAppFinished3).not.toHaveBeenCalled();
|
|
88
|
-
pendingSubject2.next();
|
|
89
|
-
pendingSubject2.complete();
|
|
90
|
-
await instantWaitFor(() => {
|
|
91
|
-
if (bootstrapApp3.mock.calls.length !== 1) {
|
|
92
|
-
throw new Error('bootstrapApp3 should have been called once');
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveReturnedTimes(1);
|
|
96
|
-
(0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
|
|
97
|
-
(0, vitest_1.expect)(bootstrapApp2).toHaveReturnedTimes(1);
|
|
98
|
-
(0, vitest_1.expect)(bootstrapAppFinished2).toHaveBeenCalled();
|
|
99
|
-
(0, vitest_1.expect)(bootstrapApp3).toHaveBeenCalled();
|
|
100
|
-
(0, vitest_1.expect)(bootstrapAppFinished3).not.toHaveBeenCalled();
|
|
101
|
-
pendingSubject3.next();
|
|
102
|
-
pendingSubject3.complete();
|
|
103
|
-
await instantWaitFor(() => {
|
|
104
|
-
if (bootstrapAppFinished3.mock.calls.length !== 1) {
|
|
105
|
-
throw new Error('bootstrapAppFinished3 should have been called once');
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveReturnedTimes(1);
|
|
109
|
-
(0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
|
|
110
|
-
(0, vitest_1.expect)(bootstrapApp2).toHaveReturnedTimes(1);
|
|
111
|
-
(0, vitest_1.expect)(bootstrapAppFinished2).toHaveBeenCalled();
|
|
112
|
-
(0, vitest_1.expect)(bootstrapApp3).toHaveReturnedTimes(1);
|
|
113
|
-
(0, vitest_1.expect)(bootstrapAppFinished3).toHaveBeenCalled();
|
|
114
|
-
});
|
|
115
|
-
(0, vitest_1.it)('should throw and continue next bootstrap on error', async () => {
|
|
116
|
-
const pendingSubject = new rxjs_1.Subject();
|
|
117
|
-
const bootstrapApp = vitest_1.vi.fn().mockImplementation(async () => {
|
|
118
|
-
return (0, rxjs_1.lastValueFrom)(pendingSubject);
|
|
119
|
-
});
|
|
120
|
-
const bootstrapAppFinished = vitest_1.vi.fn();
|
|
121
|
-
const bootstrapAppError = vitest_1.vi.fn();
|
|
122
|
-
const pendingSubject2 = new rxjs_1.Subject();
|
|
123
|
-
const bootstrapApp2 = vitest_1.vi.fn().mockImplementation(async () => {
|
|
124
|
-
return (0, rxjs_1.lastValueFrom)(pendingSubject2);
|
|
125
|
-
});
|
|
126
|
-
const bootstrapAppFinished2 = vitest_1.vi.fn();
|
|
127
|
-
const bootstrapAppError2 = vitest_1.vi.fn();
|
|
128
|
-
(0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp).then(bootstrapAppFinished).catch(bootstrapAppError);
|
|
129
|
-
(0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp2).then(bootstrapAppFinished2).catch(bootstrapAppError2);
|
|
130
|
-
await instantWaitFor(() => {
|
|
131
|
-
if (bootstrapApp.mock.calls.length !== 1) {
|
|
132
|
-
throw new Error('bootstrapApp should have been called once');
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveBeenCalledTimes(1);
|
|
136
|
-
(0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
137
|
-
(0, vitest_1.expect)(bootstrapApp2).not.toHaveBeenCalled();
|
|
138
|
-
pendingSubject.error(new Error('test error'));
|
|
139
|
-
await instantWaitFor(() => {
|
|
140
|
-
if (bootstrapAppError.mock.calls.length !== 1) {
|
|
141
|
-
throw new Error('bootstrapAppError should have been called once');
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveBeenCalledTimes(1);
|
|
145
|
-
(0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
146
|
-
(0, vitest_1.expect)(bootstrapAppError).toHaveBeenCalledTimes(1);
|
|
147
|
-
(0, vitest_1.expect)(bootstrapApp2).toHaveBeenCalledTimes(1);
|
|
148
|
-
(0, vitest_1.expect)(bootstrapAppFinished2).not.toHaveBeenCalled();
|
|
149
|
-
(0, vitest_1.expect)(bootstrapAppError2).not.toHaveBeenCalled();
|
|
150
|
-
pendingSubject2.next();
|
|
151
|
-
pendingSubject2.complete();
|
|
152
|
-
await instantWaitFor(() => {
|
|
153
|
-
if (bootstrapAppFinished2.mock.calls.length !== 1) {
|
|
154
|
-
throw new Error('bootstrapAppFinished2 should have been called once');
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
(0, vitest_1.expect)(bootstrapApp).toHaveBeenCalledTimes(1);
|
|
158
|
-
(0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
159
|
-
(0, vitest_1.expect)(bootstrapAppError).toHaveBeenCalledTimes(1);
|
|
160
|
-
(0, vitest_1.expect)(bootstrapApp2).toHaveBeenCalledTimes(1);
|
|
161
|
-
(0, vitest_1.expect)(bootstrapAppFinished2).toHaveBeenCalledTimes(1);
|
|
162
|
-
(0, vitest_1.expect)(bootstrapAppError2).not.toHaveBeenCalled();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
// @vitest-environment happy-dom
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { Subject, lastValueFrom } from 'rxjs';
|
|
4
|
-
import { queueBootstrapping } from './BootstrapQueue';
|
|
5
|
-
const instantWaitFor = (fn) => {
|
|
6
|
-
return vi.waitFor(fn, {
|
|
7
|
-
interval: 0,
|
|
8
|
-
timeout: 10000,
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
describe('BootstrapQueue', { retry: 3 }, () => {
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
14
|
-
});
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
vi.clearAllMocks();
|
|
17
|
-
});
|
|
18
|
-
it('@flaky should wait until complete', async () => {
|
|
19
|
-
const pendingSubject = new Subject();
|
|
20
|
-
const bootstrapApp = vi.fn().mockImplementation(async () => {
|
|
21
|
-
return lastValueFrom(pendingSubject);
|
|
22
|
-
});
|
|
23
|
-
const bootstrapAppFinished = vi.fn();
|
|
24
|
-
queueBootstrapping(bootstrapApp).then(() => {
|
|
25
|
-
bootstrapAppFinished();
|
|
26
|
-
});
|
|
27
|
-
await instantWaitFor(() => {
|
|
28
|
-
if (bootstrapApp.mock.calls.length !== 1) {
|
|
29
|
-
throw new Error('bootstrapApp should not have been called yet');
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
expect(bootstrapApp).toHaveBeenCalled();
|
|
33
|
-
expect(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
34
|
-
pendingSubject.next();
|
|
35
|
-
pendingSubject.complete();
|
|
36
|
-
await instantWaitFor(() => {
|
|
37
|
-
if (bootstrapAppFinished.mock.calls.length !== 1) {
|
|
38
|
-
throw new Error('bootstrapApp should have been called once');
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
expect(bootstrapAppFinished).toHaveBeenCalled();
|
|
42
|
-
});
|
|
43
|
-
it('should prevent following tasks, until the preview tasks are complete', async () => {
|
|
44
|
-
const pendingSubject = new Subject();
|
|
45
|
-
const bootstrapApp = vi.fn().mockImplementation(async () => {
|
|
46
|
-
return lastValueFrom(pendingSubject);
|
|
47
|
-
});
|
|
48
|
-
const bootstrapAppFinished = vi.fn();
|
|
49
|
-
const pendingSubject2 = new Subject();
|
|
50
|
-
const bootstrapApp2 = vi.fn().mockImplementation(async () => {
|
|
51
|
-
return lastValueFrom(pendingSubject2);
|
|
52
|
-
});
|
|
53
|
-
const bootstrapAppFinished2 = vi.fn();
|
|
54
|
-
const pendingSubject3 = new Subject();
|
|
55
|
-
const bootstrapApp3 = vi.fn().mockImplementation(async () => {
|
|
56
|
-
return lastValueFrom(pendingSubject3);
|
|
57
|
-
});
|
|
58
|
-
const bootstrapAppFinished3 = vi.fn();
|
|
59
|
-
queueBootstrapping(bootstrapApp).then(bootstrapAppFinished);
|
|
60
|
-
queueBootstrapping(bootstrapApp2).then(bootstrapAppFinished2);
|
|
61
|
-
queueBootstrapping(bootstrapApp3).then(bootstrapAppFinished3);
|
|
62
|
-
await instantWaitFor(() => {
|
|
63
|
-
if (bootstrapApp.mock.calls.length !== 1) {
|
|
64
|
-
throw new Error('bootstrapApp should have been called once');
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
expect(bootstrapApp).toHaveBeenCalled();
|
|
68
|
-
expect(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
69
|
-
expect(bootstrapApp2).not.toHaveBeenCalled();
|
|
70
|
-
expect(bootstrapAppFinished2).not.toHaveBeenCalled();
|
|
71
|
-
expect(bootstrapApp3).not.toHaveBeenCalled();
|
|
72
|
-
expect(bootstrapAppFinished3).not.toHaveBeenCalled();
|
|
73
|
-
pendingSubject.next();
|
|
74
|
-
pendingSubject.complete();
|
|
75
|
-
await instantWaitFor(() => {
|
|
76
|
-
if (bootstrapApp2.mock.calls.length !== 1) {
|
|
77
|
-
throw new Error('bootstrapApp2 should have been called once');
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
expect(bootstrapApp).toHaveReturnedTimes(1);
|
|
81
|
-
expect(bootstrapAppFinished).toHaveBeenCalled();
|
|
82
|
-
expect(bootstrapApp2).toHaveBeenCalled();
|
|
83
|
-
expect(bootstrapAppFinished2).not.toHaveBeenCalled();
|
|
84
|
-
expect(bootstrapApp3).not.toHaveBeenCalled();
|
|
85
|
-
expect(bootstrapAppFinished3).not.toHaveBeenCalled();
|
|
86
|
-
pendingSubject2.next();
|
|
87
|
-
pendingSubject2.complete();
|
|
88
|
-
await instantWaitFor(() => {
|
|
89
|
-
if (bootstrapApp3.mock.calls.length !== 1) {
|
|
90
|
-
throw new Error('bootstrapApp3 should have been called once');
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
expect(bootstrapApp).toHaveReturnedTimes(1);
|
|
94
|
-
expect(bootstrapAppFinished).toHaveBeenCalled();
|
|
95
|
-
expect(bootstrapApp2).toHaveReturnedTimes(1);
|
|
96
|
-
expect(bootstrapAppFinished2).toHaveBeenCalled();
|
|
97
|
-
expect(bootstrapApp3).toHaveBeenCalled();
|
|
98
|
-
expect(bootstrapAppFinished3).not.toHaveBeenCalled();
|
|
99
|
-
pendingSubject3.next();
|
|
100
|
-
pendingSubject3.complete();
|
|
101
|
-
await instantWaitFor(() => {
|
|
102
|
-
if (bootstrapAppFinished3.mock.calls.length !== 1) {
|
|
103
|
-
throw new Error('bootstrapAppFinished3 should have been called once');
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
expect(bootstrapApp).toHaveReturnedTimes(1);
|
|
107
|
-
expect(bootstrapAppFinished).toHaveBeenCalled();
|
|
108
|
-
expect(bootstrapApp2).toHaveReturnedTimes(1);
|
|
109
|
-
expect(bootstrapAppFinished2).toHaveBeenCalled();
|
|
110
|
-
expect(bootstrapApp3).toHaveReturnedTimes(1);
|
|
111
|
-
expect(bootstrapAppFinished3).toHaveBeenCalled();
|
|
112
|
-
});
|
|
113
|
-
it('should throw and continue next bootstrap on error', async () => {
|
|
114
|
-
const pendingSubject = new Subject();
|
|
115
|
-
const bootstrapApp = vi.fn().mockImplementation(async () => {
|
|
116
|
-
return lastValueFrom(pendingSubject);
|
|
117
|
-
});
|
|
118
|
-
const bootstrapAppFinished = vi.fn();
|
|
119
|
-
const bootstrapAppError = vi.fn();
|
|
120
|
-
const pendingSubject2 = new Subject();
|
|
121
|
-
const bootstrapApp2 = vi.fn().mockImplementation(async () => {
|
|
122
|
-
return lastValueFrom(pendingSubject2);
|
|
123
|
-
});
|
|
124
|
-
const bootstrapAppFinished2 = vi.fn();
|
|
125
|
-
const bootstrapAppError2 = vi.fn();
|
|
126
|
-
queueBootstrapping(bootstrapApp).then(bootstrapAppFinished).catch(bootstrapAppError);
|
|
127
|
-
queueBootstrapping(bootstrapApp2).then(bootstrapAppFinished2).catch(bootstrapAppError2);
|
|
128
|
-
await instantWaitFor(() => {
|
|
129
|
-
if (bootstrapApp.mock.calls.length !== 1) {
|
|
130
|
-
throw new Error('bootstrapApp should have been called once');
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
expect(bootstrapApp).toHaveBeenCalledTimes(1);
|
|
134
|
-
expect(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
135
|
-
expect(bootstrapApp2).not.toHaveBeenCalled();
|
|
136
|
-
pendingSubject.error(new Error('test error'));
|
|
137
|
-
await instantWaitFor(() => {
|
|
138
|
-
if (bootstrapAppError.mock.calls.length !== 1) {
|
|
139
|
-
throw new Error('bootstrapAppError should have been called once');
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
expect(bootstrapApp).toHaveBeenCalledTimes(1);
|
|
143
|
-
expect(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
144
|
-
expect(bootstrapAppError).toHaveBeenCalledTimes(1);
|
|
145
|
-
expect(bootstrapApp2).toHaveBeenCalledTimes(1);
|
|
146
|
-
expect(bootstrapAppFinished2).not.toHaveBeenCalled();
|
|
147
|
-
expect(bootstrapAppError2).not.toHaveBeenCalled();
|
|
148
|
-
pendingSubject2.next();
|
|
149
|
-
pendingSubject2.complete();
|
|
150
|
-
await instantWaitFor(() => {
|
|
151
|
-
if (bootstrapAppFinished2.mock.calls.length !== 1) {
|
|
152
|
-
throw new Error('bootstrapAppFinished2 should have been called once');
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
expect(bootstrapApp).toHaveBeenCalledTimes(1);
|
|
156
|
-
expect(bootstrapAppFinished).not.toHaveBeenCalled();
|
|
157
|
-
expect(bootstrapAppError).toHaveBeenCalledTimes(1);
|
|
158
|
-
expect(bootstrapApp2).toHaveBeenCalledTimes(1);
|
|
159
|
-
expect(bootstrapAppFinished2).toHaveBeenCalledTimes(1);
|
|
160
|
-
expect(bootstrapAppError2).not.toHaveBeenCalled();
|
|
161
|
-
});
|
|
162
|
-
});
|