selectic 3.1.0 → 3.1.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/selectic.common.js +110 -22
- package/dist/selectic.esm.js +110 -22
- package/doc/breakingChanges.md +8 -0
- package/doc/changeIcons.md +8 -2
- package/package.json +1 -1
- package/src/ExtendedList.tsx +5 -5
- package/src/Icon.tsx +2 -2
- package/src/List.tsx +0 -4
- package/src/Store.tsx +161 -25
- package/src/index.tsx +2 -2
- package/src/tools.ts +13 -0
- package/test/Store/Store_creation.spec.js +12 -12
- package/test/Store/Store_props.spec.js +612 -595
- package/test/Store/changeIcons.spec.js +1 -1
- package/test/Store/commit.spec.js +56 -47
- package/test/Store/selectGroup.spec.js +278 -271
- package/test/Store/toggleSelectAll.spec.js +6 -1
- package/test/helper.js +4 -0
- package/test/tools.js +5 -1
- package/types/ExtendedList.d.ts +5 -5
- package/types/List.d.ts +0 -3
- package/types/Store.d.ts +15 -2
- package/types/index.d.ts +2 -2
- package/types/tools.d.ts +4 -0
|
@@ -3,7 +3,7 @@ const _ = require('../tools.js');
|
|
|
3
3
|
const StoreFile = require('../dist/Store.js');
|
|
4
4
|
const Store = StoreFile.default;
|
|
5
5
|
|
|
6
|
-
tape.
|
|
6
|
+
tape.test('changeIcons()', (sTest) => {
|
|
7
7
|
sTest.test('should have default icons', (t) => {
|
|
8
8
|
const store = new Store();
|
|
9
9
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const _ = require('../tools.js');
|
|
2
2
|
const {
|
|
3
|
+
DEBOUNCE_REQUEST,
|
|
3
4
|
getInitialState,
|
|
4
5
|
getOptions,
|
|
5
6
|
getGroups,
|
|
@@ -40,7 +41,7 @@ tape.test('commit()', (st) => {
|
|
|
40
41
|
store.commit('searchText', 'hello2');
|
|
41
42
|
t.deepEqual(store.state.searchText, 'hello2');
|
|
42
43
|
/* display should be reset */
|
|
43
|
-
t.deepEqual(store.state.offsetItem, 0);
|
|
44
|
+
t.deepEqual(store.state.offsetItem, 0, 'should reset offset');
|
|
44
45
|
t.deepEqual(store.state.activeItemIdx, -1);
|
|
45
46
|
t.end();
|
|
46
47
|
});
|
|
@@ -62,7 +63,7 @@ tape.test('commit()', (st) => {
|
|
|
62
63
|
resetCall(spy);
|
|
63
64
|
command.fetch();
|
|
64
65
|
|
|
65
|
-
await _.nextVueTick(store, command.promise);
|
|
66
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
66
67
|
|
|
67
68
|
// after initial fetch
|
|
68
69
|
t.deepEqual(store.state.status.searching, false);
|
|
@@ -80,9 +81,9 @@ tape.test('commit()', (st) => {
|
|
|
80
81
|
resetCall(spy);
|
|
81
82
|
|
|
82
83
|
command.fetch();
|
|
83
|
-
await _.nextVueTick(store, command.promise);
|
|
84
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
84
85
|
|
|
85
|
-
// receive
|
|
86
|
+
// receive response
|
|
86
87
|
t.deepEqual(store.state.status.searching, false);
|
|
87
88
|
t.deepEqual(store.state.allOptions.length, 200);
|
|
88
89
|
t.deepEqual(store.state.totalAllOptions, 300);
|
|
@@ -122,7 +123,7 @@ tape.test('commit()', (st) => {
|
|
|
122
123
|
resetCall(spy);
|
|
123
124
|
|
|
124
125
|
command.fetch();
|
|
125
|
-
await _.nextVueTick(store, command.promise);
|
|
126
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
126
127
|
|
|
127
128
|
// after initial fetch
|
|
128
129
|
t.deepEqual(store.state.status.searching, false);
|
|
@@ -224,7 +225,7 @@ tape.test('commit()', (st) => {
|
|
|
224
225
|
command.fetch();
|
|
225
226
|
resetCall(spy);
|
|
226
227
|
|
|
227
|
-
await sleep(0);
|
|
228
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
228
229
|
|
|
229
230
|
const search = 'search';
|
|
230
231
|
store.commit('searchText', search);
|
|
@@ -236,7 +237,7 @@ tape.test('commit()', (st) => {
|
|
|
236
237
|
|
|
237
238
|
await sleep(0);
|
|
238
239
|
command.fetch();
|
|
239
|
-
await _.nextVueTick(store, command.promise);
|
|
240
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
240
241
|
|
|
241
242
|
// after initial fetch
|
|
242
243
|
t.deepEqual(store.state.status.searching, false);
|
|
@@ -253,7 +254,7 @@ tape.test('commit()', (st) => {
|
|
|
253
254
|
t.deepEqual(store.state.status.searching, true);
|
|
254
255
|
resetCall(spy);
|
|
255
256
|
command.fetch();
|
|
256
|
-
await _.nextVueTick(store, command.promise);
|
|
257
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
257
258
|
|
|
258
259
|
// receive response
|
|
259
260
|
t.deepEqual(store.state.status.searching, false);
|
|
@@ -285,6 +286,8 @@ tape.test('commit()', (st) => {
|
|
|
285
286
|
});
|
|
286
287
|
store.commit('isOpen', true);
|
|
287
288
|
command.fetch();
|
|
289
|
+
await _.nextVueTick(store, command.promise);
|
|
290
|
+
|
|
288
291
|
resetCall(spy);
|
|
289
292
|
let search = 'search';
|
|
290
293
|
store.commit('searchText', search);
|
|
@@ -295,6 +298,7 @@ tape.test('commit()', (st) => {
|
|
|
295
298
|
// after initial fetch
|
|
296
299
|
store.commit('offsetItem', 100);
|
|
297
300
|
|
|
301
|
+
await sleep(DEBOUNCE_REQUEST); // because there are concurrent requests
|
|
298
302
|
resetCall(spy);
|
|
299
303
|
command.fetch();
|
|
300
304
|
await _.nextVueTick(store, command.promise);
|
|
@@ -362,7 +366,7 @@ tape.test('commit()', (st) => {
|
|
|
362
366
|
t.is(store.state.status.searching, true);
|
|
363
367
|
resetCall(spy);
|
|
364
368
|
command.fetch();
|
|
365
|
-
await _.nextVueTick(store, command.promise);
|
|
369
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
366
370
|
|
|
367
371
|
// after initial fetch
|
|
368
372
|
t.is(store.state.status.searching, false);
|
|
@@ -395,22 +399,25 @@ tape.test('commit()', (st) => {
|
|
|
395
399
|
const store = new Store({
|
|
396
400
|
fetchCallback: buildFetchCb({ total: 300, searchTotal: 250, addPrefix: true, command, spy }),
|
|
397
401
|
});
|
|
402
|
+
|
|
398
403
|
store.commit('isOpen', true);
|
|
399
404
|
command.fetch();
|
|
400
405
|
resetCall(spy);
|
|
401
406
|
|
|
402
407
|
let search = 'search1';
|
|
403
408
|
store.commit('searchText', search);
|
|
409
|
+
await _.nextVueTick(store, sleep(DEBOUNCE_REQUEST));
|
|
404
410
|
|
|
405
|
-
t.true(toHaveBeenCalledWith(spy, [search, 0, 100]));
|
|
411
|
+
t.true(toHaveBeenCalledWith(spy, [search, 0, 100]), 'should have been called with parameters');
|
|
406
412
|
t.is(store.state.status.searching, true);
|
|
407
413
|
t.deepEqual(store.state.filteredOptions.length, 0);
|
|
414
|
+
|
|
408
415
|
const fetch1 = command.fetch;
|
|
409
416
|
const promise1 = spy.promise;
|
|
410
417
|
|
|
411
|
-
await sleep(0);
|
|
412
418
|
search = 'search2';
|
|
413
419
|
store.commit('searchText', search);
|
|
420
|
+
await _.nextVueTick(store, sleep(DEBOUNCE_REQUEST));
|
|
414
421
|
|
|
415
422
|
t.true(toHaveBeenCalledWith(spy, [search, 0, 100]));
|
|
416
423
|
t.is(store.state.status.searching, true);
|
|
@@ -418,9 +425,10 @@ tape.test('commit()', (st) => {
|
|
|
418
425
|
const fetch2 = command.fetch;
|
|
419
426
|
const promise2 = spy.promise;
|
|
420
427
|
|
|
421
|
-
|
|
428
|
+
/* create a new search while previous one is not resolved */
|
|
422
429
|
search = 'search3';
|
|
423
430
|
store.commit('searchText', search);
|
|
431
|
+
await _.nextVueTick(store, sleep(DEBOUNCE_REQUEST));
|
|
424
432
|
|
|
425
433
|
t.true(toHaveBeenCalledWith(spy, [search, 0, 100]));
|
|
426
434
|
t.is(store.state.status.searching, true);
|
|
@@ -477,7 +485,7 @@ tape.test('commit()', (st) => {
|
|
|
477
485
|
store.commit('isOpen', true);
|
|
478
486
|
command.fetch();
|
|
479
487
|
resetCall(spy);
|
|
480
|
-
await sleep(0);
|
|
488
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request resolution */);
|
|
481
489
|
|
|
482
490
|
const search = '2';
|
|
483
491
|
store.commit('searchText', search);
|
|
@@ -489,7 +497,7 @@ tape.test('commit()', (st) => {
|
|
|
489
497
|
|
|
490
498
|
await sleep(0);
|
|
491
499
|
command.fetch();
|
|
492
|
-
await _.nextVueTick(store, command.promise);
|
|
500
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
493
501
|
|
|
494
502
|
t.is(store.state.status.searching, false);
|
|
495
503
|
t.deepEqual(store.state.allOptions.length, 103);
|
|
@@ -514,7 +522,7 @@ tape.test('commit()', (st) => {
|
|
|
514
522
|
store.commit('isOpen', true);
|
|
515
523
|
command.fetch();
|
|
516
524
|
resetCall(spy);
|
|
517
|
-
await sleep(0);
|
|
525
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request resolution */);
|
|
518
526
|
|
|
519
527
|
const search = '2';
|
|
520
528
|
store.commit('searchText', search);
|
|
@@ -526,7 +534,7 @@ tape.test('commit()', (st) => {
|
|
|
526
534
|
|
|
527
535
|
await sleep(0);
|
|
528
536
|
command.fetch();
|
|
529
|
-
await _.nextVueTick(store, command.promise);
|
|
537
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request resolution */);
|
|
530
538
|
|
|
531
539
|
t.is(store.state.status.searching, false);
|
|
532
540
|
t.deepEqual(store.state.allOptions.length, 100);
|
|
@@ -579,7 +587,7 @@ tape.test('commit()', (st) => {
|
|
|
579
587
|
store.commit('isOpen', true);
|
|
580
588
|
command.fetch();
|
|
581
589
|
resetCall(spy);
|
|
582
|
-
await sleep(0);
|
|
590
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request resolution */);
|
|
583
591
|
|
|
584
592
|
const search = '2';
|
|
585
593
|
store.commit('searchText', search);
|
|
@@ -591,7 +599,7 @@ tape.test('commit()', (st) => {
|
|
|
591
599
|
|
|
592
600
|
await sleep(0);
|
|
593
601
|
command.fetch();
|
|
594
|
-
await _.nextVueTick(store, command.promise);
|
|
602
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
595
603
|
|
|
596
604
|
t.is(store.state.status.searching, false);
|
|
597
605
|
t.deepEqual(store.state.filteredOptions.length, 0);
|
|
@@ -614,7 +622,7 @@ tape.test('commit()', (st) => {
|
|
|
614
622
|
});
|
|
615
623
|
store.commit('isOpen', true);
|
|
616
624
|
command.fetch();
|
|
617
|
-
await sleep(0);
|
|
625
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request is resolved */);
|
|
618
626
|
|
|
619
627
|
const search = '2';
|
|
620
628
|
store.commit('searchText', search);
|
|
@@ -625,7 +633,7 @@ tape.test('commit()', (st) => {
|
|
|
625
633
|
store.commit('searchText', '');
|
|
626
634
|
await sleep(0);
|
|
627
635
|
command.fetch();
|
|
628
|
-
await _.nextVueTick(store, command.promise);
|
|
636
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await build allOptions */);
|
|
629
637
|
|
|
630
638
|
t.is(store.state.status.searching, false);
|
|
631
639
|
t.deepEqual(store.state.filteredOptions.length, 103);
|
|
@@ -654,16 +662,16 @@ tape.test('commit()', (st) => {
|
|
|
654
662
|
store.commit('isOpen', true);
|
|
655
663
|
|
|
656
664
|
command.fetch();
|
|
657
|
-
await _.nextVueTick(store, command.promise);
|
|
665
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
658
666
|
|
|
659
667
|
store.commit('offsetItem', 100);
|
|
660
668
|
command.fetch();
|
|
661
|
-
await _.nextVueTick(store, command.promise);
|
|
669
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
662
670
|
|
|
663
671
|
resetCall(spy);
|
|
664
672
|
store.commit('offsetItem', 70);
|
|
665
673
|
command.fetch();
|
|
666
|
-
await _.nextVueTick(store, command.promise);
|
|
674
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
667
675
|
|
|
668
676
|
t.false(toHaveBeenCalled(spy));
|
|
669
677
|
t.deepEqual(store.state.allOptions.length, 200);
|
|
@@ -681,12 +689,12 @@ tape.test('commit()', (st) => {
|
|
|
681
689
|
store.commit('isOpen', true);
|
|
682
690
|
|
|
683
691
|
command.fetch();
|
|
684
|
-
await _.nextVueTick(store, command.promise);
|
|
692
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
685
693
|
|
|
686
694
|
resetCall(spy);
|
|
687
695
|
store.commit('offsetItem', 50);
|
|
688
696
|
command.fetch();
|
|
689
|
-
await _.nextVueTick(store, command.promise);
|
|
697
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
690
698
|
|
|
691
699
|
t.false(toHaveBeenCalled(spy));
|
|
692
700
|
t.deepEqual(store.state.allOptions.length, 100);
|
|
@@ -705,12 +713,12 @@ tape.test('commit()', (st) => {
|
|
|
705
713
|
store.commit('isOpen', true);
|
|
706
714
|
|
|
707
715
|
command.fetch();
|
|
708
|
-
await _.nextVueTick(store, command.promise);
|
|
716
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
709
717
|
|
|
710
718
|
resetCall(spy);
|
|
711
719
|
store.commit('offsetItem', 51);
|
|
712
720
|
command.fetch();
|
|
713
|
-
await _.nextVueTick(store, command.promise);
|
|
721
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
714
722
|
|
|
715
723
|
t.true(toHaveBeenCalledWith(spy, ['', 100, 100]));
|
|
716
724
|
t.deepEqual(store.state.allOptions.length, 200);
|
|
@@ -719,7 +727,7 @@ tape.test('commit()', (st) => {
|
|
|
719
727
|
resetCall(spy);
|
|
720
728
|
store.commit('offsetItem', 190);
|
|
721
729
|
command.fetch();
|
|
722
|
-
await _.nextVueTick(store, command.promise);
|
|
730
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
723
731
|
|
|
724
732
|
t.true(toHaveBeenCalledWith(spy, ['', 200, 100]));
|
|
725
733
|
t.deepEqual(store.state.allOptions.length, 300);
|
|
@@ -738,12 +746,12 @@ tape.test('commit()', (st) => {
|
|
|
738
746
|
store.commit('isOpen', true);
|
|
739
747
|
|
|
740
748
|
command.fetch();
|
|
741
|
-
await _.nextVueTick(store, command.promise);
|
|
749
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
742
750
|
|
|
743
751
|
resetCall(spy);
|
|
744
752
|
store.commit('offsetItem', 180);
|
|
745
753
|
command.fetch();
|
|
746
|
-
await _.nextVueTick(store, command.promise);
|
|
754
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
747
755
|
|
|
748
756
|
t.true(toHaveBeenCalledWith(spy, ['', 100, 200]));
|
|
749
757
|
t.deepEqual(store.state.allOptions.length, 300);
|
|
@@ -767,7 +775,7 @@ tape.test('commit()', (st) => {
|
|
|
767
775
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
768
776
|
nbTry = command.usage;
|
|
769
777
|
command.fetch();
|
|
770
|
-
await _.nextVueTick(store, command.promise);
|
|
778
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
771
779
|
}
|
|
772
780
|
|
|
773
781
|
t.is(command.usage, 1, 'the fetch is done only once to get first page');
|
|
@@ -779,7 +787,7 @@ tape.test('commit()', (st) => {
|
|
|
779
787
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
780
788
|
nbTry = command.usage;
|
|
781
789
|
command.fetch();
|
|
782
|
-
await _.nextVueTick(store, command.promise);
|
|
790
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
783
791
|
}
|
|
784
792
|
|
|
785
793
|
t.is(command.usage, 1, 'fetch missing options only once');
|
|
@@ -809,6 +817,7 @@ tape.test('commit()', (st) => {
|
|
|
809
817
|
case 2:
|
|
810
818
|
/* returns only some options */
|
|
811
819
|
result.result = result.result.slice(0, 25);
|
|
820
|
+
break;
|
|
812
821
|
default:
|
|
813
822
|
/* do not change the result */
|
|
814
823
|
}
|
|
@@ -819,7 +828,7 @@ tape.test('commit()', (st) => {
|
|
|
819
828
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
820
829
|
nbTry = command.usage;
|
|
821
830
|
command.fetch();
|
|
822
|
-
await _.nextVueTick(store, command.promise);
|
|
831
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
823
832
|
}
|
|
824
833
|
|
|
825
834
|
t.is(command.usage > 1, true, 'should fetch first options with several fetch');
|
|
@@ -833,14 +842,14 @@ tape.test('commit()', (st) => {
|
|
|
833
842
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
834
843
|
nbTry = command.usage;
|
|
835
844
|
command.fetch();
|
|
836
|
-
await _.nextVueTick(store, command.promise);
|
|
845
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
837
846
|
}
|
|
838
847
|
|
|
839
848
|
t.is(command.usage > 1, true, 'should fetch missing options with several fetch');
|
|
840
849
|
t.is(command.usage < 10, true, 'should have stop fetching by itself');
|
|
841
850
|
|
|
842
|
-
t.
|
|
843
|
-
t.is(store.state.status.errorMessage, '');
|
|
851
|
+
t.is(store.state.allOptions.length >= 180 + 50, true, 'should have at least the number of items + margin');
|
|
852
|
+
t.is(store.state.status.errorMessage, '', 'should have no error message');
|
|
844
853
|
|
|
845
854
|
t.end();
|
|
846
855
|
});
|
|
@@ -866,7 +875,7 @@ tape.test('commit()', (st) => {
|
|
|
866
875
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
867
876
|
nbTry = command.usage;
|
|
868
877
|
command.fetch();
|
|
869
|
-
await _.nextVueTick(store, command.promise);
|
|
878
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
870
879
|
}
|
|
871
880
|
|
|
872
881
|
t.is(command.usage > 1, true, 'should have try to fetch several times');
|
|
@@ -879,7 +888,7 @@ tape.test('commit()', (st) => {
|
|
|
879
888
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
880
889
|
nbTry = command.usage;
|
|
881
890
|
command.fetch();
|
|
882
|
-
await _.nextVueTick(store, command.promise);
|
|
891
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
883
892
|
}
|
|
884
893
|
|
|
885
894
|
t.is(command.usage < 10, true, 'should have stop fetching');
|
|
@@ -908,7 +917,7 @@ tape.test('commit()', (st) => {
|
|
|
908
917
|
while (nbTry !== command.usage && nbTry < 10) {
|
|
909
918
|
nbTry = command.usage;
|
|
910
919
|
command.fetch();
|
|
911
|
-
await _.nextVueTick(store, command.promise);
|
|
920
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
912
921
|
}
|
|
913
922
|
|
|
914
923
|
t.is(command.usage > 1, true, 'should have try to fetch several times');
|
|
@@ -948,7 +957,7 @@ tape.test('commit()', (st) => {
|
|
|
948
957
|
store.commit('isOpen', true);
|
|
949
958
|
|
|
950
959
|
command.fetch();
|
|
951
|
-
await _.nextVueTick(store, command.promise);
|
|
960
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
952
961
|
|
|
953
962
|
t.true(toHaveBeenCalledWith(spy, ['', 0, 100]));
|
|
954
963
|
t.deepEqual(store.state.allOptions.length, 100);
|
|
@@ -960,7 +969,7 @@ tape.test('commit()', (st) => {
|
|
|
960
969
|
resetCall(spy);
|
|
961
970
|
store.commit('offsetItem', 100);
|
|
962
971
|
command.fetch();
|
|
963
|
-
await _.nextVueTick(store, command.promise);
|
|
972
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
964
973
|
|
|
965
974
|
/* The items of the first group have been fetched */
|
|
966
975
|
t.true(toHaveBeenCalledWith(spy, ['', 100, 100]));
|
|
@@ -973,7 +982,7 @@ tape.test('commit()', (st) => {
|
|
|
973
982
|
resetCall(spy);
|
|
974
983
|
store.commit('offsetItem', 151);
|
|
975
984
|
command.fetch();
|
|
976
|
-
await _.nextVueTick(store, command.promise);
|
|
985
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
977
986
|
|
|
978
987
|
/* As there is the group item which has been added
|
|
979
988
|
* we currently have all data so there is no query */
|
|
@@ -986,7 +995,7 @@ tape.test('commit()', (st) => {
|
|
|
986
995
|
|
|
987
996
|
store.commit('offsetItem', 152);
|
|
988
997
|
command.fetch();
|
|
989
|
-
await _.nextVueTick(store, command.promise);
|
|
998
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
990
999
|
|
|
991
1000
|
/* The items of the second group have been fetched */
|
|
992
1001
|
t.true(toHaveBeenCalledWith(spy, ['', 200, 100]));
|
|
@@ -999,7 +1008,7 @@ tape.test('commit()', (st) => {
|
|
|
999
1008
|
resetCall(spy);
|
|
1000
1009
|
store.commit('offsetItem', 252);
|
|
1001
1010
|
command.fetch();
|
|
1002
|
-
await _.nextVueTick(store, command.promise);
|
|
1011
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
1003
1012
|
|
|
1004
1013
|
/* As there are the group items which have been added
|
|
1005
1014
|
* we currently have all data so there is no query */
|
|
@@ -1012,7 +1021,7 @@ tape.test('commit()', (st) => {
|
|
|
1012
1021
|
|
|
1013
1022
|
store.commit('offsetItem', 253);
|
|
1014
1023
|
command.fetch();
|
|
1015
|
-
await _.nextVueTick(store, command.promise);
|
|
1024
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
1016
1025
|
|
|
1017
1026
|
/* Next items are in second group, so no more group
|
|
1018
1027
|
* item has been added in filteredOptions */
|
|
@@ -1066,7 +1075,7 @@ tape.test('commit()', (st) => {
|
|
|
1066
1075
|
t.deepEqual(store.state.status.searching, true);
|
|
1067
1076
|
resetCall(spy);
|
|
1068
1077
|
command.fetch();
|
|
1069
|
-
await _.nextVueTick(store, command.promise);
|
|
1078
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
1070
1079
|
|
|
1071
1080
|
// after initial search
|
|
1072
1081
|
t.deepEqual(store.state.status.searching, false);
|
|
@@ -1084,7 +1093,7 @@ tape.test('commit()', (st) => {
|
|
|
1084
1093
|
t.deepEqual(store.state.status.searching, true);
|
|
1085
1094
|
resetCall(spy);
|
|
1086
1095
|
command.fetch();
|
|
1087
|
-
await _.nextVueTick(store, command.promise);
|
|
1096
|
+
await _.nextVueTick(store, command.promise, sleep(0) /* await request to be computed */);
|
|
1088
1097
|
|
|
1089
1098
|
// receive response
|
|
1090
1099
|
t.deepEqual(store.state.status.searching, false);
|