mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-18 04:01:10 -05:00
add address test and improve error messaging when ElementBase gets a bad input as style
This commit is contained in:
@@ -77,9 +77,13 @@ class ElementBase(pydom.Element):
|
||||
super().__init__(document.createElement(self.tag))
|
||||
|
||||
# set all the style properties provided in input
|
||||
if style:
|
||||
if isinstance(style, dict):
|
||||
for key, value in style.items():
|
||||
self.style[key] = value
|
||||
elif style is None:
|
||||
pass
|
||||
else:
|
||||
raise ValueError(f"Style should be a dictionary, received {style} (type {type(style)}) instead.")
|
||||
|
||||
# IMPORTANT!!! This is used to auto-harvest all input arguments and set them as properties
|
||||
self._init_properties(**kwargs)
|
||||
|
||||
@@ -103,6 +103,10 @@ class TestElements(PyScriptTest):
|
||||
abbr = self._create_el_and_basic_asserts("abbr", "some text")
|
||||
assert abbr.text_content() == "some text"
|
||||
|
||||
def test_address(self):
|
||||
address = self._create_el_and_basic_asserts("address", "some text")
|
||||
assert address.text_content() == "some text"
|
||||
|
||||
def test_element_button(self):
|
||||
button = self._create_el_and_basic_asserts("button", "click me")
|
||||
assert button.inner_html() == "click me"
|
||||
|
||||
Reference in New Issue
Block a user