@blaze-cms/react-page-builder 0.122.0 → 0.122.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.
Files changed (22) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/lib/components/DataSummary/helpers/get-link-to-published-content.js +5 -2
  3. package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  4. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +15 -50
  5. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  6. package/lib/helpers/get-filter-props.js +3 -1
  7. package/lib/helpers/get-filter-props.js.map +1 -1
  8. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +3 -2
  9. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  10. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +10 -40
  11. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  12. package/lib-es/helpers/get-filter-props.js +2 -1
  13. package/lib-es/helpers/get-filter-props.js.map +1 -1
  14. package/package.json +2 -2
  15. package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -2
  16. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +113 -148
  17. package/src/helpers/get-filter-props.js +4 -1
  18. package/tests/helpers/mocks.js +6 -0
  19. package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +18 -4
  20. package/tests/unit/src/components/SearchFilter/SearchFilter/SearchFilter.test.js +64 -86
  21. package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +133 -61
  22. package/tests/unit/src/helpers/get-filter-props.test.js +10 -0
@@ -1,9 +1,77 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`SearchFilter component should render without throwing error and match snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <form
6
+ class="filter__form filter__form--initial filter__form--collapsible"
7
+ data-testid="filter-test-form"
8
+ id="filter-test-form"
9
+ >
10
+ <div
11
+ class="filter filter--search-refine"
12
+ >
13
+ <div
14
+ class="filter__reset"
15
+ >
16
+ <button
17
+ class="icon-button icon-button--reset"
18
+ data-testid="reset-icon"
19
+ title="reset--button"
20
+ type="button"
21
+ >
22
+ <i>
23
+ <svg
24
+ fill="currentColor"
25
+ height="1em"
26
+ stroke="currentColor"
27
+ stroke-width="0"
28
+ viewBox="0 0 512 512"
29
+ width="1em"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ >
32
+ <path
33
+ d="M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z"
34
+ />
35
+ </svg>
36
+ </i>
37
+ </button>
38
+ <div
39
+ data-testid="reset-button"
40
+ role="button"
41
+ >
42
+ Reset all filters
43
+ </div>
44
+ </div>
45
+ <div
46
+ class="filter__wrapper filter__wrapper--search-refine"
47
+ >
48
+ <br />
49
+ <button
50
+ class="button button--full-width"
51
+ type="submit"
52
+ >
53
+ Search
54
+ </button>
55
+ </div>
56
+ </div>
57
+ </form>
58
+ <div
59
+ class="filter__refine filter__refine--mobile-close"
60
+ data-testid="refine-mobile"
61
+ >
62
+ <div
63
+ role="button"
64
+ >
65
+ Refine Search
66
+ </div>
67
+ </div>
68
+ </DocumentFragment>
69
+ `;
70
+
3
71
  exports[`SearchFilter component when groupAfterMobile = 0 and groupAfterDesktop > 0 should render without throwing error and match snapshot 1`] = `
4
72
  <DocumentFragment>
5
73
  <form
6
- class=""
74
+ class="filter__form filter__form--initial filter__form--collapsible"
7
75
  data-testid="filter-test-form"
8
76
  id="filter-test-form"
9
77
  >
@@ -160,13 +228,23 @@ exports[`SearchFilter component when groupAfterMobile = 0 and groupAfterDesktop
160
228
  </div>
161
229
  </div>
162
230
  </form>
231
+ <div
232
+ class="filter__refine filter__refine--mobile-close"
233
+ data-testid="refine-mobile"
234
+ >
235
+ <div
236
+ role="button"
237
+ >
238
+ Refine Search
239
+ </div>
240
+ </div>
163
241
  </DocumentFragment>
164
242
  `;
165
243
 
166
244
  exports[`SearchFilter component when groupAfterMobile > 0 and groupAfterDesktop = 0 should render without throwing error and match snapshot 1`] = `
167
245
  <DocumentFragment>
168
246
  <form
169
- class=""
247
+ class="filter__form filter__form--initial filter__form--collapsible"
170
248
  data-testid="filter-test-form"
171
249
  id="filter-test-form"
172
250
  >
@@ -323,13 +401,23 @@ exports[`SearchFilter component when groupAfterMobile > 0 and groupAfterDesktop
323
401
  </div>
324
402
  </div>
325
403
  </form>
404
+ <div
405
+ class="filter__refine filter__refine--mobile-close"
406
+ data-testid="refine-mobile"
407
+ >
408
+ <div
409
+ role="button"
410
+ >
411
+ Refine Search
412
+ </div>
413
+ </div>
326
414
  </DocumentFragment>
327
415
  `;
328
416
 
329
417
  exports[`SearchFilter component when groupAfterMobile > 0 and groupAfterDesktop > 0 should render without throwing error and match snapshot 1`] = `
330
418
  <DocumentFragment>
331
419
  <form
332
- class=""
420
+ class="filter__form filter__form--initial filter__form--collapsible"
333
421
  data-testid="filter-test-form"
334
422
  id="filter-test-form"
335
423
  >
@@ -492,71 +580,23 @@ exports[`SearchFilter component when groupAfterMobile > 0 and groupAfterDesktop
492
580
  </div>
493
581
  </div>
494
582
  </form>
495
- </DocumentFragment>
496
- `;
497
-
498
- exports[`SearchFilter component when the device is desktop should render without throwing error and match snapshot 1`] = `
499
- <DocumentFragment>
500
- <form
501
- class=""
502
- data-testid="filter-test-form"
503
- id="filter-test-form"
583
+ <div
584
+ class="filter__refine filter__refine--mobile-close"
585
+ data-testid="refine-mobile"
504
586
  >
505
587
  <div
506
- class="filter filter--search-refine"
588
+ role="button"
507
589
  >
508
- <div
509
- class="filter__reset"
510
- >
511
- <button
512
- class="icon-button icon-button--reset"
513
- data-testid="reset-icon"
514
- title="reset--button"
515
- type="button"
516
- >
517
- <i>
518
- <svg
519
- fill="currentColor"
520
- height="1em"
521
- stroke="currentColor"
522
- stroke-width="0"
523
- viewBox="0 0 512 512"
524
- width="1em"
525
- xmlns="http://www.w3.org/2000/svg"
526
- >
527
- <path
528
- d="M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z"
529
- />
530
- </svg>
531
- </i>
532
- </button>
533
- <div
534
- data-testid="reset-button"
535
- role="button"
536
- >
537
- Reset all filters
538
- </div>
539
- </div>
540
- <div
541
- class="filter__wrapper filter__wrapper--search-refine"
542
- >
543
- <br />
544
- <button
545
- class="button button--full-width"
546
- type="submit"
547
- >
548
- Search
549
- </button>
550
- </div>
590
+ Refine Search
551
591
  </div>
552
- </form>
592
+ </div>
553
593
  </DocumentFragment>
554
594
  `;
555
595
 
556
- exports[`SearchFilter component when the device is mobile when isCollapsedOnResponsive = false, displaySearchFilter = false should render without throwing error and match snapshot 1`] = `
596
+ exports[`SearchFilter component when isCollapsedOnResponsive = false, displaySearchFilter = false should render without throwing error and match snapshot 1`] = `
557
597
  <DocumentFragment>
558
598
  <form
559
- class=""
599
+ class="filter__form filter__form--initial"
560
600
  data-testid="filter-test-form"
561
601
  id="filter-test-form"
562
602
  >
@@ -611,10 +651,10 @@ exports[`SearchFilter component when the device is mobile when isCollapsedOnResp
611
651
  </DocumentFragment>
612
652
  `;
613
653
 
614
- exports[`SearchFilter component when the device is mobile when isCollapsedOnResponsive = true, displaySearchFilter = true should render without throwing error and match snapshot 1`] = `
654
+ exports[`SearchFilter component when isCollapsedOnResponsive = true, displaySearchFilter = true should render without throwing error and match snapshot 1`] = `
615
655
  <DocumentFragment>
616
656
  <form
617
- class="filter__form filter__form--mobile"
657
+ class="filter__form filter__form--initial filter__form--mobile filter__form--collapsible"
618
658
  data-testid="filter-test-form"
619
659
  id="filter-test-form"
620
660
  >
@@ -649,6 +689,38 @@ exports[`SearchFilter component when the device is mobile when isCollapsedOnResp
649
689
  <div
650
690
  class="filter filter--search-refine"
651
691
  >
692
+ <div
693
+ class="filter__reset"
694
+ >
695
+ <button
696
+ class="icon-button icon-button--reset"
697
+ data-testid="reset-icon"
698
+ title="reset--button"
699
+ type="button"
700
+ >
701
+ <i>
702
+ <svg
703
+ fill="currentColor"
704
+ height="1em"
705
+ stroke="currentColor"
706
+ stroke-width="0"
707
+ viewBox="0 0 512 512"
708
+ width="1em"
709
+ xmlns="http://www.w3.org/2000/svg"
710
+ >
711
+ <path
712
+ d="M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z"
713
+ />
714
+ </svg>
715
+ </i>
716
+ </button>
717
+ <div
718
+ data-testid="reset-button"
719
+ role="button"
720
+ >
721
+ Reset all filters
722
+ </div>
723
+ </div>
652
724
  <div
653
725
  class="filter__wrapper filter__wrapper--search-refine"
654
726
  >
@@ -55,6 +55,16 @@ describe('getFilterProps function', () => {
55
55
  expect(!!relationProp.relationEntityName).toBe(true);
56
56
  });
57
57
 
58
+ it('should return relationEntityName key as true if relationName exists and matches in schema', () => {
59
+ const dyanmicPropFilter = getFilterProps(
60
+ 'dynamicProp',
61
+ MOCKED_SCHEMA_FOR_FILTERS,
62
+ MOCKED_SCHEMA_FOR_FILTERS
63
+ );
64
+ expect(dyanmicPropFilter).toHaveProperty('hasProperty', true);
65
+ expect(dyanmicPropFilter).toHaveProperty('shouldIgnoreFilter', false);
66
+ });
67
+
58
68
  // todo: add test case
59
69
  // it('should return relationForeignKeys array with values if it isnt a schema or relation prop', () => {
60
70
  // expect(withRelationKeys.relationForeignKeys).toBeDefined();