Skip to content

Commit

Permalink
Remove div shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 committed Feb 7, 2016
1 parent 359079c commit da86d54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
4 changes: 0 additions & 4 deletions maud_macros/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ impl<'cx, 'i> Parser<'cx, 'i> {
let name = try!(self.name());
try!(self.element(sp, &name));
},
// Shorthand div element
[dot!(), ident!(sp, _), ..] => {
try!(self.element(sp, "div"));
},
// Block
[TokenTree::Delimited(_, ref d), ..] if d.delim == DelimToken::Brace => {
self.shift(1);
Expand Down
18 changes: 9 additions & 9 deletions maud_macros/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ fn class_shorthand() {
}

#[test]
fn div_class_shorthand() {
fn class_shorthand_with_space() {
let mut s = String::new();
html!(s, p { "Hi, " .name { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <div class=\"name\">Lyra</div>!</p>");
html!(s, p { "Hi, " span .name { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <span class=\"name\">Lyra</span>!</p>");
}

#[test]
Expand All @@ -353,15 +353,15 @@ fn classes_shorthand() {
}

#[test]
fn div_classes_shorthand() {
fn classes_shorthand_with_space() {
let mut s = String::new();
html!(s, p { "Hi, " .name.here { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <div class=\"name here\">Lyra</div>!</p>");
html!(s, p { "Hi, " span .name .here { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <span class=\"name here\">Lyra</span>!</p>");
}

#[test]
fn div_classes_shorthand_with_attrs() {
fn classes_shorthand_with_attrs() {
let mut s = String::new();
html!(s, p { "Hi, " .name.here id="thing" { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <div class=\"name here\" id=\"thing\">Lyra</div>!</p>");
html!(s, p { "Hi, " span.name.here id="thing" { "Lyra" } "!" }).unwrap();
assert_eq!(s, "<p>Hi, <span class=\"name here\" id=\"thing\">Lyra</span>!</p>");
}

0 comments on commit da86d54

Please sign in to comment.