Skip to content

Commit 059238b

Browse files
committed
test: fix send button visibility tests to use correct selector
1 parent 21fb0c2 commit 059238b

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,12 @@ describe("ChatTextArea", () => {
10681068
/>,
10691069
)
10701070

1071-
// Find the send button by its icon
1072-
const sendButton = container.querySelector('button[aria-label="Send message"]')
1071+
// Find the send button by looking for the button with SendHorizontal icon
1072+
const buttons = container.querySelectorAll("button")
1073+
const sendButton = Array.from(buttons).find(
1074+
(button) => button.querySelector(".lucide-send-horizontal") !== null,
1075+
)
1076+
10731077
expect(sendButton).toBeInTheDocument()
10741078

10751079
// Check that the button is visible (has opacity-100 class when content exists)
@@ -1082,8 +1086,12 @@ describe("ChatTextArea", () => {
10821086
it("should hide send button when there is no text and no images", () => {
10831087
const { container } = render(<ChatTextArea {...defaultProps} inputValue="" selectedImages={[]} />)
10841088

1085-
// Find the send button by its icon
1086-
const sendButton = container.querySelector('button[aria-label="Send message"]')
1089+
// Find the send button by looking for the button with SendHorizontal icon
1090+
const buttons = container.querySelectorAll("button")
1091+
const sendButton = Array.from(buttons).find(
1092+
(button) => button.querySelector(".lucide-send-horizontal") !== null,
1093+
)
1094+
10871095
expect(sendButton).toBeInTheDocument()
10881096

10891097
// Check that the button is hidden (has opacity-0 class when no content)
@@ -1096,8 +1104,12 @@ describe("ChatTextArea", () => {
10961104
it("should show send button when there is text but no images", () => {
10971105
const { container } = render(<ChatTextArea {...defaultProps} inputValue="Some text" selectedImages={[]} />)
10981106

1099-
// Find the send button by its icon
1100-
const sendButton = container.querySelector('button[aria-label="Send message"]')
1107+
// Find the send button by looking for the button with SendHorizontal icon
1108+
const buttons = container.querySelectorAll("button")
1109+
const sendButton = Array.from(buttons).find(
1110+
(button) => button.querySelector(".lucide-send-horizontal") !== null,
1111+
)
1112+
11011113
expect(sendButton).toBeInTheDocument()
11021114

11031115
// Check that the button is visible
@@ -1114,8 +1126,12 @@ describe("ChatTextArea", () => {
11141126
/>,
11151127
)
11161128

1117-
// Find the send button by its icon
1118-
const sendButton = container.querySelector('button[aria-label="Send message"]')
1129+
// Find the send button by looking for the button with SendHorizontal icon
1130+
const buttons = container.querySelectorAll("button")
1131+
const sendButton = Array.from(buttons).find(
1132+
(button) => button.querySelector(".lucide-send-horizontal") !== null,
1133+
)
1134+
11191135
expect(sendButton).toBeInTheDocument()
11201136

11211137
// Check that the button is visible

0 commit comments

Comments
 (0)