aboutsummaryrefslogtreecommitdiff
path: root/tests/test_spans.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-30 18:32:30 +0100
committerMartin Fischer <martin@push-f.com>2021-12-05 02:52:36 +0100
commit76408590349f7f132c1dfeb9db3fb1dea964227c (patch)
tree2e88df0b737ec3225937630c758502400753f87b /tests/test_spans.rs
parentc29558e8d165df1d3fc1cb32079da9e40f957dc6 (diff)
spans: support attribute names
Diffstat (limited to 'tests/test_spans.rs')
-rw-r--r--tests/test_spans.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs
index a3d1c96..9cc745c 100644
--- a/tests/test_spans.rs
+++ b/tests/test_spans.rs
@@ -29,9 +29,22 @@ fn test() {
.infallible()
{
if let Token::StartTag(tag) = token {
- labels.push(Label::primary(file_id, tag.name_span).with_message("start tag"));
+ if tag.name == "h1" {
+ labels.push(Label::primary(file_id, tag.name_span).with_message("start tag"));
+ } else {
+ for attr in tag.attributes.values() {
+ labels.push(
+ Label::primary(file_id, attr.name_span.clone()).with_message("attr name"),
+ );
+ labels.push(
+ Label::primary(file_id, attr.value_span.clone()).with_message("attr value"),
+ );
+ }
+ }
} else if let Token::EndTag(tag) = token {
- labels.push(Label::primary(file_id, tag.name_span).with_message("end tag"));
+ if tag.name == "h1" {
+ labels.push(Label::primary(file_id, tag.name_span).with_message("end tag"));
+ }
}
}