feat(webui): polish agent output and app discovery
This commit is contained in:
@@ -7,15 +7,13 @@ import {
|
||||
} from "@/hooks/useLogoFallback";
|
||||
|
||||
function TestLogo({ urls }: { urls: string[] }) {
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(urls);
|
||||
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(urls);
|
||||
if (!logoUrl) return <span>No logo</span>;
|
||||
return (
|
||||
<img
|
||||
src={logoUrl}
|
||||
alt="Logo"
|
||||
onLoad={onLogoLoad}
|
||||
onError={onLogoError}
|
||||
/>
|
||||
<>
|
||||
<span>{logoLoaded ? "Loaded" : "Loading"}</span>
|
||||
<img src={logoUrl} alt="Logo" onLoad={onLogoLoad} onError={onLogoError} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,15 +30,18 @@ describe("useLogoFallback", () => {
|
||||
const first = render(<TestLogo urls={urls} />);
|
||||
|
||||
expect(screen.getByRole("img", { name: "Logo" })).toHaveAttribute("src", urls[0]);
|
||||
expect(screen.getByText("Loading")).toBeInTheDocument();
|
||||
|
||||
fireEvent.error(screen.getByRole("img", { name: "Logo" }));
|
||||
expect(screen.getByRole("img", { name: "Logo" })).toHaveAttribute("src", urls[1]);
|
||||
|
||||
fireEvent.load(screen.getByRole("img", { name: "Logo" }));
|
||||
expect(screen.getByText("Loaded")).toBeInTheDocument();
|
||||
first.unmount();
|
||||
render(<TestLogo urls={urls} />);
|
||||
|
||||
expect(screen.getByRole("img", { name: "Logo" })).toHaveAttribute("src", urls[1]);
|
||||
expect(screen.getByText("Loaded")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("returns no logo once every candidate failed", () => {
|
||||
|
||||
Reference in New Issue
Block a user