8000 Pydom add better support for select element by fpliger · Pull Request #1887 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Pydom add better support for select element #1887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Dec 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test to add an option by passing the option it wants to be added …
…before
  • Loading branch information
fpliger committed Dec 6, 2023
commit d7cd23a9056a3092f8af71aab068345ed819b438
15 changes: 14 additions & 1 deletion pyscript.core/test/pyscript_dom/tests/test_dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,18 @@ def test_select_element_add(self):
assert select.options[1].value == "2"
assert select.options[1].html == "Option 2"
select.options.add(value = "2", html = "Option 2", before = 1)


# EXPECT the select element to have 3 options
assert len(select.options) == 3

# EXPECT the middle option to have the value and html we passed in
assert select.options[0].value == "1"
assert select.options[0].html == "Option 1"
assert select.options[1].value == "2"
assert select.options[1].html == "Option 2"
assert select.options[2].value == "3"
assert select.options[2].html == "Option 3"
assert select.options[3].value == ""
assert select.options[3].html == ""

select.options.clear()
0