38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import React from "react";
|
|
import { describe, it, expect, vi } from "vitest";
|
|
import { render, waitFor } from "@testing-library/react";
|
|
|
|
// Mock fetch for SupportChat config
|
|
const mockFetch = vi.fn().mockImplementation(() =>
|
|
Promise.resolve({
|
|
ok: true,
|
|
json: () =>
|
|
Promise.resolve({
|
|
data: {
|
|
enabled: true,
|
|
label: "پشتیبانی آنلاین",
|
|
icon: "chat",
|
|
},
|
|
}),
|
|
})
|
|
);
|
|
global.fetch = mockFetch as any;
|
|
|
|
import SupportChat from "../SupportChat";
|
|
|
|
describe("SupportChat Safe Area & Positioning (UX-33)", () => {
|
|
it("ensures SupportChat launcher has bottom-24 on mobile and safe-area inset to avoid overlapping contact form actions and bottom nav", async () => {
|
|
const { container } = render(<SupportChat />);
|
|
|
|
await waitFor(() => {
|
|
const aside = container.querySelector("aside");
|
|
expect(aside).not.toBeNull();
|
|
expect(aside?.className).toContain("fixed");
|
|
expect(aside?.className).toContain("bottom-24");
|
|
expect(aside?.className).toContain("sm:bottom-6");
|
|
expect(aside?.className).toContain("left-4");
|
|
expect(aside?.className).toContain("pb-[env(safe-area-inset-bottom,0px)]");
|
|
});
|
|
});
|
|
});
|