@ngxs/store 3.7.2 → 3.7.3

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.
Files changed (32) hide show
  1. package/bundles/ngxs-store-internals-testing.umd.js +455 -0
  2. package/bundles/ngxs-store-internals-testing.umd.js.map +1 -0
  3. package/bundles/ngxs-store-internals-testing.umd.min.js +16 -0
  4. package/bundles/ngxs-store-internals-testing.umd.min.js.map +1 -0
  5. package/esm2015/internals/testing/fresh-platform.js +71 -0
  6. package/esm2015/internals/testing/helpers/ngxs-test.component.js +22 -0
  7. package/esm2015/internals/testing/helpers/ngxs-test.module.js +24 -0
  8. package/esm2015/internals/testing/index.js +7 -0
  9. package/esm2015/internals/testing/ngxs-store-internals-testing.js +9 -0
  10. package/esm2015/internals/testing/ngxs.setup.js +76 -0
  11. package/esm2015/internals/testing/symbol.js +29 -0
  12. package/esm5/internals/testing/fresh-platform.js +81 -0
  13. package/esm5/internals/testing/helpers/ngxs-test.component.js +32 -0
  14. package/esm5/internals/testing/helpers/ngxs-test.module.js +32 -0
  15. package/esm5/internals/testing/index.js +7 -0
  16. package/esm5/internals/testing/ngxs-store-internals-testing.js +9 -0
  17. package/esm5/internals/testing/ngxs.setup.js +98 -0
  18. package/esm5/internals/testing/symbol.js +29 -0
  19. package/fesm2015/ngxs-store-internals-testing.js +197 -0
  20. package/fesm2015/ngxs-store-internals-testing.js.map +1 -0
  21. package/fesm5/ngxs-store-internals-testing.js +243 -0
  22. package/fesm5/ngxs-store-internals-testing.js.map +1 -0
  23. package/internals/testing/fresh-platform.d.ts +1 -0
  24. package/internals/testing/helpers/ngxs-test.component.d.ts +5 -0
  25. package/internals/testing/helpers/ngxs-test.module.d.ts +4 -0
  26. package/internals/testing/index.d.ts +3 -0
  27. package/internals/testing/ngxs-store-internals-testing.d.ts +4 -0
  28. package/internals/testing/ngxs-store-internals-testing.metadata.json +1 -0
  29. package/internals/testing/ngxs.setup.d.ts +7 -0
  30. package/internals/testing/package.json +13 -0
  31. package/internals/testing/symbol.d.ts +14 -0
  32. package/package.json +2 -2
@@ -0,0 +1,197 @@
1
+ import { Component, NgModule, ApplicationRef, destroyPlatform, createPlatform } from '@angular/core';
2
+ import { TestBed } from '@angular/core/testing';
3
+ import { DOCUMENT } from '@angular/common';
4
+ import { BrowserModule, ɵBrowserDomAdapter, ɵgetDOM } from '@angular/platform-browser';
5
+ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
6
+ import { NgxsModule, Store } from '@ngxs/store';
7
+ import { __awaiter } from 'tslib';
8
+
9
+ /**
10
+ * @fileoverview added by tsickle
11
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
12
+ */
13
+ class NgxsTestComponent {
14
+ /**
15
+ * @return {?}
16
+ */
17
+ ngOnInit() { }
18
+ /**
19
+ * @return {?}
20
+ */
21
+ ngAfterViewInit() { }
22
+ }
23
+ NgxsTestComponent.decorators = [
24
+ { type: Component, args: [{
25
+ selector: 'app-root',
26
+ template: ''
27
+ }] }
28
+ ];
29
+
30
+ /**
31
+ * @fileoverview added by tsickle
32
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
33
+ */
34
+ class NgxsTestModule {
35
+ /**
36
+ * @param {?} app
37
+ * @return {?}
38
+ */
39
+ static ngDoBootstrap(app) {
40
+ app.bootstrap(NgxsTestComponent);
41
+ }
42
+ }
43
+ NgxsTestModule.decorators = [
44
+ { type: NgModule, args: [{
45
+ imports: [BrowserModule],
46
+ declarations: [NgxsTestComponent],
47
+ entryComponents: [NgxsTestComponent]
48
+ },] }
49
+ ];
50
+
51
+ /**
52
+ * @fileoverview added by tsickle
53
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
54
+ */
55
+ class NgxsTestBed {
56
+ /**
57
+ * @param {?} options
58
+ * @return {?}
59
+ */
60
+ static configureTestingStates(options) {
61
+ this.resetTestBed();
62
+ if (options.before) {
63
+ options.before();
64
+ }
65
+ TestBed.configureTestingModule({
66
+ imports: [
67
+ NgxsTestModule,
68
+ NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),
69
+ ...(options.imports || [])
70
+ ]
71
+ }).compileComponents();
72
+ NgxsTestBed.ngxsBootstrap();
73
+ return {
74
+ /**
75
+ * @return {?}
76
+ */
77
+ get store() {
78
+ return TestBed.inject(Store);
79
+ },
80
+ /**
81
+ * @return {?}
82
+ */
83
+ get getTestBed() {
84
+ return TestBed;
85
+ }
86
+ };
87
+ }
88
+ /**
89
+ * @private
90
+ * @return {?}
91
+ */
92
+ static ngxsBootstrap() {
93
+ NgxsTestBed.createRootNode();
94
+ NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));
95
+ }
96
+ /**
97
+ * @private
98
+ * @return {?}
99
+ */
100
+ static resetTestBed() {
101
+ TestBed.resetTestEnvironment();
102
+ TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
103
+ }
104
+ /**
105
+ * @private
106
+ * @param {?=} selector
107
+ * @return {?}
108
+ */
109
+ static createRootNode(selector = 'app-root') {
110
+ /** @type {?} */
111
+ const document = TestBed.inject(DOCUMENT);
112
+ /** @type {?} */
113
+ const adapter = new ɵBrowserDomAdapter();
114
+ /** @type {?} */
115
+ const root = adapter.createElement(selector);
116
+ document.body.appendChild(root);
117
+ }
118
+ }
119
+
120
+ /**
121
+ * @fileoverview added by tsickle
122
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
123
+ */
124
+ /**
125
+ * @return {?}
126
+ */
127
+ function createRootElement() {
128
+ /** @type {?} */
129
+ const document = TestBed.inject(DOCUMENT);
130
+ /** @type {?} */
131
+ const root = ɵgetDOM().createElement('app-root', document);
132
+ document.body.appendChild(root);
133
+ }
134
+ /**
135
+ * @return {?}
136
+ */
137
+ function removeRootElement() {
138
+ /** @type {?} */
139
+ const root = (/** @type {?} */ (document.getElementsByTagName('app-root').item(0)));
140
+ try {
141
+ document.body.removeChild(root);
142
+ }
143
+ catch (_a) { }
144
+ }
145
+ /**
146
+ * @return {?}
147
+ */
148
+ function destroyPlatformBeforeBootstrappingTheNewOne() {
149
+ destroyPlatform();
150
+ createRootElement();
151
+ }
152
+ // As we create our custom platform via `bootstrapModule`
153
+ // we have to destroy it after assetions and revert
154
+ // the previous one
155
+ /**
156
+ * @return {?}
157
+ */
158
+ function resetPlatformAfterBootstrapping() {
159
+ removeRootElement();
160
+ destroyPlatform();
161
+ createPlatform(TestBed);
162
+ }
163
+ /**
164
+ * @param {?} fn
165
+ * @return {?}
166
+ */
167
+ function freshPlatform(fn) {
168
+ return (/**
169
+ * @this {?}
170
+ * @param {...?} args
171
+ * @return {?}
172
+ */
173
+ function testWithAFreshPlatform(...args) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ try {
176
+ destroyPlatformBeforeBootstrappingTheNewOne();
177
+ return yield fn.apply(this, args);
178
+ }
179
+ finally {
180
+ resetPlatformAfterBootstrapping();
181
+ }
182
+ });
183
+ });
184
+ }
185
+
186
+ /**
187
+ * @fileoverview added by tsickle
188
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
189
+ */
190
+
191
+ /**
192
+ * @fileoverview added by tsickle
193
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
194
+ */
195
+
196
+ export { NgxsTestBed, freshPlatform };
197
+ //# sourceMappingURL=ngxs-store-internals-testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n template: ''\r\n})\r\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\r\n public ngOnInit(): void {}\r\n public ngAfterViewInit(): void {}\r\n}\r\n","import { ApplicationRef, NgModule } from '@angular/core';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\n\r\nimport { NgxsTestComponent } from './ngxs-test.component';\r\n\r\n@NgModule({\r\n imports: [BrowserModule],\r\n declarations: [NgxsTestComponent],\r\n entryComponents: [NgxsTestComponent]\r\n})\r\nexport class NgxsTestModule {\r\n public static ngDoBootstrap(app: ApplicationRef): void {\r\n app.bootstrap(NgxsTestComponent);\r\n }\r\n}\r\n","import { ApplicationRef } from '@angular/core';\r\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\r\nimport {\r\n BrowserDynamicTestingModule,\r\n platformBrowserDynamicTesting\r\n} from '@angular/platform-browser-dynamic/testing';\r\nimport { NgxsModule, Store } from '@ngxs/store';\r\n\r\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\r\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\r\n\r\nexport class NgxsTestBed {\r\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\r\n this.resetTestBed();\r\n\r\n if (options.before) {\r\n options.before();\r\n }\r\n\r\n TestBed.configureTestingModule({\r\n imports: [\r\n NgxsTestModule,\r\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\r\n ...(options.imports || [])\r\n ]\r\n }).compileComponents();\r\n\r\n NgxsTestBed.ngxsBootstrap();\r\n\r\n return {\r\n get store(): Store {\r\n return TestBed.inject(Store);\r\n },\r\n get getTestBed(): TestBedStatic {\r\n return TestBed;\r\n }\r\n };\r\n }\r\n\r\n private static ngxsBootstrap(): void {\r\n NgxsTestBed.createRootNode();\r\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\r\n }\r\n\r\n private static resetTestBed(): void {\r\n TestBed.resetTestEnvironment();\r\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\r\n }\r\n\r\n private static createRootNode(selector = 'app-root'): void {\r\n const document = TestBed.inject(DOCUMENT);\r\n const adapter = new BrowserDomAdapter();\r\n const root = adapter.createElement(selector);\r\n document.body.appendChild(root);\r\n }\r\n}\r\n","import { TestBed } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\r\nimport { destroyPlatform, createPlatform } from '@angular/core';\r\n\r\nfunction createRootElement() {\r\n const document = TestBed.inject(DOCUMENT);\r\n const root = getDOM().createElement('app-root', document);\r\n document.body.appendChild(root);\r\n}\r\n\r\nfunction removeRootElement() {\r\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\r\n try {\r\n document.body.removeChild(root);\r\n } catch {}\r\n}\r\n\r\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\r\n destroyPlatform();\r\n createRootElement();\r\n}\r\n\r\n// As we create our custom platform via `bootstrapModule`\r\n// we have to destroy it after assetions and revert\r\n// the previous one\r\nfunction resetPlatformAfterBootstrapping() {\r\n removeRootElement();\r\n destroyPlatform();\r\n createPlatform(TestBed);\r\n}\r\n\r\nexport function freshPlatform(fn: Function): (...args: any[]) => any {\r\n return async function testWithAFreshPlatform(this: any, ...args: any[]) {\r\n try {\r\n destroyPlatformBeforeBootstrappingTheNewOne();\r\n return await fn.apply(this, args);\r\n } finally {\r\n resetPlatformAfterBootstrapping();\r\n }\r\n };\r\n}\r\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;;;;AAAA,MAMa,iBAAiB;;;;IACrB,QAAQ,MAAW;;;;IACnB,eAAe,MAAW;;;YANlC,SAAS,SAAC;gBACT,QAAQ,EAAE,UAAU;gBACpB,QAAQ,EAAE,EAAE;a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+ import { Component, NgModule, ApplicationRef, destroyPlatform, createPlatform } from '@angular/core';
3
+ import { TestBed } from '@angular/core/testing';
4
+ import { DOCUMENT } from '@angular/common';
5
+ import { BrowserModule, ɵBrowserDomAdapter, ɵgetDOM } from '@angular/platform-browser';
6
+ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
7
+ import { NgxsModule, Store } from '@ngxs/store';
8
+
9
+ /**
10
+ * @fileoverview added by tsickle
11
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
12
+ */
13
+ var NgxsTestComponent = /** @class */ (function () {
14
+ function NgxsTestComponent() {
15
+ }
16
+ /**
17
+ * @return {?}
18
+ */
19
+ NgxsTestComponent.prototype.ngOnInit = /**
20
+ * @return {?}
21
+ */
22
+ function () { };
23
+ /**
24
+ * @return {?}
25
+ */
26
+ NgxsTestComponent.prototype.ngAfterViewInit = /**
27
+ * @return {?}
28
+ */
29
+ function () { };
30
+ NgxsTestComponent.decorators = [
31
+ { type: Component, args: [{
32
+ selector: 'app-root',
33
+ template: ''
34
+ }] }
35
+ ];
36
+ return NgxsTestComponent;
37
+ }());
38
+
39
+ /**
40
+ * @fileoverview added by tsickle
41
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
42
+ */
43
+ var NgxsTestModule = /** @class */ (function () {
44
+ function NgxsTestModule() {
45
+ }
46
+ /**
47
+ * @param {?} app
48
+ * @return {?}
49
+ */
50
+ NgxsTestModule.ngDoBootstrap = /**
51
+ * @param {?} app
52
+ * @return {?}
53
+ */
54
+ function (app) {
55
+ app.bootstrap(NgxsTestComponent);
56
+ };
57
+ NgxsTestModule.decorators = [
58
+ { type: NgModule, args: [{
59
+ imports: [BrowserModule],
60
+ declarations: [NgxsTestComponent],
61
+ entryComponents: [NgxsTestComponent]
62
+ },] }
63
+ ];
64
+ return NgxsTestModule;
65
+ }());
66
+
67
+ /**
68
+ * @fileoverview added by tsickle
69
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
70
+ */
71
+ var NgxsTestBed = /** @class */ (function () {
72
+ function NgxsTestBed() {
73
+ }
74
+ /**
75
+ * @param {?} options
76
+ * @return {?}
77
+ */
78
+ NgxsTestBed.configureTestingStates = /**
79
+ * @param {?} options
80
+ * @return {?}
81
+ */
82
+ function (options) {
83
+ this.resetTestBed();
84
+ if (options.before) {
85
+ options.before();
86
+ }
87
+ TestBed.configureTestingModule({
88
+ imports: __spread([
89
+ NgxsTestModule,
90
+ NgxsModule.forRoot(options.states || [], options.ngxsOptions || {})
91
+ ], (options.imports || []))
92
+ }).compileComponents();
93
+ NgxsTestBed.ngxsBootstrap();
94
+ return {
95
+ /**
96
+ * @return {?}
97
+ */
98
+ get store() {
99
+ return TestBed.inject(Store);
100
+ },
101
+ /**
102
+ * @return {?}
103
+ */
104
+ get getTestBed() {
105
+ return TestBed;
106
+ }
107
+ };
108
+ };
109
+ /**
110
+ * @private
111
+ * @return {?}
112
+ */
113
+ NgxsTestBed.ngxsBootstrap = /**
114
+ * @private
115
+ * @return {?}
116
+ */
117
+ function () {
118
+ NgxsTestBed.createRootNode();
119
+ NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));
120
+ };
121
+ /**
122
+ * @private
123
+ * @return {?}
124
+ */
125
+ NgxsTestBed.resetTestBed = /**
126
+ * @private
127
+ * @return {?}
128
+ */
129
+ function () {
130
+ TestBed.resetTestEnvironment();
131
+ TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
132
+ };
133
+ /**
134
+ * @private
135
+ * @param {?=} selector
136
+ * @return {?}
137
+ */
138
+ NgxsTestBed.createRootNode = /**
139
+ * @private
140
+ * @param {?=} selector
141
+ * @return {?}
142
+ */
143
+ function (selector) {
144
+ if (selector === void 0) { selector = 'app-root'; }
145
+ /** @type {?} */
146
+ var document = TestBed.inject(DOCUMENT);
147
+ /** @type {?} */
148
+ var adapter = new ɵBrowserDomAdapter();
149
+ /** @type {?} */
150
+ var root = adapter.createElement(selector);
151
+ document.body.appendChild(root);
152
+ };
153
+ return NgxsTestBed;
154
+ }());
155
+
156
+ /**
157
+ * @fileoverview added by tsickle
158
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
159
+ */
160
+ /**
161
+ * @return {?}
162
+ */
163
+ function createRootElement() {
164
+ /** @type {?} */
165
+ var document = TestBed.inject(DOCUMENT);
166
+ /** @type {?} */
167
+ var root = ɵgetDOM().createElement('app-root', document);
168
+ document.body.appendChild(root);
169
+ }
170
+ /**
171
+ * @return {?}
172
+ */
173
+ function removeRootElement() {
174
+ /** @type {?} */
175
+ var root = (/** @type {?} */ (document.getElementsByTagName('app-root').item(0)));
176
+ try {
177
+ document.body.removeChild(root);
178
+ }
179
+ catch (_a) { }
180
+ }
181
+ /**
182
+ * @return {?}
183
+ */
184
+ function destroyPlatformBeforeBootstrappingTheNewOne() {
185
+ destroyPlatform();
186
+ createRootElement();
187
+ }
188
+ // As we create our custom platform via `bootstrapModule`
189
+ // we have to destroy it after assetions and revert
190
+ // the previous one
191
+ /**
192
+ * @return {?}
193
+ */
194
+ function resetPlatformAfterBootstrapping() {
195
+ removeRootElement();
196
+ destroyPlatform();
197
+ createPlatform(TestBed);
198
+ }
199
+ /**
200
+ * @param {?} fn
201
+ * @return {?}
202
+ */
203
+ function freshPlatform(fn) {
204
+ return (/**
205
+ * @this {?}
206
+ * @param {...?} args
207
+ * @return {?}
208
+ */
209
+ function testWithAFreshPlatform() {
210
+ var args = [];
211
+ for (var _i = 0; _i < arguments.length; _i++) {
212
+ args[_i] = arguments[_i];
213
+ }
214
+ return __awaiter(this, void 0, void 0, function () {
215
+ return __generator(this, function (_a) {
216
+ switch (_a.label) {
217
+ case 0:
218
+ _a.trys.push([0, , 2, 3]);
219
+ destroyPlatformBeforeBootstrappingTheNewOne();
220
+ return [4 /*yield*/, fn.apply(this, args)];
221
+ case 1: return [2 /*return*/, _a.sent()];
222
+ case 2:
223
+ resetPlatformAfterBootstrapping();
224
+ return [7 /*endfinally*/];
225
+ case 3: return [2 /*return*/];
226
+ }
227
+ });
228
+ });
229
+ });
230
+ }
231
+
232
+ /**
233
+ * @fileoverview added by tsickle
234
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
235
+ */
236
+
237
+ /**
238
+ * @fileoverview added by tsickle
239
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
240
+ */
241
+
242
+ export { NgxsTestBed, freshPlatform };
243
+ //# sourceMappingURL=ngxs-store-internals-testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n template: ''\r\n})\r\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\r\n public ngOnInit(): void {}\r\n public ngAfterViewInit(): void {}\r\n}\r\n","import { ApplicationRef, NgModule } from '@angular/core';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\n\r\nimport { NgxsTestComponent } from './ngxs-test.component';\r\n\r\n@NgModule({\r\n imports: [BrowserModule],\r\n declarations: [NgxsTestComponent],\r\n entryComponents: [NgxsTestComponent]\r\n})\r\nexport class NgxsTestModule {\r\n public static ngDoBootstrap(app: ApplicationRef): void {\r\n app.bootstrap(NgxsTestComponent);\r\n }\r\n}\r\n","import { ApplicationRef } from '@angular/core';\r\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\r\nimport {\r\n BrowserDynamicTestingModule,\r\n platformBrowserDynamicTesting\r\n} from '@angular/platform-browser-dynamic/testing';\r\nimport { NgxsModule, Store } from '@ngxs/store';\r\n\r\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\r\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\r\n\r\nexport class NgxsTestBed {\r\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\r\n this.resetTestBed();\r\n\r\n if (options.before) {\r\n options.before();\r\n }\r\n\r\n TestBed.configureTestingModule({\r\n imports: [\r\n NgxsTestModule,\r\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\r\n ...(options.imports || [])\r\n ]\r\n }).compileComponents();\r\n\r\n NgxsTestBed.ngxsBootstrap();\r\n\r\n return {\r\n get store(): Store {\r\n return TestBed.inject(Store);\r\n },\r\n get getTestBed(): TestBedStatic {\r\n return TestBed;\r\n }\r\n };\r\n }\r\n\r\n private static ngxsBootstrap(): void {\r\n NgxsTestBed.createRootNode();\r\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\r\n }\r\n\r\n private static resetTestBed(): void {\r\n TestBed.resetTestEnvironment();\r\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\r\n }\r\n\r\n private static createRootNode(selector = 'app-root'): void {\r\n const document = TestBed.inject(DOCUMENT);\r\n const adapter = new BrowserDomAdapter();\r\n const root = adapter.createElement(selector);\r\n document.body.appendChild(root);\r\n }\r\n}\r\n","import { TestBed } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\r\nimport { destroyPlatform, createPlatform } from '@angular/core';\r\n\r\nfunction createRootElement() {\r\n const document = TestBed.inject(DOCUMENT);\r\n const root = getDOM().createElement('app-root', document);\r\n document.body.appendChild(root);\r\n}\r\n\r\nfunction removeRootElement() {\r\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\r\n try {\r\n document.body.removeChild(root);\r\n } catch {}\r\n}\r\n\r\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\r\n destroyPlatform();\r\n createRootElement();\r\n}\r\n\r\n// As we create our custom platform via `bootstrapModule`\r\n// we have to destroy it after assetions and revert\r\n// the previous one\r\nfunction resetPlatformAfterBootstrapping() {\r\n removeRootElement();\r\n destroyPlatform();\r\n createPlatform(TestBed);\r\n}\r\n\r\nexport function freshPlatform(fn: Function): (...args: any[]) => any {\r\n return async function testWithAFreshPlatform(this: any, ...args: any[]) {\r\n try {\r\n destroyPlatformBeforeBootstrappingTheNewOne();\r\n return await fn.apply(this, args);\r\n } finally {\r\n resetPlatformAfterBootstrapping();\r\n }\r\n };\r\n}\r\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;;;;AAAA,AAEA;IAAA;KAOC;;;;IAFQ,oCAAQ;;;IAAf,eAA0B;;;;IACnB,2CAAe;;;IAAtB,eAAiC;;gBANlC,SAAS,SAAC;oBACT,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,EAAE;iBACb;;IAID,wBAAC;CAPD,IAOC;;;;;;ACTD,AAKA;IAAA;KASC;;;;;IAHe,4BAAa;;;;IAA3B,UAA4B,GAAmB;QAC7C,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;KAClC;;gBARF,QAAQ,SAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,eAAe,EAAE,CAAC,iBAAiB,CAAC;iBACrC;;IAKD,qBAAC;CATD,IASC;;;;;;;ICDD;KA4CC;;;;;IA3Ce,kCAAsB;;;;IAApC,UAAqC,OAA2B;QAC9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;QAED,O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C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CACjC;;;;AAED,SAAS,iBAAiB;;QAClB,IAAI,sBAAY,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC;IACxE,IAAI;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;KACjC;IAAC,WAAM,GAAE;CACX;;;;AAED,SAAS,2CAA2C;IAClD,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,CAAC;CACrB;;;;;;;AAKD,SAAS,+BAA+B;IACtC,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC;IAClB,cAAc,CAAC,OAAO,CAAC,CAAC;CACzB;;;;;AAED,SAAgB,aAAa,CAAC,EAAY;IACxC;;;;;IAAO,SAAe,sBAAsB;QAAY,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;;;;;;wBAElE,2CAA2C,EAAE,CAAC;wBACvC,qBAAM,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAA;4BAAjC,sBAAO,SAA0B,EAAC;;wBAElC,+BAA+B,EAAE,CAAC;;;;;;KAErC,EAAC;CACH;;;;;;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ export declare function freshPlatform(fn: Function): (...args: any[]) => any;
@@ -0,0 +1,5 @@
1
+ import { AfterViewInit, OnInit } from '@angular/core';
2
+ export declare class NgxsTestComponent implements OnInit, AfterViewInit {
3
+ ngOnInit(): void;
4
+ ngAfterViewInit(): void;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { ApplicationRef } from '@angular/core';
2
+ export declare class NgxsTestModule {
3
+ static ngDoBootstrap(app: ApplicationRef): void;
4
+ }
@@ -0,0 +1,3 @@
1
+ export { NgxsTestBed } from './ngxs.setup';
2
+ export { NgxsTesting } from './symbol';
3
+ export { freshPlatform } from './fresh-platform';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
@@ -0,0 +1 @@
1
+ {"__symbolic":"module","version":4,"metadata":{"NgxsTestBed":{"__symbolic":"class","members":{}},"NgxsTesting":{"__symbolic":"interface"},"freshPlatform":{"__symbolic":"function","parameters":["fn"],"value":{"__symbolic":"error","message":"Lambda not supported","line":33,"character":9,"module":"./fresh-platform"}}},"origins":{"NgxsTestBed":"./ngxs.setup","NgxsTesting":"./symbol","freshPlatform":"./fresh-platform"},"importAs":"@ngxs/store/internals/testing"}
@@ -0,0 +1,7 @@
1
+ import { NgxsOptionsTesting, NgxsTesting } from './symbol';
2
+ export declare class NgxsTestBed {
3
+ static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting;
4
+ private static ngxsBootstrap;
5
+ private static resetTestBed;
6
+ private static createRootNode;
7
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "main": "../../bundles/ngxs-store-internals-testing.umd.js",
3
+ "module": "../../fesm5/ngxs-store-internals-testing.js",
4
+ "es2015": "../../fesm2015/ngxs-store-internals-testing.js",
5
+ "esm5": "../../esm5/internals/testing/ngxs-store-internals-testing.js",
6
+ "esm2015": "../../esm2015/internals/testing/ngxs-store-internals-testing.js",
7
+ "fesm5": "../../fesm5/ngxs-store-internals-testing.js",
8
+ "fesm2015": "../../fesm2015/ngxs-store-internals-testing.js",
9
+ "typings": "ngxs-store-internals-testing.d.ts",
10
+ "metadata": "ngxs-store-internals-testing.metadata.json",
11
+ "sideEffects": false,
12
+ "name": "@ngxs/store/internals/testing"
13
+ }
@@ -0,0 +1,14 @@
1
+ import { NgxsModuleOptions, Store } from '@ngxs/store';
2
+ import { ModuleWithProviders } from '@angular/core';
3
+ import { TestBedStatic } from '@angular/core/testing';
4
+ import { StateClass } from '@ngxs/store/internals';
5
+ export interface NgxsOptionsTesting {
6
+ states?: StateClass[];
7
+ ngxsOptions?: NgxsModuleOptions;
8
+ imports?: ModuleWithProviders[];
9
+ before?: () => void;
10
+ }
11
+ export interface NgxsTesting {
12
+ store: Store;
13
+ getTestBed: TestBedStatic;
14
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "../../node_modules/ng-packagr/package.schema.json",
3
3
  "name": "@ngxs/store",
4
- "version": "3.7.2",
4
+ "version": "3.7.3",
5
5
  "license": "MIT",
6
6
  "sideEffects": true,
7
7
  "peerDependencies": {
8
- "@angular/core": ">=6.1.0 <13.0.0",
8
+ "@angular/core": ">=6.1.0 <14.0.0",
9
9
  "rxjs": ">=6.5.5"
10
10
  },
11
11
  "main": "bundles/ngxs-store.umd.js",