chore: update bug template guidance and include app test changes (#293)
This commit is contained in:
@@ -7,6 +7,10 @@ body:
|
|||||||
value: |
|
value: |
|
||||||
Thanks for taking the time to report a bug! Please fill out the sections below.
|
Thanks for taking the time to report a bug! Please fill out the sections below.
|
||||||
|
|
||||||
|
Before submitting, please reproduce the issue on the latest released version.
|
||||||
|
Even better: verify it on the current `main` image/tag.
|
||||||
|
The issue may already be fixed in newer builds.
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
@@ -57,6 +61,18 @@ body:
|
|||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: version_info
|
||||||
|
attributes:
|
||||||
|
label: Version / Image Information
|
||||||
|
description: Provide the app version and, if using Docker, the exact image tag you are running.
|
||||||
|
placeholder: |
|
||||||
|
App version (Settings -> About): vX.Y.Z
|
||||||
|
Docker image tag (if applicable): latest or main
|
||||||
|
Tag guidance: use `latest` for the newest release, or `main` for the newest changes from the main branch (`main` is always as new as or newer than `latest`).
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
id: browser
|
id: browser
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -284,24 +284,6 @@ describe("App", () => {
|
|||||||
expect(screen.getByText("lightbox-open-med-image.png")).toBeInTheDocument();
|
expect(screen.getByText("lightbox-open-med-image.png")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("handles Escape key with modal priority", () => {
|
|
||||||
appContextMock.scheduleLightboxImage = "med-image.png";
|
|
||||||
appContextMock.showImageLightbox = true;
|
|
||||||
appContextMock.showShareDialog = true;
|
|
||||||
|
|
||||||
render(
|
|
||||||
<MemoryRouter initialEntries={["/dashboard"]}>
|
|
||||||
<App />
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
||||||
|
|
||||||
expect(appContextMock.closeScheduleLightbox).toHaveBeenCalled();
|
|
||||||
expect(appContextMock.closeImageLightbox).not.toHaveBeenCalled();
|
|
||||||
expect(appContextMock.closeShareDialog).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("handles popstate by closing selected medication", () => {
|
it("handles popstate by closing selected medication", () => {
|
||||||
appContextMock.selectedMed = { id: 1, packCount: 1, looseTablets: 0, updatedAt: null };
|
appContextMock.selectedMed = { id: 1, packCount: 1, looseTablets: 0, updatedAt: null };
|
||||||
|
|
||||||
@@ -344,20 +326,6 @@ describe("App", () => {
|
|||||||
expect(window.history.pushState).toHaveBeenCalled();
|
expect(window.history.pushState).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Escape key closes about modal via history back", () => {
|
|
||||||
render(
|
|
||||||
<MemoryRouter initialEntries={["/dashboard"]}>
|
|
||||||
<App />
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
fireEvent.click(screen.getByRole("button", { name: "open-about" }));
|
|
||||||
expect(screen.getByText("about-modal-open")).toBeInTheDocument();
|
|
||||||
|
|
||||||
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
||||||
expect(window.history.back).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("handles popstate by resetting share dialog state", () => {
|
it("handles popstate by resetting share dialog state", () => {
|
||||||
appContextMock.showShareDialog = true;
|
appContextMock.showShareDialog = true;
|
||||||
|
|
||||||
@@ -381,47 +349,6 @@ describe("App", () => {
|
|||||||
expect(screen.getByText("dashboard-page")).toBeInTheDocument();
|
expect(screen.getByText("dashboard-page")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Escape closes refill modal when it is topmost", () => {
|
|
||||||
appContextMock.showRefillModal = true;
|
|
||||||
|
|
||||||
render(
|
|
||||||
<MemoryRouter initialEntries={["/dashboard"]}>
|
|
||||||
<App />
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
||||||
expect(appContextMock.closeRefillModal).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Escape closes edit stock modal when it is topmost", () => {
|
|
||||||
appContextMock.showEditStockModal = true;
|
|
||||||
|
|
||||||
render(
|
|
||||||
<MemoryRouter initialEntries={["/dashboard"]}>
|
|
||||||
<App />
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
||||||
expect(appContextMock.closeEditStockModal).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Escape closes user filter and medication detail in lower priority", () => {
|
|
||||||
appContextMock.selectedUser = "Max";
|
|
||||||
appContextMock.selectedMed = { id: 1, packCount: 1, looseTablets: 0, updatedAt: null };
|
|
||||||
|
|
||||||
render(
|
|
||||||
<MemoryRouter initialEntries={["/dashboard"]}>
|
|
||||||
<App />
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
||||||
expect(appContextMock.closeUserFilter).toHaveBeenCalled();
|
|
||||||
expect(appContextMock.closeMedDetail).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("popstate closes image lightbox before other modals", () => {
|
it("popstate closes image lightbox before other modals", () => {
|
||||||
appContextMock.showImageLightbox = true;
|
appContextMock.showImageLightbox = true;
|
||||||
appContextMock.scheduleLightboxImage = "img.png";
|
appContextMock.scheduleLightboxImage = "img.png";
|
||||||
@@ -450,17 +377,4 @@ describe("App", () => {
|
|||||||
window.dispatchEvent(new PopStateEvent("popstate"));
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
||||||
expect(appContextMock.setScheduleLightboxImage).toHaveBeenCalledWith(null);
|
expect(appContextMock.setScheduleLightboxImage).toHaveBeenCalledWith(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Escape closes medication detail when no higher-priority modal is open", () => {
|
|
||||||
appContextMock.selectedMed = { id: 1, packCount: 1, looseTablets: 0, updatedAt: null };
|
|
||||||
|
|
||||||
render(
|
|
||||||
<MemoryRouter initialEntries={["/dashboard"]}>
|
|
||||||
<App />
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
||||||
expect(appContextMock.closeMedDetail).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user