-
Notifications
You must be signed in to change notification settings - Fork 222
New baselines for TagHelperParseTreeRewriterTest #2639
New baselines for TagHelperParseTreeRewriterTest #2639
Conversation
@@ -16,15 +16,6 @@ public TagHelperParseTreeRewriterTest() | |||
UseNewSyntaxTree = true; | |||
} | |||
|
|||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore. Just something I added in a previous commit.
Text;[and]; | ||
Whitespace;[ ]; | ||
Text;[spaces]; | ||
MarkupTagHelperEndTag - [37..47)::10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main structural change. Tag helper end tags are now well represented in the tree.
I am currently not generating the corresponding classified spans for this to keep them consistent with the old tree. But ideally we should generate those. We should discuss this at some point. I've added it to the tracking list https://github.com/aspnet/Razor/issues/2619. @rynowak this is what I was trying to explain earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the behaviour isn't changing right now, then that sounds great!
Equals;[=]; | ||
MarkupTextLiteral - [15..16)::1 - ["] - Gen<None> - SpanEditHandler;Accepts:Any | ||
DoubleQuote;["]; | ||
MarkupTagHelperAttributeValue - [16..19)::3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, the attibute value of tag helpers use a specific type (MarkupTagHelperAttributeValue
) as opposed to using a GenericBlock
.
DoubleQuote;["]; | ||
MarkupTagHelperAttributeValue - [17..30)::13 | ||
MarkupDynamicAttributeValue - [17..30)::13 - [@DateTime.Now] | ||
GenericBlock - [17..30)::13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed earlier, we will get rid of GenericBlock
at some point. I've added that to the feedback list https://github.com/aspnet/Razor/issues/2619
(0,0): Error RZ3008: Tag helpers cannot target tag name '?xml' because it contains a '?' character. | ||
(0,0): Error RZ3008: Tag helpers cannot target tag name '![CDATA[' because it contains a '!' character. | ||
(0,0): Error RZ3008: Tag helpers cannot target tag name '![CDATA[' because it contains a '[' character. | ||
(0,0): Error RZ3008: Tag helpers cannot target tag name '!DOCTYPE' because it contains a '!' character. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a bug. These are the errors generated when the tag helper descriptors are found. Previously, TagHelperParseTreeRewriter
was not responsible for combing these errors so test code never saw that. But I had to refactor some of that code and now the errors are combined in TagHelperParseTreeRewriter
. Hence these errors show up.
Transition;[@]; | ||
CSharpImplicitExpressionBody - [18..30)::12 | ||
CSharpCodeBlock - [18..30)::12 | ||
CSharpExpressionLiteral - [18..30)::12 - [DateTime.Now] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example of where we rewrite the EditHandler
and AcceptedCharacters
for a bound non-string attribute. Before the rewrite the AcceptedCharacters for this would be NonWhitespace
.
OpenAngle;[<]; | ||
ForwardSlash;[/]; | ||
Text;[th:p]; | ||
CloseAngle;[>]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here's an example of how this syntax representation is SO MUCH BETTER and more accurate than what we had before. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a random sampling of this, and WOW so much better. I want @NTaylorMullen to look at this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super dope, looking sweet man.
MarkupTextLiteral - [0..8)::8 - [<th:myth] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
OpenAngle;[<]; | ||
Text;[th:myth]; | ||
MarkupTagHelperAttribute - [8..20)::12 - class - DoubleQuotes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should spit out the content of this like you do in MarkupTextLiteral
23ad206
to
25c7a17
Compare
Part of #2584
Converted all of the TagHelperParseTreeRewriter tests. I understand it is impossible to look through each and every test. I suggest looking at as many different types of test as possible.
I'm only including the test changes here because the source may change a lot and it isn't worth reviewing at this point. If anyone is interested the source is here.
Here is the syntax for tag helpers,