feat: release Office Tools 0.1.0
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { UploadWorkbench } from "../../src/components/UploadWorkbench";
|
||||
|
||||
vi.mock("../../src/components/OoxmlViewer", () => ({
|
||||
OoxmlViewer: () => <section aria-label="Test OOXML viewer" />,
|
||||
}));
|
||||
|
||||
describe("UploadWorkbench", () => {
|
||||
it("exposes the initial local format families", () => {
|
||||
render(<UploadWorkbench />);
|
||||
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Open an office file" }),
|
||||
).toBeInTheDocument();
|
||||
for (const format of ["DOCX", "XLSX", "PPTX", "ODT", "ODS", "ODP"])
|
||||
expect(screen.getByText(format)).toBeInTheDocument();
|
||||
expect(screen.getByText("No upload")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows the identity of a locally selected file", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<UploadWorkbench />);
|
||||
const input = screen.getByLabelText("Open office file");
|
||||
const file = new File(["local fixture"], "report.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
});
|
||||
|
||||
await user.upload(input, file);
|
||||
|
||||
const heading = screen.getByRole("region", { name: "report.docx" });
|
||||
expect(heading).toHaveTextContent("report.docx");
|
||||
expect(heading).toHaveTextContent("13 B");
|
||||
expect(screen.getByLabelText("Test OOXML viewer")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user