Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 committed Apr 10, 2024
1 parent 1b38701 commit 1127b7d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions panel/tests/ui/chat/test_chat_interface_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,24 @@ def test_chat_interface_help(page):
message = page.locator("p")
message_text = message.inner_text()
assert message_text == "This is a test help text"


def test_chat_interface_custom_js(page):
chat_interface = ChatInterface()
chat_interface.button_properties={
"help": {
"icon": "help",
"js_on_click": "console.log(`Typed: '${chat_input.value}'`)",
"js_args": {"chat_input": chat_interface.active_widget},
},
}
serve_component(page, chat_interface)

chat_input = page.locator(".bk-input")
chat_input.fill("Hello")

with page.expect_console_message() as msg_info:
page.locator("button", has_text="help").click()
msg = msg_info.value

assert msg.args[0].json_value() == "Typed: 'Hello'"

0 comments on commit 1127b7d

Please sign in to comment.