diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-02-17 13:52:16 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-02-17 13:52:16 +0000 |
| commit | fe41ddbc51b4b7c6ce7d958ea7622983d7805b7e (patch) | |
| tree | 6a477e4a54657b5b89b87141ed85f088c2f03015 /tests/styles/parser | |
| parent | d037ef5cf7fc976047bed20859dbcd5c90f45d67 (diff) | |
Support attributes in HTML paths in style mappings
Diffstat (limited to 'tests/styles/parser')
| -rw-r--r-- | tests/styles/parser/html_path_parser_tests.py | 14 |
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)]), |
