mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
4729457929
* clear button * restore * button in interface * changelog * fixes * simplify * changes * components * changed dropdown behavior * fix label * add tests * update demos * changelog * changelog * restore * formatting * revert dropdown * frontend changes * other fixes * changelog * update guide * future * fix tests * fix tests * fix tests * changelog * update guide
16 lines
565 B
Python
16 lines
565 B
Python
import gradio as gr
|
|
|
|
|
|
class TestClearButton:
|
|
def test_clear_event_setup_correctly(self):
|
|
with gr.Blocks() as demo:
|
|
chatbot = gr.Chatbot([("Hello", "How are you?")])
|
|
with gr.Row():
|
|
textbox = gr.Textbox(scale=3, interactive=True)
|
|
gr.ClearButton([textbox, chatbot], scale=1)
|
|
|
|
clear_event_trigger = demo.dependencies.pop()
|
|
assert not clear_event_trigger["backend_fn"]
|
|
assert clear_event_trigger["js"]
|
|
assert clear_event_trigger["outputs"] == [textbox._id, chatbot._id]
|