diff --git a/__tests/testing_web/test_select.py b/__tests/testing_web/test_select.py index 0e3338f..d438062 100644 --- a/__tests/testing_web/test_select.py +++ b/__tests/testing_web/test_select.py @@ -21,5 +21,23 @@ def index(): select.should_options_have_count(2) select.should_options_have_text("foo", "bar") +def test_no_option_selected(context: Context): + data = {"Name": ['foo', 'bar']} + dataset = pybi.duckdb.from_pandas({"df": pd.DataFrame(data)}) + + @context.register_page + def index(): + table = dataset["df"] + dv = pybi.data_view(f"SELECT * FROM {table}") + + @ui.computed(inputs=[dv["Name"]]) + def result(names): + return str(names) + pybi.select(dv["Name"]) + pybi.label(result) + context.open() + select = Select(context) + select.should_not_selected_any() + context.should_see("['foo', 'bar']", equal_to=True) diff --git a/__tests/utils/select.py b/__tests/utils/select.py index e989644..bcba63b 100644 --- a/__tests/utils/select.py +++ b/__tests/utils/select.py @@ -102,3 +102,9 @@ def click_items(self, *texts: str): def click_clear_btn(self): self.__page.locator(self.__target_selector).hover() self.__page.click(f"{self.__target_selector} {_CLEAR_BTN_SELECTOR}") + + def should_not_selected_any(self): + self.open_options() + selected_items = self.__page.locator(_OPTIONS_ITEM_SELECTED_SELECTOR) + expect(selected_items).to_have_count(0) +