From 5a170c83ed632da2cb8a0eb8a8b736fef6468a8a Mon Sep 17 00:00:00 2001 From: Wwz <752157577@qq.com> Date: Wed, 21 May 2025 15:58:23 +0000 Subject: [PATCH 1/3] add_select_label --- __tests/testing_web/test_select.py | 18 ++++++++++++++++++ __tests/utils/select.py | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/__tests/testing_web/test_select.py b/__tests/testing_web/test_select.py index 0e3338f..20c726f 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_select_noclick_lable(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) + From 773a2e7977324b249ea37c4789e352489dd4fb48 Mon Sep 17 00:00:00 2001 From: Wwz <752157577@qq.com> Date: Wed, 21 May 2025 16:19:16 +0000 Subject: [PATCH 2/3] testNoOptionSelected --- __tests/testing_web/test_select.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests/testing_web/test_select.py b/__tests/testing_web/test_select.py index 20c726f..61d4426 100644 --- a/__tests/testing_web/test_select.py +++ b/__tests/testing_web/test_select.py @@ -21,7 +21,7 @@ def index(): select.should_options_have_count(2) select.should_options_have_text("foo", "bar") -def test_select_noclick_lable(context: Context): +def test_NoOption_Selected(context: Context): data = {"Name": ['foo', 'bar']} dataset = pybi.duckdb.from_pandas({"df": pd.DataFrame(data)}) From f14eb68f0c315dd9f7b36beaa8ea19ba2a5c9fbc Mon Sep 17 00:00:00 2001 From: Wwz <752157577@qq.com> Date: Wed, 21 May 2025 16:21:03 +0000 Subject: [PATCH 3/3] testNoOptionSelected --- __tests/testing_web/test_select.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests/testing_web/test_select.py b/__tests/testing_web/test_select.py index 61d4426..d438062 100644 --- a/__tests/testing_web/test_select.py +++ b/__tests/testing_web/test_select.py @@ -21,7 +21,7 @@ def index(): select.should_options_have_count(2) select.should_options_have_text("foo", "bar") -def test_NoOption_Selected(context: Context): +def test_no_option_selected(context: Context): data = {"Name": ['foo', 'bar']} dataset = pybi.duckdb.from_pandas({"df": pd.DataFrame(data)})