-
Notifications
You must be signed in to change notification settings - Fork 214
fix(DATAGO-133564): Fix 'Stop' button cutoff in narrow chat window #1455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8c1af4e
fix: handle smaller width for icons in chat input form
amir-ghasemi 9100e0e
fix: checkboxes
amir-ghasemi b1e37c7
fix: test coverage
amir-ghasemi 71e55ff
Merge branch 'main' of github.com:SolaceLabs/solace-agent-mesh into a…
amir-ghasemi bc2dbc7
fix: review feedback
amir-ghasemi 28618e6
fix: storybook
amir-ghasemi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
client/webui/frontend/src/stories/common/MarkdownHTMLConverter.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| /// <reference types="@testing-library/jest-dom" /> | ||
| import { render } from "@testing-library/react"; | ||
| import { describe, test, expect } from "vitest"; | ||
| import * as matchers from "@testing-library/jest-dom/matchers"; | ||
|
|
||
| import { MarkdownHTMLConverter } from "@/lib/components/common/MarkdownHTMLConverter"; | ||
|
|
||
| expect.extend(matchers); | ||
|
|
||
| const renderMd = (md: string) => render(<MarkdownHTMLConverter>{md}</MarkdownHTMLConverter>); | ||
|
|
||
| describe("MarkdownHTMLConverter — GFM task lists", () => { | ||
| test("keeps the native checkbox input and applies theming + non-interactive attrs (unchecked)", () => { | ||
| const { container } = renderMd("- [ ] Open task"); | ||
|
|
||
| const input = container.querySelector("input[type=checkbox]"); | ||
| expect(input).not.toBeNull(); | ||
| expect(input!.hasAttribute("checked")).toBe(false); | ||
|
|
||
| // `disabled` must be dropped so the browser's accent-color applies; | ||
| // interactivity is suppressed via pointer-events / tabindex / aria. | ||
| expect(input!.hasAttribute("disabled")).toBe(false); | ||
| expect(input!.getAttribute("tabindex")).toBe("-1"); | ||
| expect(input!.getAttribute("aria-disabled")).toBe("true"); | ||
|
|
||
| const cls = input!.getAttribute("class") ?? ""; | ||
| expect(cls).toContain("size-3.5"); | ||
| expect(cls).toContain("shrink-0"); | ||
| expect(cls).toContain("accent-(--primary-wMain)"); | ||
| expect(cls).toContain("pointer-events-none"); | ||
| }); | ||
|
|
||
| test("keeps the native checkbox input with the checked attribute (checked)", () => { | ||
| const { container } = renderMd("- [x] Done task"); | ||
|
|
||
| const input = container.querySelector("input[type=checkbox]"); | ||
| expect(input).not.toBeNull(); | ||
| expect(input!.hasAttribute("checked")).toBe(true); | ||
|
|
||
| expect(input!.hasAttribute("disabled")).toBe(false); | ||
| expect(input!.getAttribute("tabindex")).toBe("-1"); | ||
| expect(input!.getAttribute("aria-disabled")).toBe("true"); | ||
|
|
||
| const cls = input!.getAttribute("class") ?? ""; | ||
| expect(cls).toContain("accent-(--primary-wMain)"); | ||
| }); | ||
|
|
||
| test("drops the disc bullet on a <ul> whose <li>s start with a checkbox", () => { | ||
| const { container } = renderMd("- [ ] one\n- [x] two"); | ||
|
|
||
| const ul = container.querySelector("ul"); | ||
| expect(ul).not.toBeNull(); | ||
|
|
||
| const ulStyle = ul!.getAttribute("style") ?? ""; | ||
| expect(ulStyle).toContain("list-style: none"); | ||
| // Padding tightened so checkbox aligns near the left edge | ||
| expect(ulStyle).toContain("padding-left: 0.25rem"); | ||
| }); | ||
|
|
||
| test("renders task <li> as flex with baseline alignment and a small gap", () => { | ||
| const { container } = renderMd("- [ ] hello world"); | ||
|
|
||
| const li = container.querySelector("li"); | ||
| expect(li).not.toBeNull(); | ||
|
|
||
| const liStyle = li!.getAttribute("style") ?? ""; | ||
| expect(liStyle).toContain("display: flex"); | ||
| expect(liStyle).toContain("align-items: baseline"); | ||
| expect(liStyle).toContain("gap: 0.5rem"); | ||
| }); | ||
|
|
||
| test("preserves the text content next to the checkbox", () => { | ||
| const { getByText } = renderMd("- [ ] write tests\n- [x] ship feature"); | ||
| expect(getByText("write tests")).toBeInTheDocument(); | ||
| expect(getByText("ship feature")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("leaves regular bulleted lists untouched (no checkbox = keep disc bullet)", () => { | ||
| const { container } = renderMd("- apple\n- banana"); | ||
|
|
||
| const ul = container.querySelector("ul"); | ||
| expect(ul).not.toBeNull(); | ||
| // No inline style override applied | ||
| expect(ul!.getAttribute("style")).toBeNull(); | ||
| expect(container.querySelector("li")?.getAttribute("style")).toBeNull(); | ||
| }); | ||
|
|
||
| test("only restyles the task-list <ul>, not sibling regular lists", () => { | ||
| // A heading between the two lists prevents marked from merging them. | ||
| const md = ["- regular item", "", "## Tasks", "", "- [ ] task item"].join("\n"); | ||
| const { container } = renderMd(md); | ||
|
|
||
| const uls = container.querySelectorAll("ul"); | ||
| expect(uls.length).toBe(2); | ||
|
|
||
| // First ul is a plain bulleted list — no inline style override | ||
| expect(uls[0].getAttribute("style")).toBeNull(); | ||
| // Second ul is the task list — bullets stripped | ||
| expect(uls[1].getAttribute("style") ?? "").toContain("list-style: none"); | ||
| }); | ||
|
|
||
| test("handles mixed checked/unchecked items in a single list", () => { | ||
| const { container } = renderMd("- [x] done\n- [ ] todo"); | ||
|
|
||
| const inputs = container.querySelectorAll("li input[type=checkbox]"); | ||
| expect(inputs.length).toBe(2); | ||
|
|
||
| const [first, second] = Array.from(inputs); | ||
| expect(first.hasAttribute("checked")).toBe(true); | ||
| expect(second.hasAttribute("checked")).toBe(false); | ||
|
|
||
| // Both inputs share the same theming classes regardless of checked state. | ||
| for (const el of [first, second]) { | ||
| expect(el.hasAttribute("disabled")).toBe(false); | ||
| const cls = el.getAttribute("class") ?? ""; | ||
| expect(cls).toContain("accent-(--primary-wMain)"); | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extract this
hidden @[480px]:blockandhidden @[480px]:inlineto sharable constants?