Skip to content

Commit

Permalink
added simple test for basic usage ConfirmationDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
hansnowak committed Sep 14, 2023
1 parent 5e5b1cf commit 8b6f981
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unit/confirmation_dialog_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from unittest.mock import MagicMock

import ipyvuetify as vw

import solara
from solara.lab.components.confirmation_dialog import ConfirmationDialog


def test_confirmation_dialog():
is_open = solara.reactive(True)
on_ok = MagicMock()
el = ConfirmationDialog(is_open, on_ok=on_ok, content="Hello")
_, rc = solara.render(el, handle_error=False)
buttons = rc.find(vw.Btn)
assert len(buttons) == 2
buttons[0].widget.click()
assert on_ok.call_count == 1 # was OK button clicked?
assert not is_open.value # is dialog closed?

0 comments on commit 8b6f981

Please sign in to comment.