Skip to content

Commit 4c6d3e3

Browse files
committed
add <legend> element
fix #17
1 parent 931ccc0 commit 4c6d3e3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1212

1313
* `elt::hgroup`
1414
* `elt::hr`
15+
* `elt::legend`
1516

1617

1718
### Added attributes

src/elt.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ pub fn head(
4545
Element::new("head", attributes, children)
4646
}
4747

48+
/// `<legend>`
49+
pub fn legend(
50+
attributes: impl IntoIterator<Item = Attribute>,
51+
children: impl IntoIterator<Item = Element>,
52+
) -> Element {
53+
Element::new("legend", attributes, children)
54+
}
55+
4856
/// `<meta>`
4957
pub fn meta(attributes: impl IntoIterator<Item = Attribute>) -> Element {
5058
Element::new_void("meta", attributes)

tests/render_spec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ fn should_render_attribute(#[case] attr: Attribute, #[case] expected: &str) {
143143
#[case(elt::div([("foo", "bar").into()], ["hello".into()]), "<div foo=\"bar\">hello</div>")]
144144
#[case(elt::div([("foo", "bar".to_string()).into()], [elt::text("hello".to_string())]), "<div foo=\"bar\">hello</div>")]
145145
#[case(elt::head([attr::id("foo")], [elt::text("hello")]), "<head id=\"foo\">hello</head>")]
146+
#[case(elt::legend([attr::id("foo")], [elt::text("hello")]), "<legend id=\"foo\">hello</legend>")]
146147
#[case(elt::title([("foo", "bar").into()], "hello"), "<title foo=\"bar\">hello</title>")]
147148
#[case(elt::body([attr::id("foo")], [elt::text("hello")]), "<body id=\"foo\">hello</body>")]
148149
#[case(elt::hgroup([attr::id("foo")], [elt::text("hello")]), "<hgroup id=\"foo\">hello</hgroup>")]

0 commit comments

Comments
 (0)