dyo-tools 0.2.0 → 0.3.2
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/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/core/DTAction.d.ts +10 -0
- package/dist/core/DTAction.js +24 -0
- package/dist/core/DTAction.js.map +1 -0
- package/dist/core/DTBunch.d.ts +6 -7
- package/dist/core/DTBunch.js +17 -14
- package/dist/core/DTBunch.js.map +1 -1
- package/dist/core/DTComponentPhysical.d.ts +7 -4
- package/dist/core/DTComponentPhysical.js +6 -0
- package/dist/core/DTComponentPhysical.js.map +1 -1
- package/dist/core/DTElement.d.ts +5 -0
- package/dist/core/DTElement.js +12 -2
- package/dist/core/DTElement.js.map +1 -1
- package/dist/core/DTManager.d.ts +3 -1
- package/dist/core/DTManager.js +24 -14
- package/dist/core/DTManager.js.map +1 -1
- package/dist/core/DTMaster.d.ts +24 -0
- package/dist/core/DTMaster.js +133 -0
- package/dist/core/DTMaster.js.map +1 -0
- package/dist/core/DTModule.d.ts +14 -0
- package/dist/core/DTModule.js +39 -0
- package/dist/core/DTModule.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/libs/player/DTPlayer.element.d.ts +5 -0
- package/dist/libs/player/DTPlayer.element.js +11 -0
- package/dist/libs/player/DTPlayer.element.js.map +1 -0
- package/dist/libs/player/DTPlayer.manager.d.ts +11 -0
- package/dist/libs/player/DTPlayer.manager.js +42 -0
- package/dist/libs/player/DTPlayer.manager.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/core.d.ts +103 -0
- package/dist/types/core.js +15 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/index.d.ts +2 -98
- package/dist/types/index.js +16 -12
- package/dist/types/index.js.map +1 -1
- package/dist/types/player.d.ts +5 -0
- package/dist/types/player.js +3 -0
- package/dist/types/player.js.map +1 -0
- package/docs/assets/highlight.css +29 -29
- package/docs/assets/main.js +4 -3
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +72 -25
- package/docs/classes/core_DTAction.DYOToolsAction.html +89 -0
- package/docs/classes/core_DTBunch.DYOToolsBunch.html +254 -0
- package/docs/classes/core_DTComponent.DYOToolsComponent.html +76 -0
- package/docs/classes/core_DTComponentPhysical.DYOToolsComponentPhysical.html +110 -0
- package/docs/classes/core_DTComponentWithMeta.DYOToolsComponentWithMeta.html +96 -0
- package/docs/classes/core_DTElement.DYOToolsElement.html +135 -0
- package/docs/classes/core_DTError.DYOToolsError.html +37 -0
- package/docs/classes/core_DTManager.DYOToolsManager.html +237 -0
- package/docs/classes/core_DTMaster.DYOToolsMaster.html +150 -0
- package/docs/classes/core_DTModule.DYOToolsModule.html +92 -0
- package/docs/classes/libs_DYOFinder.DYOFinder.html +34 -0
- package/docs/classes/libs_player_DTPlayer_element.DYOToolsPlayer.html +134 -0
- package/docs/classes/libs_player_DTPlayer_manager.DYOToolsPlayerManager.html +243 -0
- package/docs/enums/types_core.FilterOperatorType.html +10 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1 -46
- package/docs/interfaces/types_core.DTBunchFilters.html +6 -0
- package/docs/interfaces/types_core.DTBunchOptions.html +19 -0
- package/docs/interfaces/types_core.DTBunchToObject.html +7 -0
- package/docs/interfaces/types_core.DTComponentOptions.html +5 -0
- package/docs/interfaces/types_core.DTComponentToObject.html +4 -0
- package/docs/interfaces/types_core.DTElementToObject.html +7 -0
- package/docs/interfaces/types_core.DTManagerFilters.html +6 -0
- package/docs/interfaces/types_core.DTManagerOptions.html +8 -0
- package/docs/interfaces/types_core.DTManagerToObject.html +5 -0
- package/docs/interfaces/types_core.DTMasterToObject.html +8 -0
- package/docs/interfaces/types_core.DTModuleToObject.html +6 -0
- package/docs/interfaces/types_core.DYOFinderConfigurationPropDefault.html +4 -0
- package/docs/interfaces/types_core.DYOFinderConfigurationPropObjectSearch.html +4 -0
- package/docs/interfaces/types_core.DYOFinderFilterOperatorAdvanced.html +5 -0
- package/docs/interfaces/types_core.DYOFinderFilterOperatorBase.html +5 -0
- package/docs/interfaces/types_player.DTPlayerManagerSimpleConfiguration.html +3 -0
- package/docs/modules/constants.html +6 -0
- package/docs/modules/core_DTAction.html +2 -0
- package/docs/modules/core_DTBunch.html +2 -0
- package/docs/modules/core_DTComponent.html +2 -0
- package/docs/modules/core_DTComponentPhysical.html +2 -0
- package/docs/modules/core_DTComponentWithMeta.html +2 -0
- package/docs/modules/core_DTElement.html +2 -0
- package/docs/modules/core_DTError.html +2 -0
- package/docs/modules/core_DTManager.html +2 -0
- package/docs/modules/core_DTMaster.html +2 -0
- package/docs/modules/core_DTModule.html +2 -0
- package/docs/modules/libs_DYOFinder.html +2 -0
- package/docs/modules/libs_player_DTPlayer_element.html +2 -0
- package/docs/modules/libs_player_DTPlayer_manager.html +2 -0
- package/docs/modules/types.html +29 -0
- package/docs/modules/types_core.html +28 -0
- package/docs/modules/types_player.html +2 -0
- package/docs/types/types_core.DTAcceptedMetaData.html +2 -0
- package/docs/types/types_core.DTManagerItemType.html +1 -0
- package/docs/types/types_core.DTManagerItemsType.html +2 -0
- package/docs/types/types_core.DYOFinderComponentType.html +1 -0
- package/docs/types/types_core.DYOFinderConfiguration.html +2 -0
- package/docs/types/types_core.DYOFinderConfigurationProp.html +1 -0
- package/docs/types/types_core.DYOFinderFilterOperator.html +1 -0
- package/docs/types/types_core.DYOFinderFilterOperatorArgument.html +1 -0
- package/docs/types/types_core.DYOFinderFilters.html +1 -0
- package/docs/types/types_core.StandardPrimitiveType.html +2 -0
- package/docs/types/types_core.StandardPrimitiveTypeWithArray.html +1 -0
- package/docs/variables/constants.bunchDefaultOptions.html +2 -0
- package/docs/variables/constants.componentBunchDefaultFinderConfiguration.html +1 -0
- package/docs/variables/constants.componentManagerDefaultFinderConfiguration.html +1 -0
- package/docs/variables/constants.componentPhysicalDefaultFinderConfiguration.html +1 -0
- package/docs/variables/constants.managerDefaultOptions.html +2 -0
- package/package.json +16 -17
- package/src/constants.ts +4 -4
- package/src/core/DTAction.ts +52 -0
- package/src/core/DTBunch.ts +36 -30
- package/src/core/DTComponent.ts +1 -1
- package/src/core/DTComponentPhysical.ts +20 -5
- package/src/core/DTElement.ts +35 -2
- package/src/core/DTManager.ts +37 -18
- package/src/core/DTMaster.ts +318 -0
- package/src/core/DTModule.ts +90 -0
- package/src/index.ts +9 -1
- package/src/libs/player/DTPlayer.element.ts +9 -0
- package/src/libs/player/DTPlayer.manager.ts +84 -0
- package/src/types/core.ts +169 -0
- package/src/types/index.ts +2 -162
- package/src/types/player.ts +6 -0
- package/test/core/DTAction.double.ts +78 -0
- package/test/core/DTAction.spec.ts +76 -0
- package/test/core/DTBunch.double.ts +18 -10
- package/test/core/DTBunch.spec.ts +83 -68
- package/test/core/DTComponentPhysical.double.ts +3 -3
- package/test/core/DTComponentPhysical.spec.ts +25 -11
- package/test/core/DTElement.double.ts +21 -5
- package/test/core/DTElement.spec.ts +52 -8
- package/test/core/DTError.double.ts +1 -1
- package/test/core/DTManager.double.ts +29 -5
- package/test/core/DTManager.spec.ts +80 -17
- package/test/core/DTMaster.double.ts +141 -0
- package/test/core/DTMaster.spec.ts +584 -0
- package/test/core/DTModule.double.ts +80 -0
- package/test/core/DTModule.spec.ts +138 -0
- package/test/core/copy.spec.ts +20 -4
- package/test/{core/DTPlayer.double.ts → libs/player/DTPlayer.element.double.ts} +15 -24
- package/test/libs/player/DTPlayer.element.spec.ts +28 -0
- package/test/libs/player/DTPlayer.manager.double.ts +92 -0
- package/test/libs/player/DTPlayer.manager.spec.ts +178 -0
- package/LICENSE +0 -21
- package/cucumber.js +0 -9
- package/dist/core/DTPlayer.d.ts +0 -8
- package/dist/core/DTPlayer.js +0 -30
- package/dist/core/DTPlayer.js.map +0 -1
- package/e2e/0.2.0/epic1.feature +0 -29
- package/e2e/0.2.0/epic2.feature +0 -22
- package/e2e/0.2.0/epic3.feature +0 -25
- package/e2e/0.2.0/resources/dominion.js +0 -195
- package/e2e/0.2.0/resources/utils.js +0 -27
- package/e2e/0.2.0/support/steps.js +0 -108
- package/e2e/future/epic4.feature +0 -39
- package/e2e/future/resources/dominion.js +0 -238
- package/e2e/future/resources/utils.js +0 -27
- package/src/core/DTPlayer.ts +0 -57
- package/test/core/DTPlayer.spec.ts +0 -80
|
@@ -24,17 +24,10 @@ import { DTBunch, DTComponentPhysical } from '../../src';
|
|
|
24
24
|
import DYOToolsElement from '../../src/core/DTElement';
|
|
25
25
|
import { BunchMetaData, HaileiMetaData, IMetaDataTest } from './DTComponentWithMeta.double';
|
|
26
26
|
import { DTBunchOptions, FilterOperatorType } from '../../src/types';
|
|
27
|
-
import {
|
|
28
|
-
DTPlayerStub,
|
|
29
|
-
IDTest as IDTestPlayer,
|
|
30
|
-
IDTest as IDPlayerTest,
|
|
31
|
-
KeyTest as KeyPlayerTest,
|
|
32
|
-
toStringTest as toStringPlayerTest,
|
|
33
|
-
} from './DTPlayer.double';
|
|
34
27
|
import { checkCallForMockedDTError, CodeTest as DTErrorCodeTest, DTErrorStub } from './DTError.double';
|
|
35
28
|
import DYOToolsError from '../../src/core/DTError';
|
|
36
|
-
import { mockOverriddenMethods } from './DTComponentPhysical.double';
|
|
37
|
-
import { DTManagerStub } from './DTManager.double';
|
|
29
|
+
import { mockOverriddenMethods, OwnerTest } from './DTComponentPhysical.double';
|
|
30
|
+
import { DTManagerStub, IDTest as managerIDTest } from './DTManager.double';
|
|
38
31
|
import { componentBunchDefaultFinderConfiguration } from '../../src/constants';
|
|
39
32
|
import Mocked = jest.Mocked;
|
|
40
33
|
import MockedFunction = jest.MockedFunction;
|
|
@@ -124,7 +117,7 @@ describe('class DYOToolsBunch', () => {
|
|
|
124
117
|
uniqueKey: true,
|
|
125
118
|
inheritOwner: true,
|
|
126
119
|
replaceIndex: false,
|
|
127
|
-
|
|
120
|
+
virtualContainer: false,
|
|
128
121
|
});
|
|
129
122
|
expect(newBunch.th_get_items()).toStrictEqual([]);
|
|
130
123
|
});
|
|
@@ -174,42 +167,42 @@ describe('class DYOToolsBunch', () => {
|
|
|
174
167
|
const finderConfigurationToCheck = bunchTest.getFinderConfiguration().owner;
|
|
175
168
|
|
|
176
169
|
expect(finderConfigurationToCheck.operators).toStrictEqual(baseOperators);
|
|
177
|
-
expect(finderConfigurationToCheck.getValue(element)).
|
|
170
|
+
expect(finderConfigurationToCheck.getValue(element)).toBeUndefined();
|
|
178
171
|
expect(finderConfigurationToCheck.objectSearch).toBe(false);
|
|
179
172
|
});
|
|
180
173
|
|
|
181
174
|
test('check finder configuration for owner attribute - with owner', () => {
|
|
182
175
|
const element = new DTElementStub();
|
|
183
|
-
jest.spyOn(element, 'getOwner').
|
|
176
|
+
jest.spyOn(element, 'getOwner').mockReturnValue(OwnerTest);
|
|
184
177
|
|
|
185
178
|
const finderConfigurationToCheck = bunchTest.getFinderConfiguration().owner;
|
|
186
179
|
|
|
187
180
|
expect(finderConfigurationToCheck.operators).toStrictEqual(baseOperators);
|
|
188
|
-
expect(finderConfigurationToCheck.getValue(element)).toBe(
|
|
181
|
+
expect(finderConfigurationToCheck.getValue(element)).toBe(OwnerTest);
|
|
189
182
|
expect(finderConfigurationToCheck.objectSearch).toBe(false);
|
|
190
183
|
});
|
|
191
184
|
|
|
192
|
-
test('check finder configuration for
|
|
185
|
+
test('check finder configuration for container attribute - empty container', () => {
|
|
193
186
|
const element = new DTElementStub();
|
|
194
|
-
jest.spyOn(element, '
|
|
187
|
+
jest.spyOn(element, 'getContainer').mockImplementation(() => undefined);
|
|
195
188
|
|
|
196
|
-
const finderConfigurationToCheck = bunchTest.getFinderConfiguration().
|
|
189
|
+
const finderConfigurationToCheck = bunchTest.getFinderConfiguration().container;
|
|
197
190
|
|
|
198
191
|
expect(finderConfigurationToCheck.operators).toStrictEqual(baseOperators);
|
|
199
192
|
expect(finderConfigurationToCheck.getValue(element)).toBeNull();
|
|
200
193
|
expect(finderConfigurationToCheck.objectSearch).toBe(false);
|
|
201
194
|
});
|
|
202
195
|
|
|
203
|
-
test('check finder configuration for
|
|
196
|
+
test('check finder configuration for container attribute - with container', () => {
|
|
204
197
|
const element = new DTElementStub();
|
|
205
198
|
const bunch = new DTBunchStub();
|
|
206
|
-
jest.spyOn(bunch, 'getId').mockImplementation(() => `${IDTest}
|
|
207
|
-
jest.spyOn(element, '
|
|
199
|
+
jest.spyOn(bunch, 'getId').mockImplementation(() => `${IDTest}_other_container`);
|
|
200
|
+
jest.spyOn(element, 'getContainer').mockImplementation(() => bunch);
|
|
208
201
|
|
|
209
|
-
const finderConfigurationToCheck = bunchTest.getFinderConfiguration().
|
|
202
|
+
const finderConfigurationToCheck = bunchTest.getFinderConfiguration().container;
|
|
210
203
|
|
|
211
204
|
expect(finderConfigurationToCheck.operators).toStrictEqual(baseOperators);
|
|
212
|
-
expect(finderConfigurationToCheck.getValue(element)).toBe(`${IDTest}
|
|
205
|
+
expect(finderConfigurationToCheck.getValue(element)).toBe(`${IDTest}_other_container`);
|
|
213
206
|
expect(finderConfigurationToCheck.objectSearch).toBe(false);
|
|
214
207
|
});
|
|
215
208
|
|
|
@@ -227,15 +220,14 @@ describe('class DYOToolsBunch', () => {
|
|
|
227
220
|
|
|
228
221
|
describe('setOwner()', () => {
|
|
229
222
|
beforeEach(() => {
|
|
230
|
-
jest.spyOn(bunchTest, 'getOwner').
|
|
223
|
+
jest.spyOn(bunchTest, 'getOwner').mockReturnValue(OwnerTest);
|
|
231
224
|
});
|
|
232
225
|
|
|
233
226
|
test('add a new owner - not updating elements owner when inheritOwner = false', () => {
|
|
234
227
|
bunchTest.th_set_options({ inheritOwner: false });
|
|
235
228
|
bunchTest.th_set_items(generateMockedElements(3));
|
|
236
229
|
|
|
237
|
-
|
|
238
|
-
bunchTest.setOwner(owner);
|
|
230
|
+
bunchTest.setOwner(OwnerTest);
|
|
239
231
|
|
|
240
232
|
expect(bunchTest.th_get_items()[0].setOwner.mock.calls.length).toBe(0);
|
|
241
233
|
expect(bunchTest.th_get_items()[1].setOwner.mock.calls.length).toBe(0);
|
|
@@ -246,15 +238,14 @@ describe('class DYOToolsBunch', () => {
|
|
|
246
238
|
bunchTest.th_set_options({ inheritOwner: true });
|
|
247
239
|
bunchTest.th_set_items(generateMockedElements(3));
|
|
248
240
|
|
|
249
|
-
|
|
250
|
-
bunchTest.setOwner(owner);
|
|
241
|
+
bunchTest.setOwner(OwnerTest);
|
|
251
242
|
|
|
252
243
|
expect(bunchTest.th_get_items()[0].setOwner.mock.calls.length).toBe(1);
|
|
253
|
-
expect(bunchTest.th_get_items()[0].setOwner.mock.calls[0][0]
|
|
244
|
+
expect(bunchTest.th_get_items()[0].setOwner.mock.calls[0][0]).toBe(OwnerTest);
|
|
254
245
|
expect(bunchTest.th_get_items()[1].setOwner.mock.calls.length).toBe(1);
|
|
255
|
-
expect(bunchTest.th_get_items()[1].setOwner.mock.calls[0][0]
|
|
246
|
+
expect(bunchTest.th_get_items()[1].setOwner.mock.calls[0][0]).toBe(OwnerTest);
|
|
256
247
|
expect(bunchTest.th_get_items()[2].setOwner.mock.calls.length).toBe(1);
|
|
257
|
-
expect(bunchTest.th_get_items()[2].setOwner.mock.calls[0][0]
|
|
248
|
+
expect(bunchTest.th_get_items()[2].setOwner.mock.calls[0][0]).toBe(OwnerTest);
|
|
258
249
|
});
|
|
259
250
|
});
|
|
260
251
|
|
|
@@ -340,7 +331,6 @@ describe('class DYOToolsBunch', () => {
|
|
|
340
331
|
});
|
|
341
332
|
});
|
|
342
333
|
|
|
343
|
-
// TODO : Add test cases for updating Library from manager
|
|
344
334
|
describe('addAtIndex()', () => {
|
|
345
335
|
let objectToAdd;
|
|
346
336
|
let objectsToAdd;
|
|
@@ -436,68 +426,82 @@ describe('class DYOToolsBunch', () => {
|
|
|
436
426
|
});
|
|
437
427
|
|
|
438
428
|
test('not inherit owner when adding an item - default case', () => {
|
|
439
|
-
|
|
440
|
-
bunchTest.th_set_owner(owner);
|
|
429
|
+
bunchTest.th_set_owner(OwnerTest);
|
|
441
430
|
|
|
442
431
|
bunchTest.addAtIndex(objectToAdd, 2);
|
|
443
432
|
|
|
444
|
-
expect(bunchTest.th_get_owner()
|
|
433
|
+
expect(bunchTest.th_get_owner()).toBe(OwnerTest);
|
|
445
434
|
expect(objectToAdd.setOwner.mock.calls.length).toBe(0);
|
|
446
435
|
});
|
|
447
436
|
|
|
448
437
|
test('inherit owner when adding an item - inheritOwner option', () => {
|
|
449
|
-
|
|
450
|
-
bunchTest.th_set_owner(owner);
|
|
438
|
+
bunchTest.th_set_owner(OwnerTest);
|
|
451
439
|
|
|
452
440
|
bunchTest.addAtIndex(objectToAdd, 2, { inheritOwner: true });
|
|
453
441
|
|
|
454
|
-
expect(bunchTest.th_get_owner()
|
|
442
|
+
expect(bunchTest.th_get_owner()).toBe(OwnerTest);
|
|
455
443
|
expect(objectToAdd.setOwner.mock.calls.length).toBe(1);
|
|
456
|
-
expect(objectToAdd.setOwner.mock.calls[0][0]
|
|
444
|
+
expect(objectToAdd.setOwner.mock.calls[0][0]).toBe(OwnerTest);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
test('not set context if undefined when adding an item', () => {
|
|
448
|
+
bunchTest.addAtIndex(objectToAdd, 2);
|
|
449
|
+
|
|
450
|
+
expect(bunchTest.th_get_items()[2].setContext.mock.calls.length).toBe(0);
|
|
457
451
|
});
|
|
458
452
|
|
|
459
|
-
test('set context when adding an item
|
|
453
|
+
test('set context with parent manager when adding an item', () => {
|
|
454
|
+
const manager = new DTManagerStub();
|
|
455
|
+
bunchTest.th_set_context(manager);
|
|
456
|
+
|
|
460
457
|
bunchTest.addAtIndex(objectToAdd, 2);
|
|
461
458
|
|
|
462
459
|
expect(bunchTest.th_get_items()[2].setContext.mock.calls.length).toBe(1);
|
|
463
|
-
expect(bunchTest.th_get_items()[2].setContext.mock.calls[0][0].getId()).toBe(
|
|
460
|
+
expect(bunchTest.th_get_items()[2].setContext.mock.calls[0][0].getId()).toBe(managerIDTest);
|
|
464
461
|
});
|
|
465
462
|
|
|
466
|
-
test('
|
|
467
|
-
bunchTest.
|
|
463
|
+
test('set container when adding an item', () => {
|
|
464
|
+
bunchTest.addAtIndex(objectToAdd, 2);
|
|
465
|
+
|
|
466
|
+
expect(bunchTest.th_get_items()[2].setContainer.mock.calls.length).toBe(1);
|
|
467
|
+
expect(bunchTest.th_get_items()[2].setContainer.mock.calls[0][0].getId()).toBe(IDTest);
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
test('not set container when adding an item - virtualContainer option', () => {
|
|
471
|
+
bunchTest.th_set_options({ virtualContainer: true });
|
|
468
472
|
|
|
469
473
|
bunchTest.addAtIndex(objectToAdd, 2);
|
|
470
474
|
|
|
471
|
-
expect(bunchTest.th_get_items()[2].
|
|
475
|
+
expect(bunchTest.th_get_items()[2].setContainer.mock.calls.length).toBe(0);
|
|
472
476
|
});
|
|
473
477
|
|
|
474
|
-
test('set
|
|
478
|
+
test('set container when adding an item - remove from old bunch', () => {
|
|
475
479
|
const bunchTestOld = new DTBunchTest();
|
|
476
480
|
bunchTestOld.th_set_items(generateMockedElements(6));
|
|
477
481
|
objectToAdd = bunchTestOld.th_get_items()[5];
|
|
478
|
-
objectToAdd.
|
|
479
|
-
objectToAdd.
|
|
482
|
+
objectToAdd.setContainer(bunchTestOld);
|
|
483
|
+
objectToAdd.setContainer.mockClear();
|
|
480
484
|
jest.spyOn(bunchTestOld, 'remove').mockImplementation(() => {});
|
|
481
485
|
jest.spyOn(bunchTestOld, 'getComponentType').mockImplementation(() => 'bunch');
|
|
482
486
|
|
|
483
487
|
bunchTest.addAtIndex(objectToAdd, 2);
|
|
484
488
|
|
|
485
|
-
expect(bunchTest.th_get_items()[2].
|
|
486
|
-
expect(bunchTest.th_get_items()[2].
|
|
489
|
+
expect(bunchTest.th_get_items()[2].setContainer.mock.calls.length).toBe(1);
|
|
490
|
+
expect(bunchTest.th_get_items()[2].setContainer.mock.calls[0][0].getId()).toBe(IDTest);
|
|
487
491
|
expect((bunchTestOld.remove as any).mock.calls.length).toBe(1);
|
|
488
492
|
expect((bunchTestOld.remove as any).mock.calls[0][0]).toBe(objectToAdd.getId());
|
|
489
493
|
});
|
|
490
494
|
|
|
491
|
-
test('set
|
|
495
|
+
test('set container when adding an item - dont remove if virtualContainer option', () => {
|
|
492
496
|
const bunchTestOld = new DTBunchTest();
|
|
493
497
|
bunchTestOld.th_set_items(generateMockedElements(6));
|
|
494
498
|
objectToAdd = bunchTestOld.th_get_items()[5];
|
|
495
499
|
jest.spyOn(bunchTestOld, 'remove').mockImplementation(() => {});
|
|
496
500
|
|
|
497
|
-
bunchTest.th_set_options({
|
|
501
|
+
bunchTest.th_set_options({ virtualContainer: true });
|
|
498
502
|
bunchTest.addAtIndex(objectToAdd, 2);
|
|
499
503
|
|
|
500
|
-
expect(bunchTest.th_get_items()[2].
|
|
504
|
+
expect(bunchTest.th_get_items()[2].setContainer.mock.calls.length).toBe(0);
|
|
501
505
|
expect((bunchTestOld.remove as any).mock.calls.length).toBe(0);
|
|
502
506
|
});
|
|
503
507
|
|
|
@@ -528,6 +532,19 @@ describe('class DYOToolsBunch', () => {
|
|
|
528
532
|
|
|
529
533
|
expect((managerTest.th_get_library().add as any).mock.calls.length).toBe(0);
|
|
530
534
|
});
|
|
535
|
+
|
|
536
|
+
test('manager context - not add item into the manager if the caller is the library', () => {
|
|
537
|
+
const managerTest = new DTManagerStub();
|
|
538
|
+
jest.spyOn(bunchTest, 'getContext').mockImplementation(
|
|
539
|
+
(contextType) => contextType === 'manager' && managerTest,
|
|
540
|
+
);
|
|
541
|
+
jest.spyOn(managerTest, 'getLibrary').mockImplementation(() => managerTest.th_get_library());
|
|
542
|
+
jest.spyOn(managerTest.th_get_library(), 'add');
|
|
543
|
+
|
|
544
|
+
managerTest.th_get_library().addAtIndex(objectToAdd, 5);
|
|
545
|
+
|
|
546
|
+
expect((managerTest.th_get_library().add as any).mock.calls.length).toBe(0);
|
|
547
|
+
});
|
|
531
548
|
});
|
|
532
549
|
|
|
533
550
|
describe('add()', () => {
|
|
@@ -683,8 +700,6 @@ describe('class DYOToolsBunch', () => {
|
|
|
683
700
|
};
|
|
684
701
|
|
|
685
702
|
beforeEach(() => {
|
|
686
|
-
jest.spyOn(bunchTest, 'removeContext').mockImplementation(() => {});
|
|
687
|
-
|
|
688
703
|
bunchTest.th_set_items(generateMockedElements(5));
|
|
689
704
|
});
|
|
690
705
|
|
|
@@ -718,7 +733,7 @@ describe('class DYOToolsBunch', () => {
|
|
|
718
733
|
checkAllItemsInBunch(bunchTest, 2);
|
|
719
734
|
});
|
|
720
735
|
|
|
721
|
-
test('define
|
|
736
|
+
test('define container at undefined for removed items - default case', () => {
|
|
722
737
|
const items = [
|
|
723
738
|
bunchTest.th_get_items()[1],
|
|
724
739
|
bunchTest.th_get_items()[2],
|
|
@@ -729,27 +744,27 @@ describe('class DYOToolsBunch', () => {
|
|
|
729
744
|
items.push(bunchTest.th_get_items()[1]);
|
|
730
745
|
bunchTest.removeMany([0, 1]);
|
|
731
746
|
|
|
732
|
-
expect(items[0].
|
|
733
|
-
expect(items[1].
|
|
734
|
-
expect(items[2].
|
|
735
|
-
expect(items[3].
|
|
747
|
+
expect(items[0].removeContainer.mock.calls.length).toBe(1);
|
|
748
|
+
expect(items[1].removeContainer.mock.calls.length).toBe(1);
|
|
749
|
+
expect(items[2].removeContainer.mock.calls.length).toBe(1);
|
|
750
|
+
expect(items[3].removeContainer.mock.calls.length).toBe(1);
|
|
736
751
|
});
|
|
737
752
|
|
|
738
|
-
test('not change
|
|
753
|
+
test('not change container for removed items - virtual container option', () => {
|
|
739
754
|
const items = [
|
|
740
755
|
bunchTest.th_get_items()[1],
|
|
741
756
|
bunchTest.th_get_items()[2],
|
|
742
757
|
];
|
|
743
|
-
bunchTest.th_set_options({
|
|
758
|
+
bunchTest.th_set_options({ virtualContainer: true });
|
|
744
759
|
bunchTest.removeMany([`${MeldrineIdTest}-1`, `${MaydenaIdTest}-2`]);
|
|
745
760
|
items.push(bunchTest.th_get_items()[0]);
|
|
746
761
|
items.push(bunchTest.th_get_items()[1]);
|
|
747
762
|
bunchTest.removeMany([0, 1]);
|
|
748
763
|
|
|
749
|
-
expect(items[0].
|
|
750
|
-
expect(items[1].
|
|
751
|
-
expect(items[2].
|
|
752
|
-
expect(items[3].
|
|
764
|
+
expect(items[0].removeContainer.mock.calls.length).toBe(0);
|
|
765
|
+
expect(items[1].removeContainer.mock.calls.length).toBe(0);
|
|
766
|
+
expect(items[2].removeContainer.mock.calls.length).toBe(0);
|
|
767
|
+
expect(items[3].removeContainer.mock.calls.length).toBe(0);
|
|
753
768
|
});
|
|
754
769
|
});
|
|
755
770
|
|
|
@@ -830,11 +845,11 @@ describe('class DYOToolsBunch', () => {
|
|
|
830
845
|
});
|
|
831
846
|
|
|
832
847
|
test('toObject output standard with owner', () => {
|
|
833
|
-
bunchTest.th_set_owner(
|
|
848
|
+
bunchTest.th_set_owner(OwnerTest);
|
|
834
849
|
|
|
835
850
|
const toObjectBunch = bunchTest.toObject();
|
|
836
851
|
expect(Object.keys(toObjectBunch)).toStrictEqual(['id', 'key', 'type', 'items', 'owner']);
|
|
837
|
-
expect(toObjectBunch.owner
|
|
852
|
+
expect(toObjectBunch.owner).toBe(OwnerTest);
|
|
838
853
|
});
|
|
839
854
|
|
|
840
855
|
test('toObject output standard with owner and meta', () => {
|
|
@@ -842,7 +857,7 @@ describe('class DYOToolsBunch', () => {
|
|
|
842
857
|
return this._meta;
|
|
843
858
|
});
|
|
844
859
|
|
|
845
|
-
bunchTest.th_set_owner(
|
|
860
|
+
bunchTest.th_set_owner(OwnerTest);
|
|
846
861
|
bunchTest.th_set_meta(BunchMetaData);
|
|
847
862
|
|
|
848
863
|
const toObjectBunch = bunchTest.toObject();
|
|
@@ -886,10 +901,10 @@ describe('class DYOToolsBunch', () => {
|
|
|
886
901
|
|
|
887
902
|
test('string output standard with items and owner', () => {
|
|
888
903
|
bunchTest.th_set_items(generateMockedElements(5));
|
|
889
|
-
bunchTest.th_set_owner(
|
|
904
|
+
bunchTest.th_set_owner(OwnerTest);
|
|
890
905
|
|
|
891
906
|
const toStringBunch = bunchTest.toString();
|
|
892
|
-
expect(toStringBunch).toBe(`Component ${KeyTest} - Type: Bunch - Owner: ${
|
|
907
|
+
expect(toStringBunch).toBe(`Component ${KeyTest} - Type: Bunch - Owner: ${OwnerTest} - Items: 5`);
|
|
893
908
|
});
|
|
894
909
|
});
|
|
895
910
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {DTComponentPhysical} from "../../src";
|
|
2
2
|
import {IMetaDataTest} from "./DTComponentWithMeta.double";
|
|
3
|
-
import {DTPlayerStub} from "./DTPlayer.double";
|
|
4
3
|
|
|
5
4
|
/******************** STUB PROPERTIES CONSTANTS
|
|
6
5
|
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
@@ -10,6 +9,7 @@ export const KeyTest = "DTComponentPhysical-key-1234567";
|
|
|
10
9
|
export const ComponentTypeTest = "DTComponentPhysical-componentType-test";
|
|
11
10
|
export const ToObjectTest = { type: "DTComponentPhysical-test-toObject" };
|
|
12
11
|
export const ToStringTest = "DTComponentPhysical-test-toString";
|
|
12
|
+
export const OwnerTest = "owner-12345";
|
|
13
13
|
|
|
14
14
|
/******************** STUB ABSTRACT IMPLEMENTATION
|
|
15
15
|
* Implementation of abstract component class for tests
|
|
@@ -38,11 +38,11 @@ export class DTComponentPhysicalImpl extends DTComponentPhysical<IMetaDataTest>
|
|
|
38
38
|
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
39
39
|
* *****/
|
|
40
40
|
export class DTComponentPhysicalTest extends DTComponentPhysicalImpl {
|
|
41
|
-
th_get_owner():
|
|
41
|
+
th_get_owner(): string {
|
|
42
42
|
return this._owner;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
th_set_owner(owner:
|
|
45
|
+
th_set_owner(owner: string): void {
|
|
46
46
|
this._owner = owner;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {beforeEach, describe, jest, test} from '@jest/globals';
|
|
2
|
-
import {DTPlayerStub, IDTest as IDPlayerTest,} from './DTPlayer.double';
|
|
1
|
+
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
|
3
2
|
import {mockOverriddenMethods} from "./DTComponentWithMeta.double";
|
|
4
|
-
import {DTComponentPhysicalTest} from './DTComponentPhysical.double';
|
|
3
|
+
import {DTComponentPhysicalTest, OwnerTest} from './DTComponentPhysical.double';
|
|
5
4
|
import {DTComponentPhysical, DTComponentWithMeta} from "../../src";
|
|
6
5
|
|
|
7
6
|
/******************** MOCK DEPENDENCIES
|
|
@@ -30,32 +29,47 @@ describe('class DYOToolsComponentPhysical', () => {
|
|
|
30
29
|
});
|
|
31
30
|
});
|
|
32
31
|
|
|
32
|
+
describe('getManager()', () => {
|
|
33
|
+
test('call get context with manager accessor', () => {
|
|
34
|
+
componentPhysicalTest.getManager();
|
|
35
|
+
|
|
36
|
+
expect((componentPhysicalTest.getContext as any).mock.calls.length).toBe(1);
|
|
37
|
+
expect((componentPhysicalTest.getContext as any).mock.calls[0][0]).toBe('manager');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('getMaster()', () => {
|
|
42
|
+
test('call get context with master accessor', () => {
|
|
43
|
+
componentPhysicalTest.getMaster();
|
|
44
|
+
|
|
45
|
+
expect((componentPhysicalTest.getContext as any).mock.calls.length).toBe(1);
|
|
46
|
+
expect((componentPhysicalTest.getContext as any).mock.calls[0][0]).toBe('master');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
33
50
|
describe('getOwner()', () => {
|
|
34
51
|
test('return empty owner by default', () => {
|
|
35
52
|
expect(componentPhysicalTest.getOwner()).toBeUndefined();
|
|
36
53
|
});
|
|
37
54
|
|
|
38
55
|
test('return owner when set', () => {
|
|
39
|
-
|
|
40
|
-
componentPhysicalTest.th_set_owner(owner);
|
|
56
|
+
componentPhysicalTest.th_set_owner(OwnerTest);
|
|
41
57
|
|
|
42
|
-
expect(componentPhysicalTest.getOwner()
|
|
58
|
+
expect(componentPhysicalTest.getOwner()).toBe(OwnerTest);
|
|
43
59
|
});
|
|
44
60
|
});
|
|
45
61
|
|
|
46
62
|
describe('setOwner()', () => {
|
|
47
63
|
test('add a new owner', () => {
|
|
48
|
-
|
|
49
|
-
componentPhysicalTest.setOwner(owner);
|
|
64
|
+
componentPhysicalTest.setOwner(OwnerTest);
|
|
50
65
|
|
|
51
|
-
expect(componentPhysicalTest.th_get_owner()
|
|
66
|
+
expect(componentPhysicalTest.th_get_owner()).toBe(OwnerTest);
|
|
52
67
|
});
|
|
53
68
|
});
|
|
54
69
|
|
|
55
70
|
describe('removeOwner()', () => {
|
|
56
71
|
test('remove the current Owner', () => {
|
|
57
|
-
|
|
58
|
-
componentPhysicalTest.th_set_owner(owner);
|
|
72
|
+
componentPhysicalTest.th_set_owner(OwnerTest);
|
|
59
73
|
|
|
60
74
|
componentPhysicalTest.removeOwner();
|
|
61
75
|
expect(componentPhysicalTest.th_get_owner()).toBeUndefined();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { DTElement
|
|
2
|
-
import {
|
|
3
|
-
import { DTPlayerStub } from './DTPlayer.double';
|
|
1
|
+
import {DTBunch, DTElement} from '../../src';
|
|
2
|
+
import {IMetaDataTest} from './DTComponentWithMeta.double';
|
|
4
3
|
|
|
5
4
|
/** ****************** STUB PROPERTIES CONSTANTS
|
|
6
5
|
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
@@ -8,6 +7,7 @@ import { DTPlayerStub } from './DTPlayer.double';
|
|
|
8
7
|
// Global constants
|
|
9
8
|
export const IDTest = 'DTElement-id-1234567';
|
|
10
9
|
export const KeyTest = 'DTElement-key-1234567';
|
|
10
|
+
export const DomainTest = 'DTElement-domain-test';
|
|
11
11
|
|
|
12
12
|
// Specific elements constants
|
|
13
13
|
export const HaileiIdTest = 'DTElement-id-Hailei';
|
|
@@ -51,17 +51,33 @@ export class DTElementTest extends DTElement<IMetaDataTest> {
|
|
|
51
51
|
return this._componentType;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
th_get_domain(): string {
|
|
55
|
+
return this._domain;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
th_set_domain(domain: string): void {
|
|
59
|
+
this._domain = domain;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
th_get_owner(): string {
|
|
55
63
|
return this._owner;
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
th_set_owner(owner:
|
|
66
|
+
th_set_owner(owner: string): void {
|
|
59
67
|
this._owner = owner;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
th_set_meta(meta: IMetaDataTest): void {
|
|
63
71
|
this._meta = meta;
|
|
64
72
|
}
|
|
73
|
+
|
|
74
|
+
th_get_container(): DTBunch<any> | undefined {
|
|
75
|
+
return this._container;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
th_set_container(container: DTBunch<any>): void {
|
|
79
|
+
this._container = container;
|
|
80
|
+
}
|
|
65
81
|
}
|
|
66
82
|
/** ****************** STUB CLASS
|
|
67
83
|
* Stub class, for using in other component
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
|
2
|
-
import {
|
|
3
|
-
import {DTElementTest, IDTest, KeyTest} from './DTElement.double';
|
|
2
|
+
import {DomainTest, DTElementTest, IDTest, KeyTest} from './DTElement.double';
|
|
4
3
|
import {MeldrineMetaData} from './DTComponentWithMeta.double';
|
|
5
4
|
import {DTComponentPhysical, DTElement} from "../../src";
|
|
6
|
-
import {mockOverriddenMethods} from "./DTComponentPhysical.double";
|
|
5
|
+
import {mockOverriddenMethods, OwnerTest} from "./DTComponentPhysical.double";
|
|
6
|
+
import {DTBunchStub, IDTest as bunchIdTest} from "./DTBunch.double";
|
|
7
7
|
|
|
8
8
|
/******************** MOCK DEPENDENCIES
|
|
9
9
|
* All Dependencies used by the component are mocked with Jest
|
|
@@ -11,6 +11,7 @@ import {mockOverriddenMethods} from "./DTComponentPhysical.double";
|
|
|
11
11
|
jest.mock('../../src/core/DTComponent');
|
|
12
12
|
jest.mock('../../src/core/DTComponentWithMeta');
|
|
13
13
|
jest.mock('../../src/core/DTComponentPhysical');
|
|
14
|
+
jest.mock('../../src/core/DTBunch');
|
|
14
15
|
// Add specific mock for inherited methods to have a basic implementation
|
|
15
16
|
mockOverriddenMethods(DTComponentPhysical);
|
|
16
17
|
|
|
@@ -38,6 +39,41 @@ describe('class DYOToolsElement', () => {
|
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
|
|
42
|
+
describe('getContainer()', () => {
|
|
43
|
+
test('return undefined if no container - default case', () => {
|
|
44
|
+
expect(elementTest.getContainer()).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('return container', () => {
|
|
48
|
+
const container = new DTBunchStub();
|
|
49
|
+
elementTest.th_set_container(container);
|
|
50
|
+
|
|
51
|
+
expect(elementTest.getContainer()).toBeDefined();
|
|
52
|
+
expect(elementTest.getContainer().getId()).toStrictEqual(bunchIdTest);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('setContainer()', () => {
|
|
57
|
+
test('set a new container for element', () => {
|
|
58
|
+
const container = new DTBunchStub();
|
|
59
|
+
|
|
60
|
+
elementTest.setContainer(container);
|
|
61
|
+
|
|
62
|
+
expect(elementTest.th_get_container()).toBeDefined();
|
|
63
|
+
expect(elementTest.th_get_container().getId()).toStrictEqual(bunchIdTest);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('removeContainer()', () => {
|
|
68
|
+
test('remove the current container', () => {
|
|
69
|
+
const bunchContainer = new DTBunchStub();
|
|
70
|
+
elementTest.th_set_container(bunchContainer);
|
|
71
|
+
|
|
72
|
+
elementTest.removeContainer();
|
|
73
|
+
expect(elementTest.th_get_container()).toBeUndefined();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
41
77
|
describe('copy()', () => {
|
|
42
78
|
// @see copy.spec.ts for unit tests about copy method
|
|
43
79
|
})
|
|
@@ -58,19 +94,19 @@ describe('class DYOToolsElement', () => {
|
|
|
58
94
|
});
|
|
59
95
|
|
|
60
96
|
test('toObject output standard with owner', () => {
|
|
61
|
-
elementTest.th_set_owner(
|
|
97
|
+
elementTest.th_set_owner(OwnerTest);
|
|
62
98
|
|
|
63
99
|
const toObjectElement = elementTest.toObject();
|
|
64
100
|
|
|
65
101
|
expect(Object.keys(toObjectElement)).toStrictEqual(['id', 'key', 'type', 'owner']);
|
|
66
|
-
expect(toObjectElement.owner
|
|
102
|
+
expect(toObjectElement.owner).toBe(OwnerTest);
|
|
67
103
|
});
|
|
68
104
|
|
|
69
105
|
test('toObject output standard with owner and meta', () => {
|
|
70
106
|
jest.spyOn(elementTest, 'getManyMeta').mockImplementation(function () {
|
|
71
107
|
return this._meta;
|
|
72
108
|
});
|
|
73
|
-
elementTest.th_set_owner(
|
|
109
|
+
elementTest.th_set_owner(OwnerTest);
|
|
74
110
|
elementTest.th_set_meta(MeldrineMetaData);
|
|
75
111
|
|
|
76
112
|
const toObjectElement = elementTest.toObject();
|
|
@@ -91,12 +127,20 @@ describe('class DYOToolsElement', () => {
|
|
|
91
127
|
expect(toStringElement).toBe(`Component ${KeyTest} - Type: Element`);
|
|
92
128
|
});
|
|
93
129
|
|
|
130
|
+
test('string output standard with domain', () => {
|
|
131
|
+
elementTest.th_set_domain(DomainTest);
|
|
132
|
+
|
|
133
|
+
const toStringElement = elementTest.toString();
|
|
134
|
+
|
|
135
|
+
expect(toStringElement).toBe(`Component ${DomainTest} ${KeyTest} - Type: Element`);
|
|
136
|
+
});
|
|
137
|
+
|
|
94
138
|
test('string output standard with owner', () => {
|
|
95
|
-
elementTest.th_set_owner(
|
|
139
|
+
elementTest.th_set_owner(OwnerTest);
|
|
96
140
|
|
|
97
141
|
const toStringElement = elementTest.toString();
|
|
98
142
|
|
|
99
|
-
expect(toStringElement).toBe(`Component ${KeyTest} - Type: Element - Owner: ${
|
|
143
|
+
expect(toStringElement).toBe(`Component ${KeyTest} - Type: Element - Owner: ${OwnerTest}`);
|
|
100
144
|
});
|
|
101
145
|
});
|
|
102
146
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {DTError} from '../../src';
|
|
2
2
|
import {expect} from "@jest/globals";
|
|
3
|
-
import {MockedFunction} from "ts-jest";
|
|
4
3
|
import DYOToolsComponent from "../../src/core/DTComponent";
|
|
4
|
+
import MockedFunction = jest.MockedFunction;
|
|
5
5
|
|
|
6
6
|
/******************** STUB PROPERTIES CONSTANTS
|
|
7
7
|
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DTManager
|
|
1
|
+
import {expect} from '@jest/globals';
|
|
2
|
+
import {DTElement, DTManager} from '../../src';
|
|
3
3
|
import {
|
|
4
4
|
bunch1IdTest,
|
|
5
5
|
bunch1toObjectTest,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
DTBunchTest,
|
|
13
13
|
generateMockedElements,
|
|
14
14
|
} from './DTBunch.double';
|
|
15
|
-
import {
|
|
15
|
+
import {DTAcceptedMetaData, DTManagerItemsType, DTManagerOptions, DTManagerToObject} from '../../src/types';
|
|
16
16
|
import DYOFinder from '../../src/libs/DYOFinder';
|
|
17
17
|
|
|
18
18
|
/** ****************** STUB PROPERTIES CONSTANTS
|
|
@@ -23,6 +23,22 @@ export const KeyTest = 'DTManager-key-1234567';
|
|
|
23
23
|
export const DomainTest = 'DTManager-domain-test';
|
|
24
24
|
export const ScopesTest = ['DTManager-scope-test1', 'DTManager-scope-test2'];
|
|
25
25
|
|
|
26
|
+
// Specific Manager constants
|
|
27
|
+
export const manager1IDTest = `${IDTest}_1`;
|
|
28
|
+
export const manager1KeyTest = `${KeyTest}_1`;
|
|
29
|
+
|
|
30
|
+
export const manager1ToObject: DTManagerToObject = {
|
|
31
|
+
id: manager1IDTest,
|
|
32
|
+
key: manager1KeyTest,
|
|
33
|
+
type: 'manager',
|
|
34
|
+
items: [
|
|
35
|
+
{
|
|
36
|
+
scope: 'default',
|
|
37
|
+
...bunch1toObjectTest
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
/** ****************** HELPER TEST CLASS
|
|
27
43
|
* Helper test class, inherits the main component
|
|
28
44
|
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
@@ -48,6 +64,14 @@ export class DTManagerTest extends DTManager<DTElement<DTAcceptedMetaData>> {
|
|
|
48
64
|
return this._componentType;
|
|
49
65
|
}
|
|
50
66
|
|
|
67
|
+
th_get_domain(): string {
|
|
68
|
+
return this._domain;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
th_set_domain(domain: string): void {
|
|
72
|
+
this._domain = domain;
|
|
73
|
+
}
|
|
74
|
+
|
|
51
75
|
th_get_items(): any {
|
|
52
76
|
return this._items;
|
|
53
77
|
}
|
|
@@ -159,9 +183,9 @@ export function populateManager(manager: DTManagerTest): DTManagerTest {
|
|
|
159
183
|
const bunch3 = new DTBunchTest();
|
|
160
184
|
bunch3.th_set_items([]);
|
|
161
185
|
bunch3.th_set_id(bunch3IdTest);
|
|
162
|
-
bunch3.th_set_options({
|
|
186
|
+
bunch3.th_set_options({ virtualContainer: true });
|
|
163
187
|
jest.spyOn(bunch3, 'getId').mockImplementation(() => bunch3IdTest);
|
|
164
|
-
jest.spyOn(bunch3, 'getOptions').mockImplementation(() => ({ ...defaultOptions,
|
|
188
|
+
jest.spyOn(bunch3, 'getOptions').mockImplementation(() => ({ ...defaultOptions, virtualContainer: true }));
|
|
165
189
|
jest.spyOn(bunch3, 'getAll').mockImplementation(function () { return this._items; });
|
|
166
190
|
jest.spyOn(bunch3, 'toObject').mockImplementation(() => bunch3toObjectTest);
|
|
167
191
|
|