summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-02-17 13:52:16 +0000
committerMichael Williamson <mike@zwobble.org>2024-02-17 13:52:16 +0000
commitfe41ddbc51b4b7c6ce7d958ea7622983d7805b7e (patch)
tree6a477e4a54657b5b89b87141ed85f088c2f03015 /tests
parentd037ef5cf7fc976047bed20859dbcd5c90f45d67 (diff)
Support attributes in HTML paths in style mappings
Diffstat (limited to 'tests')
-rw-r--r--tests/styles/parser/html_path_parser_tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/styles/parser/html_path_parser_tests.py b/tests/styles/parser/html_path_parser_tests.py
index 0c2ef3a..6dd7032 100644
--- a/tests/styles/parser/html_path_parser_tests.py
+++ b/tests/styles/parser/html_path_parser_tests.py
@@ -53,6 +53,20 @@ def test_can_read_multiple_classes_on_element():
)
+def test_can_read_attribute_on_element():
+ assert_equal(
+ html_paths.path([html_paths.element(["p"], attributes={"lang": "fr"})]),
+ read_html_path("p[lang='fr']")
+ )
+
+
+def test_can_read_multiple_attributes_on_element():
+ assert_equal(
+ html_paths.path([html_paths.element(["p"], attributes={"lang": "fr", "data-x": "y"})]),
+ read_html_path("p[lang='fr'][data-x='y']")
+ )
+
+
def test_can_read_when_element_must_be_fresh():
assert_equal(
html_paths.path([html_paths.element(["p"], fresh=True)]),