@blaze-cms/react-page-builder 0.135.0-admin-updates.0 → 0.135.0-alpha.0
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/CHANGELOG.md +2 -6
- package/lib/components/Banner/AdSlotRender.js +3 -12
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js +7 -4
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js +1 -5
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +2 -3
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +0 -2
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib/helpers/build-raw-query.js +20 -9
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/helpers/build-search-values-text.js +8 -5
- package/lib/helpers/build-search-values-text.js.map +1 -1
- package/lib-es/components/Banner/AdSlotRender.js +3 -12
- package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
- package/lib-es/components/Banner/Banner.js +7 -4
- package/lib-es/components/Banner/Banner.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +2 -6
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +2 -3
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +1 -2
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/helpers/build-raw-query.js +19 -7
- package/lib-es/helpers/build-raw-query.js.map +1 -1
- package/lib-es/helpers/build-search-values-text.js +8 -5
- package/lib-es/helpers/build-search-values-text.js.map +1 -1
- package/package.json +10 -10
- package/src/components/Banner/AdSlotRender.js +5 -9
- package/src/components/Banner/Banner.js +11 -9
- package/src/components/Banner/BannerRender.js +0 -4
- package/src/components/DataSummary/helpers/build-loop-props-content.js +2 -3
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +1 -4
- package/src/helpers/build-raw-query.js +16 -3
- package/src/helpers/build-search-values-text.js +20 -17
- package/tests/helpers/mocks.js +20 -5
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +11 -6
- package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +25 -45
- package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +3 -8
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -41
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +0 -21
- package/tests/unit/src/helpers/build-search-values-text.test.js +22 -11
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +0 -87
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +0 -20
|
@@ -15,7 +15,7 @@ const buildRawQuery = ({
|
|
|
15
15
|
azOptions
|
|
16
16
|
}) => {
|
|
17
17
|
const {
|
|
18
|
-
searchValuesText,
|
|
18
|
+
searchValuesText: { must: searchValuesText, should: shouldValuesText = [] },
|
|
19
19
|
searchValuesCheckboxSelectRange,
|
|
20
20
|
searchValuesCheckboxOr
|
|
21
21
|
} = searchValues;
|
|
@@ -47,7 +47,10 @@ const buildRawQuery = ({
|
|
|
47
47
|
: finalValueIfNoCheckboxOrValues;
|
|
48
48
|
} else {
|
|
49
49
|
finalValue = {
|
|
50
|
-
must: [
|
|
50
|
+
must: [
|
|
51
|
+
...searchValuesCheckboxSelectRange,
|
|
52
|
+
{ bool: { should: [...searchValuesTextCheckboxOr, ...shouldValuesText] } }
|
|
53
|
+
]
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
56
|
const mustValues = [
|
|
@@ -58,10 +61,20 @@ const buildRawQuery = ({
|
|
|
58
61
|
|
|
59
62
|
buildAzFilter(azFilter, mustValues, azSortProperty);
|
|
60
63
|
|
|
64
|
+
const { should: baseShould = [], ...baseQuery } = buildRawQueryBase({
|
|
65
|
+
docType,
|
|
66
|
+
id,
|
|
67
|
+
filterValues,
|
|
68
|
+
filterOperator,
|
|
69
|
+
relations,
|
|
70
|
+
stringProps
|
|
71
|
+
});
|
|
72
|
+
const shouldValue = [...baseShould, ...shouldValuesText];
|
|
61
73
|
const query = {
|
|
62
74
|
bool: {
|
|
63
75
|
must: mustValues,
|
|
64
|
-
|
|
76
|
+
should: shouldValue.length ? shouldValue : undefined,
|
|
77
|
+
...baseQuery
|
|
65
78
|
}
|
|
66
79
|
};
|
|
67
80
|
const azQueryBits = getExtraAzBits({ ...azOptions, azSortProperty, azFilter });
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
const buildSearchValuesText = ({ propsToDisplay }, { search_term: searchTerm }) =>
|
|
2
|
-
propsToDisplay.reduce(
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
|
|
2
|
+
propsToDisplay.reduce(
|
|
3
|
+
(acc, field, index) => {
|
|
4
|
+
if (field && searchTerm) {
|
|
5
|
+
if (index === 0) {
|
|
6
|
+
acc.should.push({
|
|
7
|
+
match: {
|
|
8
|
+
pageBuilderIndexed: {
|
|
9
|
+
query: searchTerm,
|
|
10
|
+
fuzziness: 'AUTO'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
acc.must.push({
|
|
6
16
|
match: {
|
|
7
|
-
|
|
17
|
+
[field]: {
|
|
8
18
|
query: searchTerm,
|
|
9
19
|
fuzziness: 'AUTO'
|
|
10
20
|
}
|
|
11
21
|
}
|
|
12
|
-
};
|
|
22
|
+
});
|
|
13
23
|
}
|
|
14
|
-
acc
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
fuzziness: 'AUTO'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return acc;
|
|
24
|
-
}, []);
|
|
24
|
+
return acc;
|
|
25
|
+
},
|
|
26
|
+
{ should: [], must: [] }
|
|
27
|
+
);
|
|
25
28
|
|
|
26
29
|
export default buildSearchValuesText;
|
package/tests/helpers/mocks.js
CHANGED
|
@@ -1006,7 +1006,7 @@ const ITEMS_TO_DISPLAY = [
|
|
|
1006
1006
|
const MOCKED_ARGS = {
|
|
1007
1007
|
docType: 'published_page',
|
|
1008
1008
|
operator: 'should',
|
|
1009
|
-
searchValuesText: [{ match: { name: 'search' } }, { match: { metaTitle: 'search' } }],
|
|
1009
|
+
searchValuesText: { must: [{ match: { name: 'search' } }, { match: { metaTitle: 'search' } }] },
|
|
1010
1010
|
searchValuesCheckboxSelectRange: [],
|
|
1011
1011
|
searchValuesCheckboxOrEmpty: [],
|
|
1012
1012
|
id: 'itemId',
|
|
@@ -1025,7 +1025,7 @@ const MOCKED_ARGS = {
|
|
|
1025
1025
|
]
|
|
1026
1026
|
};
|
|
1027
1027
|
|
|
1028
|
-
const SEARCH_VALUES_TEXT_EMPTY = [];
|
|
1028
|
+
const SEARCH_VALUES_TEXT_EMPTY = { must: [] };
|
|
1029
1029
|
|
|
1030
1030
|
const SEARCH_VALUES_CHECKBOX_SELECT = [
|
|
1031
1031
|
{ match: { metaDescription: 'test' } },
|
|
@@ -1034,7 +1034,11 @@ const SEARCH_VALUES_CHECKBOX_SELECT = [
|
|
|
1034
1034
|
|
|
1035
1035
|
const AND_OPERATOR = 'must';
|
|
1036
1036
|
|
|
1037
|
-
const
|
|
1037
|
+
const EXAMPLE_SHOULD_TEXT = [{ match: { pageBuilderIndexed: 'search' } }];
|
|
1038
|
+
const SEARCH_VALUES_TEXT = {
|
|
1039
|
+
should: EXAMPLE_SHOULD_TEXT,
|
|
1040
|
+
must: [{ match: { name: 'search' } }, { match: { metaTitle: 'search' } }]
|
|
1041
|
+
};
|
|
1038
1042
|
|
|
1039
1043
|
const SEARCH_PUBLISHED_MOCK = [
|
|
1040
1044
|
{
|
|
@@ -1339,6 +1343,7 @@ const RAW_QUERY_ALL_SEARCH_VALUE_SAME_OPERATOR = {
|
|
|
1339
1343
|
}
|
|
1340
1344
|
}
|
|
1341
1345
|
],
|
|
1346
|
+
should: EXAMPLE_SHOULD_TEXT,
|
|
1342
1347
|
filter: {
|
|
1343
1348
|
bool: {
|
|
1344
1349
|
should: [{ match: { docType: 'published_page' } }],
|
|
@@ -1359,12 +1364,19 @@ const RAW_QUERY_ALL_SEARCH_VALUE_DIFFERENT_OPERATOR = {
|
|
|
1359
1364
|
{ match: { metaDescription: 'test' } },
|
|
1360
1365
|
{ match: { category: 'cat' } },
|
|
1361
1366
|
{
|
|
1362
|
-
bool: {
|
|
1367
|
+
bool: {
|
|
1368
|
+
should: [
|
|
1369
|
+
{ match: { name: 'search' } },
|
|
1370
|
+
{ match: { metaTitle: 'search' } },
|
|
1371
|
+
...EXAMPLE_SHOULD_TEXT
|
|
1372
|
+
]
|
|
1373
|
+
}
|
|
1363
1374
|
}
|
|
1364
1375
|
]
|
|
1365
1376
|
}
|
|
1366
1377
|
}
|
|
1367
1378
|
],
|
|
1379
|
+
should: EXAMPLE_SHOULD_TEXT,
|
|
1368
1380
|
filter: {
|
|
1369
1381
|
bool: {
|
|
1370
1382
|
should: [{ match: { docType: 'published_page' } }],
|
|
@@ -1391,6 +1403,7 @@ const RAW_QUERY_ALL_SEARCH_VALUE_SAME_OPERATOR_TEXT_CHECKBOX_HAS_OR_OPERATOR = {
|
|
|
1391
1403
|
}
|
|
1392
1404
|
}
|
|
1393
1405
|
],
|
|
1406
|
+
should: EXAMPLE_SHOULD_TEXT,
|
|
1394
1407
|
filter: {
|
|
1395
1408
|
bool: {
|
|
1396
1409
|
should: [{ match: { docType: 'published_page' } }],
|
|
@@ -1416,7 +1429,8 @@ const RAW_QUERY_ALL_SEARCH_VALUE_DIFFERENT_OPERATOR_TEXT_CHECKBOX_HAS_OR_OPERATO
|
|
|
1416
1429
|
{ match: { name: 'search' } },
|
|
1417
1430
|
{ match: { metaTitle: 'search' } },
|
|
1418
1431
|
{ match: { name: 'someName' } },
|
|
1419
|
-
{ match: { name: 'another' } }
|
|
1432
|
+
{ match: { name: 'another' } },
|
|
1433
|
+
...EXAMPLE_SHOULD_TEXT
|
|
1420
1434
|
]
|
|
1421
1435
|
}
|
|
1422
1436
|
}
|
|
@@ -1424,6 +1438,7 @@ const RAW_QUERY_ALL_SEARCH_VALUE_DIFFERENT_OPERATOR_TEXT_CHECKBOX_HAS_OR_OPERATO
|
|
|
1424
1438
|
}
|
|
1425
1439
|
}
|
|
1426
1440
|
],
|
|
1441
|
+
should: EXAMPLE_SHOULD_TEXT,
|
|
1427
1442
|
filter: {
|
|
1428
1443
|
bool: {
|
|
1429
1444
|
should: [{ match: { docType: 'published_page' } }],
|
|
@@ -50,17 +50,17 @@ describe('Banner render component', () => {
|
|
|
50
50
|
<AdSlotRender {...defaultProps} shouldShowBanner={false} />
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
expect(container.childNodes[0].nodeName).toEqual('
|
|
54
|
-
expect(
|
|
53
|
+
expect(container.childNodes[0].nodeName).toEqual('STYLE');
|
|
54
|
+
expect(container.childNodes[1]).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
55
55
|
expect(() => getByTestId(slotTestId)).toThrow();
|
|
56
56
|
expect(asFragment()).toMatchSnapshot();
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
describe('AdSlot loading', () => {
|
|
60
60
|
it('should render AdSlot', () => {
|
|
61
|
-
const { asFragment, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
61
|
+
const { asFragment, container, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
62
62
|
expect(getByTestId('adslot-test')).toBeDefined();
|
|
63
|
-
expect(
|
|
63
|
+
expect(container.childNodes[1]).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
64
64
|
expect(asFragment()).toMatchSnapshot();
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -69,11 +69,16 @@ describe('Banner render component', () => {
|
|
|
69
69
|
const adSlot = getByTestId(slotTestId);
|
|
70
70
|
|
|
71
71
|
fireEvent.mouseOver(adSlot);
|
|
72
|
-
await waitFor(() =>
|
|
72
|
+
await waitFor(() =>
|
|
73
|
+
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-loaded banner-sizeId')
|
|
74
|
+
);
|
|
75
|
+
expect(container.childNodes[0]).toHaveStyle('min-height: 250px');
|
|
73
76
|
expect(asFragment()).toMatchSnapshot();
|
|
74
77
|
|
|
75
78
|
fireEvent.mouseLeave(adSlot);
|
|
76
|
-
await waitFor(() =>
|
|
79
|
+
await waitFor(() =>
|
|
80
|
+
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-empty banner-sizeId')
|
|
81
|
+
);
|
|
77
82
|
expect(asFragment()).toMatchSnapshot();
|
|
78
83
|
});
|
|
79
84
|
});
|
|
@@ -3,18 +3,13 @@
|
|
|
3
3
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="banner
|
|
6
|
+
class="ad-slot ad-slot-loaded banner-sizeId"
|
|
7
|
+
style="min-height: 250px;"
|
|
7
8
|
>
|
|
8
9
|
<div
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
<div
|
|
14
|
-
data-testid="adslot-test"
|
|
15
|
-
role="button"
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
10
|
+
data-testid="adslot-test"
|
|
11
|
+
role="button"
|
|
12
|
+
/>
|
|
18
13
|
</div>
|
|
19
14
|
</DocumentFragment>
|
|
20
15
|
`;
|
|
@@ -22,59 +17,44 @@ exports[`Banner render component AdSlot loading should change class and remove r
|
|
|
22
17
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 2`] = `
|
|
23
18
|
<DocumentFragment>
|
|
24
19
|
<div
|
|
25
|
-
class="banner
|
|
20
|
+
class="ad-slot ad-slot-empty banner-sizeId"
|
|
21
|
+
style=""
|
|
26
22
|
>
|
|
27
23
|
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
>
|
|
32
|
-
<div
|
|
33
|
-
data-testid="adslot-test"
|
|
34
|
-
role="button"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
24
|
+
data-testid="adslot-test"
|
|
25
|
+
role="button"
|
|
26
|
+
/>
|
|
37
27
|
</div>
|
|
38
28
|
</DocumentFragment>
|
|
39
29
|
`;
|
|
40
30
|
|
|
41
31
|
exports[`Banner render component AdSlot loading should render AdSlot 1`] = `
|
|
42
32
|
<DocumentFragment>
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<style>
|
|
47
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
33
|
+
<style>
|
|
34
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
48
35
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
49
36
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
50
|
-
|
|
37
|
+
</style>
|
|
38
|
+
<div
|
|
39
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
40
|
+
>
|
|
51
41
|
<div
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<div
|
|
56
|
-
data-testid="adslot-test"
|
|
57
|
-
role="button"
|
|
58
|
-
/>
|
|
59
|
-
</div>
|
|
42
|
+
data-testid="adslot-test"
|
|
43
|
+
role="button"
|
|
44
|
+
/>
|
|
60
45
|
</div>
|
|
61
46
|
</DocumentFragment>
|
|
62
47
|
`;
|
|
63
48
|
|
|
64
49
|
exports[`Banner render component should not render AdSlot if shouldShowBanner=false but should render styles and wrapper 1`] = `
|
|
65
50
|
<DocumentFragment>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
<style>
|
|
70
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
51
|
+
<style>
|
|
52
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
71
53
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
72
54
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
55
|
+
</style>
|
|
56
|
+
<div
|
|
57
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
58
|
+
/>
|
|
79
59
|
</DocumentFragment>
|
|
80
60
|
`;
|
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Banner render component should render 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
+
<style />
|
|
5
6
|
<div
|
|
6
|
-
class="banner
|
|
7
|
-
|
|
8
|
-
<style />
|
|
9
|
-
<div
|
|
10
|
-
class="ad-slot ad-slot-loading banner-sizeId"
|
|
11
|
-
data-testid="ad-slot"
|
|
12
|
-
/>
|
|
13
|
-
</div>
|
|
7
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
8
|
+
/>
|
|
14
9
|
</DocumentFragment>
|
|
15
10
|
`;
|
|
@@ -90,45 +90,4 @@ describe('buildLoopPropsContent helper function', () => {
|
|
|
90
90
|
});
|
|
91
91
|
expect.hasAssertions();
|
|
92
92
|
});
|
|
93
|
-
|
|
94
|
-
it('should nested items with urls', () => {
|
|
95
|
-
const data = {
|
|
96
|
-
nestedLoopProp: [
|
|
97
|
-
{
|
|
98
|
-
nestedValue: 'abc',
|
|
99
|
-
url: 'http://blazecms.app/abc'
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
nestedValue: '123',
|
|
103
|
-
url: 'http://blazecms.app/123'
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
nestedValue: 'no url',
|
|
107
|
-
url: null
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
};
|
|
111
|
-
const withUrl = buildLoopPropsContent(
|
|
112
|
-
mockedLoopProps,
|
|
113
|
-
[
|
|
114
|
-
{
|
|
115
|
-
bold: false,
|
|
116
|
-
enableLink: true,
|
|
117
|
-
label: '',
|
|
118
|
-
modifier: '',
|
|
119
|
-
prefix: '',
|
|
120
|
-
propertiesToDisplay: ['nestedLoopProp.nestedValue'],
|
|
121
|
-
shouldStrip: true
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
0,
|
|
125
|
-
data
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
withUrl.forEach(([, value, url], index) => {
|
|
129
|
-
expect(value).toEqual(data.nestedLoopProp[index].nestedValue);
|
|
130
|
-
expect(url).toEqual(data.nestedLoopProp[index].url || '');
|
|
131
|
-
});
|
|
132
|
-
expect.hasAssertions();
|
|
133
|
-
});
|
|
134
93
|
});
|
|
@@ -38,25 +38,4 @@ describe('get link to published content', () => {
|
|
|
38
38
|
const result = getLinkToPublishedContent(publishedKey, props);
|
|
39
39
|
expect(result).toEqual('');
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
it('should return url from the currentValue', () => {
|
|
43
|
-
const currentValue = { url: 'currentValueUrl' };
|
|
44
|
-
const props = { content: [content] };
|
|
45
|
-
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
46
|
-
expect(result).toEqual(currentValue.url);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return url from the currentValue even if falsey', () => {
|
|
50
|
-
const currentValue = { url: null };
|
|
51
|
-
const props = { content: [content] };
|
|
52
|
-
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
53
|
-
expect(result).toEqual(currentValue.url);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should not return url from the currentValue if not set', () => {
|
|
57
|
-
const currentValue = {};
|
|
58
|
-
const props = { content: [content] };
|
|
59
|
-
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
60
|
-
expect(result).toEqual(content.url);
|
|
61
|
-
});
|
|
62
41
|
});
|
|
@@ -17,20 +17,31 @@ describe('build search values for text input', () => {
|
|
|
17
17
|
const searchValuesNoQueryParams = buildSearchValuesText(textFilter, {});
|
|
18
18
|
|
|
19
19
|
it('should always return an array', () => {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
[searchValues, searchValuesEmpty].forEach(searchValue => {
|
|
21
|
+
expect(Array.isArray(searchValues.should)).toEqual(true);
|
|
22
|
+
expect(Array.isArray(searchValues.must)).toEqual(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should have no filters set', () => {
|
|
27
|
+
[searchValues, searchValuesEmpty].forEach(searchValue => {
|
|
28
|
+
expect(searchValuesEmpty.should.length).toEqual(0);
|
|
29
|
+
expect(searchValuesEmpty.must.length).toEqual(0);
|
|
30
|
+
});
|
|
22
31
|
});
|
|
23
32
|
|
|
24
33
|
it('should return an array with correct data', () => {
|
|
25
|
-
const searchArray =
|
|
26
|
-
{ match: { pageBuilderIndexed: { query: 'something', fuzziness: 'AUTO' } } },
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
const searchArray = {
|
|
35
|
+
should: [{ match: { pageBuilderIndexed: { query: 'something', fuzziness: 'AUTO' } } }],
|
|
36
|
+
must: [
|
|
37
|
+
{ match: { name: { query: 'something', fuzziness: 'AUTO' } } },
|
|
38
|
+
{ match: { metaTitle: { query: 'something', fuzziness: 'AUTO' } } }
|
|
39
|
+
]
|
|
40
|
+
};
|
|
30
41
|
expect(searchValues).toEqual(searchArray);
|
|
31
|
-
expect(searchValuesEmpty).toEqual([]);
|
|
32
|
-
expect(searchValues.length).toBe(
|
|
33
|
-
expect(searchValuesEmpty.length).toBe(0);
|
|
34
|
-
expect(searchValuesNoQueryParams.length).toBe(0);
|
|
42
|
+
expect(searchValuesEmpty).toEqual({ should: [], must: [] });
|
|
43
|
+
expect(searchValues.must.length).toBe(2);
|
|
44
|
+
expect(searchValuesEmpty.must.length).toBe(0);
|
|
45
|
+
expect(searchValuesNoQueryParams.must.length).toBe(0);
|
|
35
46
|
});
|
|
36
47
|
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Placeholder component should render PlaceholderIcon 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="editor-view__placeholder"
|
|
7
|
-
data-testid="placeholder-icon"
|
|
8
|
-
>
|
|
9
|
-
<svg
|
|
10
|
-
height="25px"
|
|
11
|
-
version="1.1"
|
|
12
|
-
viewBox="0 0 20 20"
|
|
13
|
-
width="25px"
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
16
|
-
>
|
|
17
|
-
<title>
|
|
18
|
-
card
|
|
19
|
-
</title>
|
|
20
|
-
<g
|
|
21
|
-
fill="none"
|
|
22
|
-
fill-rule="evenodd"
|
|
23
|
-
id="Icons"
|
|
24
|
-
stroke="none"
|
|
25
|
-
stroke-width="1"
|
|
26
|
-
>
|
|
27
|
-
<g
|
|
28
|
-
id="card"
|
|
29
|
-
transform="translate(-259, -214)"
|
|
30
|
-
>
|
|
31
|
-
<g
|
|
32
|
-
transform="translate(259, 214)"
|
|
33
|
-
>
|
|
34
|
-
<g
|
|
35
|
-
id="Group-7"
|
|
36
|
-
transform="translate(1, 1)"
|
|
37
|
-
>
|
|
38
|
-
<path
|
|
39
|
-
d="M1.07,10 C3.04212623,8.18723771 4.14171262,7.28085657 4.36875916,7.28085657 C4.79707626,7.28085657 7,9 7.5,9 C8.40867615,9 12.0764465,4.56171314 12.9,4.56171314 C13.4490356,4.56171314 14.8390356,5.81447543 17.07,8.32"
|
|
40
|
-
fill-rule="nonzero"
|
|
41
|
-
id="Path-3"
|
|
42
|
-
stroke="none"
|
|
43
|
-
stroke-width="1.3"
|
|
44
|
-
/>
|
|
45
|
-
<path
|
|
46
|
-
d="M5.00003877,4.07973585 C5.00003879,3.4834142 5.50109477,3 6.11917864,3 C6.73726251,3 7.2383185,3.4834142 7.2383185,4.07973585 C7.2383185,4.6760575 6.73726252,5.15947172 6.11917864,5.15947172 C5.82268209,5.15728623 5.53857972,5.04442179 5.32645457,4.84454876 C5.11586241,4.64208328 4.99827309,4.36656405 5.00003877,4.07973585 Z"
|
|
47
|
-
fill="#899BBC"
|
|
48
|
-
fill-rule="nonzero"
|
|
49
|
-
id="Path"
|
|
50
|
-
/>
|
|
51
|
-
<path
|
|
52
|
-
d="M3.375,14.625 C3.375,14.3143398 3.62683983,14.0625 3.9375,14.0625 L14.0625,14.0625 C14.3731602,14.0625 14.625,14.3143398 14.625,14.625 C14.625,14.9356602 14.3731602,15.1875 14.0625,15.1875 L3.9375,15.1875 C3.62683983,15.1875 3.375,14.9356602 3.375,14.625 Z"
|
|
53
|
-
fill="#899BBC"
|
|
54
|
-
fill-rule="nonzero"
|
|
55
|
-
id="Shape"
|
|
56
|
-
/>
|
|
57
|
-
<rect
|
|
58
|
-
height="16.7"
|
|
59
|
-
id="Rectangle"
|
|
60
|
-
rx="2"
|
|
61
|
-
stroke="#899BBC"
|
|
62
|
-
stroke-width="1.3"
|
|
63
|
-
width="16.7"
|
|
64
|
-
x="0.65"
|
|
65
|
-
y="0.65"
|
|
66
|
-
/>
|
|
67
|
-
<line
|
|
68
|
-
id="Line-2"
|
|
69
|
-
stroke="#899BBC"
|
|
70
|
-
stroke-linecap="square"
|
|
71
|
-
stroke-width="1.3"
|
|
72
|
-
x1="1"
|
|
73
|
-
x2="16.5625"
|
|
74
|
-
y1="11.8125"
|
|
75
|
-
y2="11.8125"
|
|
76
|
-
/>
|
|
77
|
-
</g>
|
|
78
|
-
</g>
|
|
79
|
-
</g>
|
|
80
|
-
</g>
|
|
81
|
-
</svg>
|
|
82
|
-
<span>
|
|
83
|
-
card
|
|
84
|
-
</span>
|
|
85
|
-
</div>
|
|
86
|
-
</DocumentFragment>
|
|
87
|
-
`;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
5
|
-
|
|
6
|
-
import PlaceholderIcon from '../../../../../../blaze-plugin-page-builder-ui/src/components/EditorView/PlaceholderIcon';
|
|
7
|
-
import { CardIcon } from '../../../../../../blaze-plugin-page-builder-ui/src/Icons';
|
|
8
|
-
|
|
9
|
-
const mockedProps = {
|
|
10
|
-
type: 'card',
|
|
11
|
-
icon: CardIcon
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
describe('Placeholder component', () => {
|
|
15
|
-
it('should render PlaceholderIcon', () => {
|
|
16
|
-
const { asFragment, getByTestId } = render(PlaceholderIcon, mockedProps);
|
|
17
|
-
expect(getByTestId('placeholder-icon')).toBeDefined();
|
|
18
|
-
expect(asFragment()).toMatchSnapshot();
|
|
19
|
-
});
|
|
20
|
-
});
|