diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 15:30:33 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 15:30:33 +0200 |
commit | afe75b0508cedba1df5c9701a22e5732c7d0d00e (patch) | |
tree | 69b40ae77082d5e300e7320ba0ab08a2fb522380 /tests | |
parent | 645fb2b02b1563bd98c07515bdc2d6d8478ba74e (diff) | |
download | markdown-rs-afe75b0508cedba1df5c9701a22e5732c7d0d00e.tar.gz markdown-rs-afe75b0508cedba1df5c9701a22e5732c7d0d00e.tar.bz2 markdown-rs-afe75b0508cedba1df5c9701a22e5732c7d0d00e.zip |
Add more tests for whitespace in jsx tags
Diffstat (limited to '')
-rw-r--r-- | tests/mdx_jsx_text.rs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/mdx_jsx_text.rs b/tests/mdx_jsx_text.rs index 2d1ec0a..d6e3d56 100644 --- a/tests/mdx_jsx_text.rs +++ b/tests/mdx_jsx_text.rs @@ -345,6 +345,78 @@ fn mdx_jsx_text_core() -> Result<(), String> { ); assert_eq!( + to_mdast("<a\u{3000}b \u{3000}c\u{3000} d\u{3000}/>.", &mdx.parse)?, + Node::Root(Root { + children: vec![Node::Paragraph(Paragraph { + children: vec![ + Node::MdxJsxTextElement(MdxJsxTextElement { + name: Some("a".into()), + attributes: vec![ + AttributeContent::Property(MdxJsxAttribute { + name: "b".into(), + value: None, + }), + AttributeContent::Property(MdxJsxAttribute { + name: "c".into(), + value: None, + }), + AttributeContent::Property(MdxJsxAttribute { + name: "d".into(), + value: None, + }) + ], + children: vec![], + position: Some(Position::new(1, 1, 0, 1, 22, 21)) + }), + Node::Text(Text { + value: ".".into(), + position: Some(Position::new(1, 22, 21, 1, 23, 22)) + }) + ], + position: Some(Position::new(1, 1, 0, 1, 23, 22)) + })], + position: Some(Position::new(1, 1, 0, 1, 23, 22)) + }), + "should support unicode whitespace in a lot of places" + ); + + assert_eq!( + to_mdast("<a\nb \nc\n d\n/>.", &mdx.parse)?, + Node::Root(Root { + children: vec![Node::Paragraph(Paragraph { + children: vec![ + Node::MdxJsxTextElement(MdxJsxTextElement { + name: Some("a".into()), + attributes: vec![ + AttributeContent::Property(MdxJsxAttribute { + name: "b".into(), + value: None, + }), + AttributeContent::Property(MdxJsxAttribute { + name: "c".into(), + value: None, + }), + AttributeContent::Property(MdxJsxAttribute { + name: "d".into(), + value: None, + }) + ], + children: vec![], + position: Some(Position::new(1, 1, 0, 5, 3, 13)) + }), + Node::Text(Text { + value: ".".into(), + position: Some(Position::new(5, 3, 13, 5, 4, 14)) + }) + ], + position: Some(Position::new(1, 1, 0, 5, 4, 14)) + })], + position: Some(Position::new(1, 1, 0, 5, 4, 14)) + }), + "should support line endings in a lot of places" + ); + + assert_eq!( to_mdast("a </b> c", &mdx.parse) .err() .unwrap(), |