@startsimpli/billing 0.4.28 → 0.4.30
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/package.json
CHANGED
|
@@ -221,6 +221,19 @@ describe("one purchase at a time (crochet_patterns-j2we6)", () => {
|
|
|
221
221
|
});
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
+
describe("the clicked button spins for a signed-in viewer too (crochet_patterns-j2we6)", () => {
|
|
225
|
+
it("spins Lite while a Free viewer's checkout starts", async () => {
|
|
226
|
+
const onSelectOffer = vi.fn(() => new Promise(() => {}));
|
|
227
|
+
const free = { id: "sub-0", status: "active", offer: product.offers[0] } as unknown as SubscriptionInfo;
|
|
228
|
+
renderPricing({ onSelectOffer, currentPlan: { signedIn: true, subscription: free } });
|
|
229
|
+
await waitFor(() => expect(cta("crochet-free").textContent).toMatch(/current plan/i));
|
|
230
|
+
fireEvent.click(cta("crochet-lite"));
|
|
231
|
+
await waitFor(() => expect(cta("crochet-lite").getAttribute("aria-busy")).toBe("true"));
|
|
232
|
+
expect(cta("crochet-pro").getAttribute("aria-busy")).toBeNull();
|
|
233
|
+
expect(cta("crochet-pro").disabled).toBe(true);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
|
|
224
237
|
describe("the page names itself (crochet_patterns-ln6hf)", () => {
|
|
225
238
|
it("uses the host's title and subtitle", async () => {
|
|
226
239
|
renderPricing({ title: "Pricing", subtitle: "Free to start." });
|
|
@@ -75,6 +75,8 @@ export function PricingDetailPage({
|
|
|
75
75
|
// A purchase by a viewer with no plan (signed out) skips usePlanChange, so
|
|
76
76
|
// it is tracked here: the clicked card spins and every other button waits.
|
|
77
77
|
const [selecting, setSelecting] = React.useState<string | null>(null);
|
|
78
|
+
// The card last clicked, so its button is the one that spins.
|
|
79
|
+
const [clicked, setClicked] = React.useState<string | null>(null);
|
|
78
80
|
|
|
79
81
|
if (loading) {
|
|
80
82
|
return (
|
|
@@ -124,6 +126,7 @@ export function PricingDetailPage({
|
|
|
124
126
|
const busy = planChange.busy || hostBusy || selecting !== null;
|
|
125
127
|
const select = (offer: ProductOffer) => {
|
|
126
128
|
if (busy || planUnknown) return;
|
|
129
|
+
setClicked(offer.id);
|
|
127
130
|
if (!currentOffer) {
|
|
128
131
|
setSelecting(offer.id);
|
|
129
132
|
void Promise.resolve()
|
|
@@ -137,7 +140,7 @@ export function PricingDetailPage({
|
|
|
137
140
|
setSelecting(null);
|
|
138
141
|
void planChange.choose(offer, { paying, leavingUnlisted: onUnlistedPlan, currentOffer });
|
|
139
142
|
};
|
|
140
|
-
const spinningId = busy ?
|
|
143
|
+
const spinningId = busy ? clicked : null;
|
|
141
144
|
|
|
142
145
|
// What each tier already has, so a card under "Everything in X, plus:"
|
|
143
146
|
// lists only what it adds (crochet_patterns-tv7fb).
|
|
@@ -104,3 +104,12 @@ describe("PricingSection card rules", () => {
|
|
|
104
104
|
expect(screen.getByTestId("section-cta-crochet-pro").className).toContain("bg-[var(--billing-accent,#2563eb)]");
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
|
+
|
|
108
|
+
it("the pill row has a fixed height, so a card with a trial pill starts its rows level with the others (crochet_patterns-gac4)", async () => {
|
|
109
|
+
renderSection();
|
|
110
|
+
await waitFor(() => screen.getByTestId("trial-badge"));
|
|
111
|
+
const row = screen.getByTestId("trial-badge").parentElement as HTMLElement;
|
|
112
|
+
expect(row.className).toMatch(/\bh-6\b/);
|
|
113
|
+
expect(row.className).toMatch(/\bflex\b/);
|
|
114
|
+
});
|
|
115
|
+
|
|
@@ -146,7 +146,7 @@ function SectionCard({ entry, onSelect, maxFeatures, buildsOn, inherited, isCurr
|
|
|
146
146
|
|
|
147
147
|
{/* Every card reserves the pill and lead-in rows, so matching features
|
|
148
148
|
start at the same height on each card (crochet_patterns-gac4). */}
|
|
149
|
-
<div className="mb-3
|
|
149
|
+
<div className="mb-3 flex h-6 items-center">
|
|
150
150
|
{offer.trialDays > 0 && (
|
|
151
151
|
<span
|
|
152
152
|
data-testid="trial-badge"
|