Skip to content

Commit

Permalink
improvements on mobile for invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasheriques committed Jan 11, 2025
1 parent 25a58ca commit 551fc75
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
version: 8

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install

- name: Run tests
run: pnpm test:ci
Expand Down
22 changes: 15 additions & 7 deletions src/app/gerador-de-invoice/invoice-generator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("InvoiceGenerator", () => {
// Add first item
await user.click(screen.getByText("Adicionar item"));
const descriptionInputs = screen.getAllByPlaceholderText(
"Informações do serviço"
"Software Development"
);
const priceInputs = screen.getAllByPlaceholderText("0.00");

Expand Down Expand Up @@ -124,12 +124,15 @@ describe("InvoiceGenerator", () => {
render(<InvoiceGenerator />);

// Fill form data
await user.type(screen.getByPlaceholderText("123"), "INV001");
await user.type(
screen.getByPlaceholderText(`INV-${new Date().getFullYear()}-1`),
"INV001"
);

// Add an item
await user.click(screen.getByText("Adicionar item"));
const descriptionInputs = screen.getAllByPlaceholderText(
"Informações do serviço"
"Software Development"
);
const priceInputs = screen.getAllByPlaceholderText("0.00");
await user.type(descriptionInputs[0], "Test Service");
Expand Down Expand Up @@ -168,7 +171,7 @@ describe("InvoiceGenerator", () => {
// Add an item
await user.click(screen.getByText("Adicionar item"));
const descriptionInputs = screen.getAllByPlaceholderText(
"Informações do serviço"
"Software Development"
);
const priceInputs = screen.getAllByPlaceholderText("0.00");
await user.type(descriptionInputs[0], "Test Service");
Expand All @@ -184,10 +187,13 @@ describe("InvoiceGenerator", () => {
render(<InvoiceGenerator />);

// Fill some data
await user.type(screen.getByPlaceholderText("123"), "INV001");
await user.type(
screen.getByPlaceholderText(`INV-${new Date().getFullYear()}-1`),
"INV001"
);
await user.click(screen.getByText("Adicionar item"));
const descriptionInputs = screen.getAllByPlaceholderText(
"Informações do serviço"
"Software Development"
);
const priceInputs = screen.getAllByPlaceholderText("0.00");
await user.type(descriptionInputs[0], "Test Service");
Expand All @@ -197,7 +203,9 @@ describe("InvoiceGenerator", () => {
await user.click(screen.getByText("Limpar"));

// Verify form is cleared
expect(screen.getByPlaceholderText("123")).toHaveValue("");
expect(
screen.getByPlaceholderText(`INV-${new Date().getFullYear()}-1`)
).toHaveValue("");
expect(screen.queryByDisplayValue("Test Service")).not.toBeInTheDocument();
const totalText = await screen.findByTestId("total");
expect(totalText).toHaveTextContent("$0.00");
Expand Down
Loading

0 comments on commit 551fc75

Please sign in to comment.