|
@@ -333,37 +333,51 @@ describe('Commands', () => {
|
333
|
333
|
});
|
334
|
334
|
});
|
335
|
335
|
|
336
|
|
- xit('notify on all commands', () => {
|
|
336
|
+ it('notify on all commands', () => {
|
337
|
337
|
_.forEach(getAllMethodsOfUut(), (m) => {
|
338
|
338
|
uut[m]();
|
339
|
339
|
});
|
340
|
340
|
expect(cb).toHaveBeenCalledTimes(getAllMethodsOfUut().length);
|
341
|
341
|
});
|
342
|
342
|
|
343
|
|
- it('setRoot', () => {
|
344
|
|
- uut.setRoot({});
|
345
|
|
- expect(cb).toHaveBeenCalledTimes(1);
|
346
|
|
- expect(cb).toHaveBeenCalledWith('setRoot', { layout: 'parsed' });
|
347
|
|
- });
|
348
|
|
-
|
349
|
|
- it('setDefaultOptions', () => {
|
350
|
|
- const options = { x: 1 };
|
351
|
|
- uut.setDefaultOptions(options);
|
352
|
|
- expect(cb).toHaveBeenCalledTimes(1);
|
353
|
|
- expect(cb).toHaveBeenCalledWith('setDefaultOptions', { options });
|
354
|
|
- });
|
355
|
|
-
|
356
|
|
- it('setOptions', () => {
|
357
|
|
- const options = { x: 1 };
|
358
|
|
- uut.setOptions('compId', options);
|
359
|
|
- expect(cb).toHaveBeenCalledTimes(1);
|
360
|
|
- expect(cb).toHaveBeenCalledWith('setOptions', { componentId: 'compId', options });
|
361
|
|
- });
|
362
|
|
-
|
363
|
|
- it('showModal', () => {
|
364
|
|
- uut.showModal({});
|
365
|
|
- expect(cb).toHaveBeenCalledTimes(1);
|
366
|
|
- expect(cb).toHaveBeenCalledWith('showModal', { layout: 'parsed' });
|
|
343
|
+ describe('passes correct params', () => {
|
|
344
|
+ const argsForMethodName = {
|
|
345
|
+ setRoot: [{}],
|
|
346
|
+ setDefaultOptions: [{}],
|
|
347
|
+ setOptions: ['id', {}],
|
|
348
|
+ showModal: [{}],
|
|
349
|
+ dismissModal: ['id'],
|
|
350
|
+ dismissAllModals: [],
|
|
351
|
+ push: ['id', {}],
|
|
352
|
+ pop: ['id', {}],
|
|
353
|
+ popTo: ['id'],
|
|
354
|
+ popToRoot: ['id'],
|
|
355
|
+ showOverlay: [{}],
|
|
356
|
+ dismissOverlay: ['id'],
|
|
357
|
+ };
|
|
358
|
+ const paramsForMethodName = {
|
|
359
|
+ setRoot: { layout: 'parsed' },
|
|
360
|
+ setDefaultOptions: { options: {} },
|
|
361
|
+ setOptions: { componentId: 'id', options: {} },
|
|
362
|
+ showModal: { layout: 'parsed' },
|
|
363
|
+ dismissModal: { componentId: 'id' },
|
|
364
|
+ dismissAllModals: {},
|
|
365
|
+ push: { componentId: 'id', layout: 'parsed' },
|
|
366
|
+ pop: { componentId: 'id', options: {} },
|
|
367
|
+ popTo: { componentId: 'id' },
|
|
368
|
+ popToRoot: { componentId: 'id' },
|
|
369
|
+ showOverlay: { layout: 'parsed' },
|
|
370
|
+ dismissOverlay: { componentId: 'id' },
|
|
371
|
+ };
|
|
372
|
+ _.forEach(getAllMethodsOfUut(), (m) => {
|
|
373
|
+ it(`for ${m}`, () => {
|
|
374
|
+ expect(argsForMethodName).toHaveProperty(m);
|
|
375
|
+ expect(paramsForMethodName).toHaveProperty(m);
|
|
376
|
+ _.invoke(uut, m, ...argsForMethodName[m]);
|
|
377
|
+ expect(cb).toHaveBeenCalledTimes(1);
|
|
378
|
+ expect(cb).toHaveBeenCalledWith(m, paramsForMethodName[m]);
|
|
379
|
+ });
|
|
380
|
+ });
|
367
|
381
|
});
|
368
|
382
|
});
|
369
|
383
|
});
|