@saasquatch/mint-components 1.14.7-8 → 1.14.7
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/cjs/{ShadowViewAddon-3c344355.js → ShadowViewAddon-28865623.js} +12 -4
- package/dist/cjs/sqm-big-stat_43.cjs.entry.js +3 -3
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
- package/dist/collection/components/sqm-big-stat/sqm-big-stat.e2e.js +168 -0
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +11 -4
- package/dist/collection/components/sqm-context-router/sqm-context-router.e2e.js +180 -0
- package/dist/collection/components/sqm-lead-form/useLeadForm.js +2 -2
- package/dist/collection/components/sqm-rewards-table/sqm-rewards-table.e2e.js +113 -0
- package/dist/collection/components/sqm-router/sqm-router.e2e.js +180 -0
- package/dist/collection/utils/utils.spec.js +71 -0
- package/dist/esm/{ShadowViewAddon-64194d20.js → ShadowViewAddon-f2176779.js} +12 -4
- package/dist/esm/sqm-big-stat_43.entry.js +3 -3
- package/dist/esm/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/ShadowViewAddon-f2176779.js +1 -0
- package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-0d939b73.system.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/{p-1d8c24d9.system.entry.js → p-4cff3345.system.entry.js} +1 -1
- package/dist/mint-components/{p-8855bb68.entry.js → p-653a8a7b.entry.js} +2 -2
- package/dist/mint-components/p-a01e3c3d.system.entry.js +1 -0
- package/dist/mint-components/p-c1b074b6.js +394 -0
- package/dist/mint-components/{p-a94b5fc6.entry.js → p-c4ce8578.entry.js} +1 -1
- package/dist/types/components/sqm-big-stat/sqm-big-stat.e2e.d.ts +1 -0
- package/dist/types/components/sqm-context-router/sqm-context-router.e2e.d.ts +1 -0
- package/dist/types/components/sqm-rewards-table/sqm-rewards-table.e2e.d.ts +1 -0
- package/dist/types/components/sqm-router/sqm-router.e2e.d.ts +1 -0
- package/dist/types/utils/utils.spec.d.ts +1 -0
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-64194d20.js +0 -1
- package/dist/mint-components/p-0d94d81a.system.js +0 -1
- package/dist/mint-components/p-30a11ec0.js +0 -394
- package/dist/mint-components/p-5c35ab32.system.entry.js +0 -1
|
@@ -1665,7 +1665,6 @@ function PortalRegisterView(props) {
|
|
|
1665
1665
|
const style$4 = {
|
|
1666
1666
|
ErrorStyle: {
|
|
1667
1667
|
"&::part(control)": {
|
|
1668
|
-
background: "var(--sl-color-danger-10)",
|
|
1669
1668
|
borderColor: "var(--sl-color-danger-500)",
|
|
1670
1669
|
outline: "var(--sl-color-danger-500)",
|
|
1671
1670
|
},
|
|
@@ -1704,8 +1703,9 @@ JSS.jss.setup(JSS.create());
|
|
|
1704
1703
|
const sheet$4 = JSS.jss.createStyleSheet(style$4);
|
|
1705
1704
|
const styleString$4 = sheet$4.toString();
|
|
1706
1705
|
function CheckboxFieldView(props) {
|
|
1707
|
-
var _b, _c;
|
|
1706
|
+
var _a, _b, _c, _d, _e;
|
|
1708
1707
|
const { states, content, callbacks } = props;
|
|
1708
|
+
const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.registrationFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
|
|
1709
1709
|
return (index.h("div", { class: sheet$4.classes.FieldContainer, part: "sqm-base" },
|
|
1710
1710
|
index.h("style", { type: "text/css" },
|
|
1711
1711
|
vanillaStyle$2,
|
|
@@ -1713,12 +1713,20 @@ function CheckboxFieldView(props) {
|
|
|
1713
1713
|
index.h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
1714
1714
|
e.target.value = e.target.checked;
|
|
1715
1715
|
callbacks.setChecked(e.target.value);
|
|
1716
|
-
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled),
|
|
1716
|
+
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
|
|
1717
|
+
if (!value && !content.checkboxOptional) {
|
|
1718
|
+
return content.errorMessage;
|
|
1719
|
+
}
|
|
1720
|
+
} }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
|
|
1721
|
+
class: sheet$4.classes.ErrorStyle,
|
|
1722
|
+
}
|
|
1723
|
+
: [])), global.intl.formatMessage({
|
|
1717
1724
|
id: content.checkboxName + "-message",
|
|
1718
1725
|
defaultMessage: content.checkboxLabel,
|
|
1719
1726
|
}, {
|
|
1720
1727
|
labelLink: (index.h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
|
|
1721
|
-
}))
|
|
1728
|
+
})),
|
|
1729
|
+
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (index.h("p", { class: sheet$4.classes.ErrorMessageStyle }, content.errorMessage))));
|
|
1722
1730
|
}
|
|
1723
1731
|
|
|
1724
1732
|
function ChangeMarktingView(props) {
|
|
@@ -24,7 +24,7 @@ const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
|
|
|
24
24
|
const usePortalLogin = require('./usePortalLogin-63d896d1.js');
|
|
25
25
|
const AsYouType = require('./AsYouType-6788393a.js');
|
|
26
26
|
const utilities = require('./utilities-78f5e169.js');
|
|
27
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
27
|
+
const ShadowViewAddon = require('./ShadowViewAddon-28865623.js');
|
|
28
28
|
require('./sqm-portal-container-view-4f15143a.js');
|
|
29
29
|
const usePayoutStatus = require('./usePayoutStatus-feeac99b.js');
|
|
30
30
|
|
|
@@ -1477,8 +1477,8 @@ function useLeadForm(props) {
|
|
|
1477
1477
|
validationErrors: {},
|
|
1478
1478
|
});
|
|
1479
1479
|
(_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
|
|
1480
|
-
|
|
1481
|
-
if (c.type === "checkbox") {
|
|
1480
|
+
var _a;
|
|
1481
|
+
if (((_a = c.input) === null || _a === void 0 ? void 0 : _a.type) === "checkbox") {
|
|
1482
1482
|
c.checked = false;
|
|
1483
1483
|
c.value = false;
|
|
1484
1484
|
}
|
|
@@ -36,7 +36,7 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-fe6
|
|
|
36
36
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7b678f34.js');
|
|
37
37
|
require('./ErrorView-b2fcf954.js');
|
|
38
38
|
const sqmQrCodeView = require('./sqm-qr-code-view-15dfc0b6.js');
|
|
39
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
39
|
+
const ShadowViewAddon = require('./ShadowViewAddon-28865623.js');
|
|
40
40
|
const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
|
|
41
41
|
const sqmInvoiceTableView = require('./sqm-invoice-table-view-0f7fa309.js');
|
|
42
42
|
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.js');
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
function statFunctions(page) {
|
|
3
|
+
return {
|
|
4
|
+
expectElement: async (selector) => { var _a;
|
|
5
|
+
// convert to string because jest pretty printing the object causes errors
|
|
6
|
+
return expect((_a = (await page.find(selector))) === null || _a === void 0 ? void 0 : _a.id).not.toBeUndefined(); },
|
|
7
|
+
dontExpectElement: async (selector) => { var _a; return expect((_a = (await page.find(selector))) === null || _a === void 0 ? void 0 : _a.id).toBeUndefined(); },
|
|
8
|
+
hasStat: async (stat) => {
|
|
9
|
+
expect(stat.innerHTML).not.toEqual("!!!");
|
|
10
|
+
},
|
|
11
|
+
hasInvalidStat: async (stat) => {
|
|
12
|
+
expect(stat.innerHTML).toEqual("!!!");
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// <script>
|
|
17
|
+
// window.widgetIdent = {
|
|
18
|
+
// tenantAlias: "test_a7yoz8854cf6x",
|
|
19
|
+
// appDomain: "https://staging.referralsaasquatch.com",
|
|
20
|
+
// token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6Im55bmVsbGllIiwiaWQiOiJueW5lbGxpZSJ9fQ.3KV974VPLgk4tD8LQfJTi4IPkKCmnaB8w48HzVJYDuI",
|
|
21
|
+
// userId: "nynellie",
|
|
22
|
+
// accountId: "nynellie",
|
|
23
|
+
// programId: "ny-post-referrals",
|
|
24
|
+
// }
|
|
25
|
+
// </script>
|
|
26
|
+
function getHTML(stat) {
|
|
27
|
+
return /*html*/ `
|
|
28
|
+
<div>
|
|
29
|
+
${stat}
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
const statTypes = [
|
|
34
|
+
"/referralsCount",
|
|
35
|
+
"/referralsCount/converted",
|
|
36
|
+
"/referralsCount/started",
|
|
37
|
+
"/referralsMonth",
|
|
38
|
+
"/referralsWeek",
|
|
39
|
+
"/rewardsCount",
|
|
40
|
+
"/rewardsCount/global",
|
|
41
|
+
"/rewardsCountFiltered",
|
|
42
|
+
"/rewardsCountFiltered/global",
|
|
43
|
+
"/rewardsCountFiltered/INTEGRATION",
|
|
44
|
+
"/rewardsCountFiltered/INTEGRATION/global",
|
|
45
|
+
"/rewardsCountFiltered/PCT_DISCOUNT",
|
|
46
|
+
"/rewardsCountFiltered/PCT_DISCOUNT/global",
|
|
47
|
+
"/rewardsCountFiltered/PCT_DISCOUNT/PENDING",
|
|
48
|
+
"/rewardsCountFiltered/PCT_DISCOUNT/AVAILABLE",
|
|
49
|
+
"/rewardsCountFiltered/PCT_DISCOUNT/CANCELLED",
|
|
50
|
+
"/rewardsCountFiltered/PCT_DISCOUNT/PENDING/global",
|
|
51
|
+
"/rewardsCountFiltered/CREDIT",
|
|
52
|
+
"/rewardsCountFiltered/CREDIT/global",
|
|
53
|
+
"/rewardsCountFiltered/CREDIT/COFFEE",
|
|
54
|
+
"/rewardsCountFiltered/CREDIT/COFFEE/global",
|
|
55
|
+
"/rewardsCountFiltered/CREDIT/COFFEE/PENDING/global",
|
|
56
|
+
"/rewardsCountFiltered/CREDIT/COFFEE/AVAILABLE/global",
|
|
57
|
+
"/rewardsCountFiltered/CREDIT/CASH%2FUSD",
|
|
58
|
+
"/rewardsCountFiltered/CREDIT/CASH%2FUSD/global",
|
|
59
|
+
"/rewardsCountFiltered/CREDIT/CASH%2FUSD/PENDING",
|
|
60
|
+
"/rewardsCountFiltered/CREDIT/CASH%2FUSD/PENDING/global",
|
|
61
|
+
"/integrationRewardsCountFiltered",
|
|
62
|
+
"/integrationRewardsCountFiltered/global",
|
|
63
|
+
"/integrationRewardsCountFiltered/PENDING/global",
|
|
64
|
+
"/integrationRewardsCountFiltered/AVAILABLE/global",
|
|
65
|
+
"/rewardsMonth",
|
|
66
|
+
"/rewardsMonth/global",
|
|
67
|
+
"/rewardsWeek",
|
|
68
|
+
"/rewardsWeek/global",
|
|
69
|
+
"/rewardsAssigned/CREDIT/COFFEE",
|
|
70
|
+
"/rewardsAssigned/CREDIT/COFFEE/global",
|
|
71
|
+
"/rewardsAssigned/CREDIT/CASH%2FUSD",
|
|
72
|
+
"/rewardsAssigned/CREDIT/CASH%2FUSD/global",
|
|
73
|
+
"/rewardsRedeemed/CREDIT/COFFEE",
|
|
74
|
+
"/rewardsRedeemed/CREDIT/CASH%2FUSD",
|
|
75
|
+
"/rewardsRedeemed/CREDIT/COFFEE/global",
|
|
76
|
+
"/rewardsRedeemed/CREDIT/CASH%2FUSD/global",
|
|
77
|
+
"/rewardsAvailable/CREDIT/COFFEE",
|
|
78
|
+
"/rewardsAvailable/CREDIT/COFFEE/global",
|
|
79
|
+
"/rewardsAvailable/CREDIT/CASH%2FUSD",
|
|
80
|
+
"/rewardsAvailable/CREDIT/CASH%2FUSD/global",
|
|
81
|
+
"/rewardBalance/CREDIT/COFFEE",
|
|
82
|
+
"/rewardBalance/CREDIT/CASH/USD",
|
|
83
|
+
"/rewardBalance/CREDIT/COFFEE/global",
|
|
84
|
+
"/rewardBalance/CREDIT/COFFEE/prettyValue",
|
|
85
|
+
"/rewardBalance/CREDIT/COFFEE/value",
|
|
86
|
+
"/rewardBalance/CREDIT/COFFEE/prettyValue/global",
|
|
87
|
+
"/rewardBalance/CREDIT/COFFEE/value/global",
|
|
88
|
+
"/rewardBalance/CREDIT/CASH%2FUSD",
|
|
89
|
+
"/rewardBalance/CREDIT/CASH%2FUSD/global",
|
|
90
|
+
"/rewardBalance/CREDIT/CASH%2FUSD/prettyValue",
|
|
91
|
+
"/rewardBalance/CREDIT/CASH%2FUSD/value",
|
|
92
|
+
"/rewardBalance/CREDIT/CASH%2FUSD/prettyValue/global",
|
|
93
|
+
"/rewardBalance/CREDIT/CASH%2FUSD/value/global",
|
|
94
|
+
"/programGoals/count/Paid-Member-Goal%2Freferrals",
|
|
95
|
+
"/programGoals/conversionCount/Paid-Member-Goal%2Freferrals",
|
|
96
|
+
];
|
|
97
|
+
describe("sqm-big-stat", () => {
|
|
98
|
+
statTypes.map((statType) => {
|
|
99
|
+
return test(statType, async () => {
|
|
100
|
+
const html = getHTML(`<sqm-big-stat stat-type="${statType}"></sqm-big-stat>`);
|
|
101
|
+
const page = await newE2EPage();
|
|
102
|
+
const { expectElement, hasStat } = statFunctions(page);
|
|
103
|
+
await page.setContent(html);
|
|
104
|
+
await page.waitForChanges();
|
|
105
|
+
await expectElement("sqm-big-stat");
|
|
106
|
+
const stat = await page.find(`sqm-big-stat >>> div > div[part="stat-value"]`);
|
|
107
|
+
hasStat(stat);
|
|
108
|
+
page.close();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
test("No props returns !!!", async () => {
|
|
112
|
+
const html = getHTML(`<sqm-big-stat></sqm-big-stat>`);
|
|
113
|
+
const page = await newE2EPage();
|
|
114
|
+
const { expectElement, hasInvalidStat } = statFunctions(page);
|
|
115
|
+
await page.setContent(html);
|
|
116
|
+
await page.waitForChanges();
|
|
117
|
+
await expectElement("sqm-big-stat");
|
|
118
|
+
const stat = await page.find(`sqm-big-stat >>> div > div[part="stat-value"]`);
|
|
119
|
+
hasInvalidStat(stat);
|
|
120
|
+
page.close();
|
|
121
|
+
});
|
|
122
|
+
test("/garbage/props", async () => {
|
|
123
|
+
const html = getHTML(`<sqm-big-stat stat-type="/garbage/props"></sqm-big-stat>`);
|
|
124
|
+
const page = await newE2EPage();
|
|
125
|
+
const { expectElement, hasInvalidStat } = statFunctions(page);
|
|
126
|
+
await page.setContent(html);
|
|
127
|
+
await page.waitForChanges();
|
|
128
|
+
await expectElement("sqm-big-stat");
|
|
129
|
+
const stat = await page.find(`sqm-big-stat >>> div > div[part="stat-value"]`);
|
|
130
|
+
hasInvalidStat(stat);
|
|
131
|
+
page.close();
|
|
132
|
+
});
|
|
133
|
+
test("/programGoals/count returns !!!", async () => {
|
|
134
|
+
const html = getHTML(`<sqm-big-stat stat-type="/programGoals/count"></sqm-big-stat>`);
|
|
135
|
+
const page = await newE2EPage();
|
|
136
|
+
const { expectElement, hasInvalidStat } = statFunctions(page);
|
|
137
|
+
await page.setContent(html);
|
|
138
|
+
await page.waitForChanges();
|
|
139
|
+
await expectElement("sqm-big-stat");
|
|
140
|
+
const stat = await page.find(`sqm-big-stat >>> div > div[part="stat-value"]`);
|
|
141
|
+
hasInvalidStat(stat);
|
|
142
|
+
page.close();
|
|
143
|
+
});
|
|
144
|
+
test("/programGoals/conversionCount returns !!!", async () => {
|
|
145
|
+
const html = getHTML(`<sqm-big-stat stat-type="/programGoals/conversionCount"></sqm-big-stat>`);
|
|
146
|
+
const page = await newE2EPage();
|
|
147
|
+
const { expectElement, hasInvalidStat } = statFunctions(page);
|
|
148
|
+
await page.setContent(html);
|
|
149
|
+
await page.waitForChanges();
|
|
150
|
+
await expectElement("sqm-big-stat");
|
|
151
|
+
const stat = await page.find(`sqm-big-stat >>> div > div[part="stat-value"]`);
|
|
152
|
+
hasInvalidStat(stat);
|
|
153
|
+
page.close();
|
|
154
|
+
});
|
|
155
|
+
test("/programGoals/count/My-Goal/referrals returns !!!", async () => {
|
|
156
|
+
const html = getHTML(`<sqm-big-stat stat-type="/programGoals/count/My-Goal/referrals"></sqm-big-stat>`);
|
|
157
|
+
const page = await newE2EPage();
|
|
158
|
+
const { expectElement, hasInvalidStat } = statFunctions(page);
|
|
159
|
+
await page.setContent(html);
|
|
160
|
+
await page.waitForChanges();
|
|
161
|
+
await expectElement("sqm-big-stat");
|
|
162
|
+
const stat = await page.find(`sqm-big-stat >>> div > div[part="stat-value"]`);
|
|
163
|
+
hasInvalidStat(stat);
|
|
164
|
+
page.close();
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
// nice debugging tool
|
|
168
|
+
// console.log(await page.evaluate(()=>document.body.innerHTML))
|
|
@@ -5,7 +5,6 @@ import { intl } from "../../global/global";
|
|
|
5
5
|
const style = {
|
|
6
6
|
ErrorStyle: {
|
|
7
7
|
"&::part(control)": {
|
|
8
|
-
background: "var(--sl-color-danger-10)",
|
|
9
8
|
borderColor: "var(--sl-color-danger-500)",
|
|
10
9
|
outline: "var(--sl-color-danger-500)",
|
|
11
10
|
},
|
|
@@ -44,7 +43,7 @@ jss.setup(preset());
|
|
|
44
43
|
const sheet = jss.createStyleSheet(style);
|
|
45
44
|
const styleString = sheet.toString();
|
|
46
45
|
export function CheckboxFieldView(props) {
|
|
47
|
-
var _a, _b, _c;
|
|
46
|
+
var _a, _b, _c, _d, _e;
|
|
48
47
|
const { states, content, callbacks } = props;
|
|
49
48
|
const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.registrationFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
|
|
50
49
|
return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
|
|
@@ -54,10 +53,18 @@ export function CheckboxFieldView(props) {
|
|
|
54
53
|
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
55
54
|
e.target.value = e.target.checked;
|
|
56
55
|
callbacks.setChecked(e.target.value);
|
|
57
|
-
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled),
|
|
56
|
+
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
|
|
57
|
+
if (!value && !content.checkboxOptional) {
|
|
58
|
+
return content.errorMessage;
|
|
59
|
+
}
|
|
60
|
+
} }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
|
|
61
|
+
class: sheet.classes.ErrorStyle,
|
|
62
|
+
}
|
|
63
|
+
: [])), intl.formatMessage({
|
|
58
64
|
id: content.checkboxName + "-message",
|
|
59
65
|
defaultMessage: content.checkboxLabel,
|
|
60
66
|
}, {
|
|
61
67
|
labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
|
|
62
|
-
}))
|
|
68
|
+
})),
|
|
69
|
+
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, content.errorMessage))));
|
|
63
70
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
function newRoute(id, path) {
|
|
3
|
+
return /*html*/ `
|
|
4
|
+
<sqm-route path="${path}">
|
|
5
|
+
<div id=${id}></div>
|
|
6
|
+
</sqm-route>`;
|
|
7
|
+
}
|
|
8
|
+
function newTemplate(id, path) {
|
|
9
|
+
return /*html*/ `
|
|
10
|
+
<template path="${path}">
|
|
11
|
+
<div id=${id}></div>
|
|
12
|
+
</template>`;
|
|
13
|
+
}
|
|
14
|
+
function newPageFunctions(page) {
|
|
15
|
+
return {
|
|
16
|
+
expectElement: async (selector) => { var _a;
|
|
17
|
+
// convert to string because jest pretty printing the object causes errors
|
|
18
|
+
return expect((_a = (await page.find(selector))) === null || _a === void 0 ? void 0 : _a.id).not.toBeUndefined(); },
|
|
19
|
+
dontExpectElement: async (selector) => { var _a; return expect((_a = (await page.find(selector))) === null || _a === void 0 ? void 0 : _a.id).toBeUndefined(); },
|
|
20
|
+
expectTemplate: async (selector) => { var _a; return expect((_a = (await page.find("#" + selector))) === null || _a === void 0 ? void 0 : _a.id).not.toBeUndefined(); },
|
|
21
|
+
dontExpectTemplate: async (selector) => { var _a; return expect((_a = (await page.find("#" + selector))) === null || _a === void 0 ? void 0 : _a.id).toBeUndefined(); },
|
|
22
|
+
expectRoute: async (selector) => {
|
|
23
|
+
var _a;
|
|
24
|
+
return expect((_a = (await page.find('div[style="display: contents;"] > div#' + selector))) === null || _a === void 0 ? void 0 : _a.id).not.toBeUndefined();
|
|
25
|
+
},
|
|
26
|
+
dontExpectRoute: async (selector) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return expect((_a = (await page.find('div[style="display: contents;"] > div#' + selector))) === null || _a === void 0 ? void 0 : _a.id).toBeUndefined();
|
|
29
|
+
},
|
|
30
|
+
history: {
|
|
31
|
+
push: (path) => page.evaluate((x) => window.squatchHistory.push(x), path),
|
|
32
|
+
back: () => page.evaluate(() => window.squatchHistory.back()),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
describe("sqm-router", () => {
|
|
37
|
+
test("Default route", async () => {
|
|
38
|
+
const html = /*html*/ `
|
|
39
|
+
<sqm-router>
|
|
40
|
+
${newRoute("RouteA", "/")}
|
|
41
|
+
${newRoute("RouteB", "/B")}
|
|
42
|
+
</sqm-router>
|
|
43
|
+
`;
|
|
44
|
+
const page = await newE2EPage();
|
|
45
|
+
await page.setContent(html);
|
|
46
|
+
const { expectElement, expectRoute, dontExpectRoute } = newPageFunctions(page);
|
|
47
|
+
await expectElement("sqm-router");
|
|
48
|
+
await expectRoute("RouteA");
|
|
49
|
+
await dontExpectRoute("RouteB");
|
|
50
|
+
page.close();
|
|
51
|
+
});
|
|
52
|
+
test("Changing pages", async () => {
|
|
53
|
+
const html = /*html*/ `
|
|
54
|
+
<sqm-router>
|
|
55
|
+
${newRoute("RouteA", "/")}
|
|
56
|
+
${newRoute("RouteB", "/B")}
|
|
57
|
+
</sqm-router>
|
|
58
|
+
`;
|
|
59
|
+
const page = await newE2EPage();
|
|
60
|
+
await page.setContent(html);
|
|
61
|
+
const { expectElement, expectRoute, dontExpectRoute, history, } = newPageFunctions(page);
|
|
62
|
+
await expectElement("sqm-router");
|
|
63
|
+
await expectRoute("RouteA");
|
|
64
|
+
await dontExpectRoute("RouteB");
|
|
65
|
+
await history.push("/B");
|
|
66
|
+
await page.waitForChanges();
|
|
67
|
+
await dontExpectRoute("RouteA");
|
|
68
|
+
await expectRoute("RouteB");
|
|
69
|
+
await history.push("/");
|
|
70
|
+
await page.waitForChanges();
|
|
71
|
+
await expectRoute("RouteA");
|
|
72
|
+
await dontExpectRoute("RouteB");
|
|
73
|
+
page.close();
|
|
74
|
+
});
|
|
75
|
+
test("Going back", async () => {
|
|
76
|
+
const html = /*html*/ `
|
|
77
|
+
<sqm-router>
|
|
78
|
+
${newRoute("RouteA", "/")}
|
|
79
|
+
${newRoute("RouteB", "/B")}
|
|
80
|
+
${newRoute("RouteC", "/C")}
|
|
81
|
+
</sqm-router>
|
|
82
|
+
`;
|
|
83
|
+
const page = await newE2EPage();
|
|
84
|
+
await page.setContent(html);
|
|
85
|
+
const { expectElement, expectRoute, dontExpectRoute, history, } = newPageFunctions(page);
|
|
86
|
+
await expectElement("sqm-router");
|
|
87
|
+
await expectRoute("RouteA");
|
|
88
|
+
await dontExpectRoute("RouteB");
|
|
89
|
+
await dontExpectRoute("RouteC");
|
|
90
|
+
await history.push("/B");
|
|
91
|
+
await page.waitForChanges();
|
|
92
|
+
await dontExpectRoute("RouteA");
|
|
93
|
+
await expectRoute("RouteB");
|
|
94
|
+
await dontExpectRoute("RouteC");
|
|
95
|
+
await history.push("/C");
|
|
96
|
+
await page.waitForChanges();
|
|
97
|
+
await dontExpectRoute("RouteA");
|
|
98
|
+
await dontExpectRoute("RouteB");
|
|
99
|
+
await expectRoute("RouteC");
|
|
100
|
+
await history.back();
|
|
101
|
+
await page.waitForChanges();
|
|
102
|
+
await dontExpectRoute("RouteA");
|
|
103
|
+
await expectRoute("RouteB");
|
|
104
|
+
await dontExpectRoute("RouteC");
|
|
105
|
+
await history.back();
|
|
106
|
+
await page.waitForChanges();
|
|
107
|
+
await expectRoute("RouteA");
|
|
108
|
+
await dontExpectRoute("RouteB");
|
|
109
|
+
await dontExpectRoute("RouteC");
|
|
110
|
+
page.close();
|
|
111
|
+
});
|
|
112
|
+
test("Template has precedence over route", async () => {
|
|
113
|
+
const html = /*html*/ `
|
|
114
|
+
<sqm-router>
|
|
115
|
+
${newRoute("RouteA", "/")}
|
|
116
|
+
${newTemplate("RouteB", "/")}
|
|
117
|
+
${newRoute("RouteC", "/B")}
|
|
118
|
+
</sqm-router>
|
|
119
|
+
`;
|
|
120
|
+
const page = await newE2EPage();
|
|
121
|
+
await page.setContent(html);
|
|
122
|
+
const { expectElement, expectTemplate, dontExpectTemplate, expectRoute, dontExpectRoute, history, } = newPageFunctions(page);
|
|
123
|
+
await expectElement("sqm-router");
|
|
124
|
+
await dontExpectRoute("RouteA");
|
|
125
|
+
await expectTemplate("RouteB");
|
|
126
|
+
await dontExpectRoute("RouteC");
|
|
127
|
+
await history.push("/B");
|
|
128
|
+
await page.waitForChanges();
|
|
129
|
+
await dontExpectRoute("RouteA");
|
|
130
|
+
await dontExpectTemplate("RouteB");
|
|
131
|
+
await expectRoute("RouteC");
|
|
132
|
+
await history.push("/");
|
|
133
|
+
await page.waitForChanges();
|
|
134
|
+
await dontExpectRoute("RouteA");
|
|
135
|
+
await expectTemplate("RouteB");
|
|
136
|
+
await dontExpectRoute("RouteC");
|
|
137
|
+
page.close();
|
|
138
|
+
});
|
|
139
|
+
test("First matching element is chosen, with precedence", async () => {
|
|
140
|
+
const html = /*html*/ `
|
|
141
|
+
<sqm-router>
|
|
142
|
+
${newRoute("RootA", "/")}
|
|
143
|
+
${newRoute("RootB", "/")}
|
|
144
|
+
${newTemplate("RootC", "/")}
|
|
145
|
+
${newTemplate("RootD", "/")}
|
|
146
|
+
${newRoute("StuffA", "/stuff")}
|
|
147
|
+
${newRoute("StuffB", "/stuff")}
|
|
148
|
+
</sqm-router>
|
|
149
|
+
`;
|
|
150
|
+
const page = await newE2EPage();
|
|
151
|
+
await page.setContent(html);
|
|
152
|
+
const { expectElement, expectTemplate, dontExpectTemplate, expectRoute, dontExpectRoute, history, } = newPageFunctions(page);
|
|
153
|
+
await expectElement("sqm-router");
|
|
154
|
+
await dontExpectRoute("RootA");
|
|
155
|
+
await dontExpectRoute("RootB");
|
|
156
|
+
await expectTemplate("RootC");
|
|
157
|
+
await dontExpectTemplate("RootD");
|
|
158
|
+
await dontExpectRoute("StuffA");
|
|
159
|
+
await dontExpectRoute("StuffB");
|
|
160
|
+
await history.push("/stuff");
|
|
161
|
+
await page.waitForChanges();
|
|
162
|
+
await dontExpectRoute("RootA");
|
|
163
|
+
await dontExpectRoute("RootB");
|
|
164
|
+
await dontExpectTemplate("RootC");
|
|
165
|
+
await dontExpectTemplate("RootD");
|
|
166
|
+
await expectRoute("StuffA");
|
|
167
|
+
await dontExpectRoute("StuffB");
|
|
168
|
+
await history.push("/");
|
|
169
|
+
await page.waitForChanges();
|
|
170
|
+
await dontExpectRoute("RootA");
|
|
171
|
+
await dontExpectRoute("RootB");
|
|
172
|
+
await expectTemplate("RootC");
|
|
173
|
+
await dontExpectTemplate("RootD");
|
|
174
|
+
await dontExpectRoute("StuffA");
|
|
175
|
+
await dontExpectRoute("StuffB");
|
|
176
|
+
page.close();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
// nice debugging tool
|
|
180
|
+
// console.log(await page.evaluate(()=>document.body.innerHTML))
|
|
@@ -113,8 +113,8 @@ export function useLeadForm(props) {
|
|
|
113
113
|
validationErrors: {},
|
|
114
114
|
});
|
|
115
115
|
(_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
|
|
116
|
-
|
|
117
|
-
if (c.type === "checkbox") {
|
|
116
|
+
var _a;
|
|
117
|
+
if (((_a = c.input) === null || _a === void 0 ? void 0 : _a.type) === "checkbox") {
|
|
118
118
|
c.checked = false;
|
|
119
119
|
c.value = false;
|
|
120
120
|
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
function newColumn(id) {
|
|
3
|
+
return /*html*/ `<sqm-rewards-table-date-column id="${id}"></sqm-rewards-table-date-column>`;
|
|
4
|
+
}
|
|
5
|
+
function newElement(id) {
|
|
6
|
+
return /*html*/ `<sqm-big-stat id="${id}"></sqm-big-stat>`;
|
|
7
|
+
}
|
|
8
|
+
function newPlopTarget(id) {
|
|
9
|
+
return /*html*/ `<raisins-plop-target id="${id}"></raisins-plop-target>`;
|
|
10
|
+
}
|
|
11
|
+
function newPageFunctions(page) {
|
|
12
|
+
return {
|
|
13
|
+
expectElement: async (selector) => { var _a;
|
|
14
|
+
// convert to string because jest pretty printing the object causes errors
|
|
15
|
+
return expect((_a = (await page.find(selector))) === null || _a === void 0 ? void 0 : _a.id).not.toBeUndefined(); },
|
|
16
|
+
dontExpectElement: async (selector) => { var _a; return expect((_a = (await page.find(selector))) === null || _a === void 0 ? void 0 : _a.id).toBeUndefined(); },
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function createDemoPage(html) {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
window.widgetIdent = { env: "demo" };
|
|
22
|
+
const page = await newE2EPage();
|
|
23
|
+
await page.setContent(html);
|
|
24
|
+
const { expectElement, dontExpectElement } = newPageFunctions(page);
|
|
25
|
+
return { page, expectElement, dontExpectElement };
|
|
26
|
+
}
|
|
27
|
+
describe("sqm-rewards-table", () => {
|
|
28
|
+
test("Default table", async () => {
|
|
29
|
+
const html = /*html*/ `
|
|
30
|
+
<sqm-rewards-table>
|
|
31
|
+
${newColumn("column-A")}
|
|
32
|
+
${newElement("plop-A")}
|
|
33
|
+
${newColumn("column-B")}
|
|
34
|
+
</sqm-rewards-table>
|
|
35
|
+
`;
|
|
36
|
+
const { page, expectElement } = await createDemoPage(html);
|
|
37
|
+
await expectElement("sqm-rewards-table");
|
|
38
|
+
await expectElement("#column-A");
|
|
39
|
+
await expectElement("#column-B");
|
|
40
|
+
page.close();
|
|
41
|
+
});
|
|
42
|
+
// test("Adding a plop target", async () => {
|
|
43
|
+
// const html = /*html*/ `
|
|
44
|
+
// <sqm-rewards-table>
|
|
45
|
+
// ${newColumn("column-A")}
|
|
46
|
+
// ${newPlopTarget("plop-A")}
|
|
47
|
+
// ${newColumn("column-B")}
|
|
48
|
+
// </sqm-rewards-table>
|
|
49
|
+
// `;
|
|
50
|
+
// const { page, expectElement } = await createDemoPage(html);
|
|
51
|
+
// await expectElement("#column-A");
|
|
52
|
+
// await expectElement("#plop-A");
|
|
53
|
+
// await expectElement("#column-B");
|
|
54
|
+
// page.close();
|
|
55
|
+
// });
|
|
56
|
+
// test("Removing a plop target", async () => {
|
|
57
|
+
// const html = /*html*/ `
|
|
58
|
+
// <sqm-rewards-table>
|
|
59
|
+
// ${newColumn("column-A")}
|
|
60
|
+
// ${newPlopTarget("plop-A")}
|
|
61
|
+
// ${newColumn("column-B")}
|
|
62
|
+
// </sqm-rewards-table>
|
|
63
|
+
// `;
|
|
64
|
+
// const { page, expectElement, dontExpectElement } = await createDemoPage(
|
|
65
|
+
// html
|
|
66
|
+
// );
|
|
67
|
+
// await expectElement("#column-A");
|
|
68
|
+
// await expectElement("#plop-A");
|
|
69
|
+
// await expectElement("#column-B");
|
|
70
|
+
// const noPlop = /*html*/ `
|
|
71
|
+
// <sqm-rewards-table>
|
|
72
|
+
// ${newColumn("column-A")}
|
|
73
|
+
// ${newColumn("column-B")}
|
|
74
|
+
// </sqm-rewards-table>
|
|
75
|
+
// `;
|
|
76
|
+
// await page.setContent(noPlop);
|
|
77
|
+
// await dontExpectElement("#plop-A");
|
|
78
|
+
// page.close();
|
|
79
|
+
// });
|
|
80
|
+
// TODO: Don't actually have all of the functions available to test these properly
|
|
81
|
+
// test("Adding and then removing plop target", async () => {
|
|
82
|
+
// const html = /*html*/ `
|
|
83
|
+
// <sqm-rewards-table>
|
|
84
|
+
// ${newColumn("column-A")}
|
|
85
|
+
// ${newColumn("column-B")}
|
|
86
|
+
// </sqm-rewards-table>
|
|
87
|
+
// `;
|
|
88
|
+
// const { page, expectElement } = await createDemoPage(html);
|
|
89
|
+
// page.close();
|
|
90
|
+
// });
|
|
91
|
+
// test("Adding non-table column plop target", async () => {
|
|
92
|
+
// const html = /*html*/ `
|
|
93
|
+
// <sqm-rewards-table>
|
|
94
|
+
// ${newColumn("column-A")}
|
|
95
|
+
// ${newColumn("column-B")}
|
|
96
|
+
// </sqm-rewards-table>
|
|
97
|
+
// `;
|
|
98
|
+
// const { page, expectElement } = await createDemoPage(html);
|
|
99
|
+
// page.close();
|
|
100
|
+
// });
|
|
101
|
+
// test("Adding non-table column plop target and cancelling, then add column", async () => {
|
|
102
|
+
// const html = /*html*/ `
|
|
103
|
+
// <sqm-rewards-table>
|
|
104
|
+
// ${newColumn("column-A")}
|
|
105
|
+
// ${newColumn("column-B")}
|
|
106
|
+
// </sqm-rewards-table>
|
|
107
|
+
// `;
|
|
108
|
+
// const { page, expectElement } = await createDemoPage(html);
|
|
109
|
+
// page.close();
|
|
110
|
+
// });
|
|
111
|
+
});
|
|
112
|
+
// nice debugging tool
|
|
113
|
+
// console.log(await page.evaluate(()=>document.body.innerHTML))
|