mirror of
https://github.com/pyscript/pyscript.git
synced 2026-03-24 11:00:38 -04:00
add global attributes and change abbr test
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
from textwrap import dedent
|
||||
|
||||
from pyweb import JSProperty, js_property, pydom
|
||||
|
||||
from pyscript import document, when, window
|
||||
from pyweb import JSProperty, js_property, pydom
|
||||
|
||||
# Global attributes that all elements have (this list is a subset of the official one)
|
||||
# and tries to capture the most used ones
|
||||
GLOBAL_ATTRIBUTES = [
|
||||
"accesskey",
|
||||
"autocapitalize",
|
||||
"autofocus",
|
||||
"autocapitalize",
|
||||
"className",
|
||||
"contenteditable",
|
||||
"draggable",
|
||||
"enterkeyhint",
|
||||
"hidden",
|
||||
@@ -24,7 +25,6 @@ GLOBAL_ATTRIBUTES = [
|
||||
"title",
|
||||
"translate",
|
||||
"virtualkeyboardpolicy",
|
||||
"className",
|
||||
]
|
||||
|
||||
# class and style are different ones that are handled by pydom.element directly
|
||||
@@ -147,9 +147,8 @@ def _add_js_properties(cls, *attrs):
|
||||
class a(TextElementBase):
|
||||
tag = "a"
|
||||
|
||||
|
||||
# # Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes
|
||||
# _add_js_properties(a, "download", "href", "referrerpolicy", "rel", "target", "type")
|
||||
_add_js_properties(a, "download", "href", "referrerpolicy", "rel", "target", "type")
|
||||
|
||||
|
||||
class abbr(ElementBase):
|
||||
|
||||
@@ -100,7 +100,8 @@ class TestElements(PyScriptTest):
|
||||
assert "clicked" not in self.console.log.lines == []
|
||||
|
||||
def test_abbr(self):
|
||||
abbr = self._create_el_and_basic_asserts("abbr", "click me")
|
||||
abbr = self._create_el_and_basic_asserts("abbr", "some text")
|
||||
assert abbr.text == "some text"
|
||||
|
||||
def test_element_button(self):
|
||||
button = self._create_el_and_basic_asserts("button", "click me")
|
||||
|
||||
Reference in New Issue
Block a user