Skip to content

Commit

Permalink
Update test files to showcase block level Razor statements in attribu…
Browse files Browse the repository at this point in the history
…tes.

- Block level Razor statements in attributes used to not work. Added a few use cases to ensure that they're properly tested.

aspnet/Razor#594
  • Loading branch information
NTaylorMullen committed Nov 6, 2015
1 parent 5364468 commit bebd3dc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<menuitem icon="HtmlEncode[[/]]Person" />
</menu>
<object data="HtmlEncode[[/]]Person" archive="HtmlEncode[[/]]Person/HtmlEncode[[John Doe]]" data="HtmlEncode[[/]]Person" archive="HtmlEncode[[/]]Person/HtmlEncode[[John Doe]]" />
<object archive="HtmlEncode[[/]]Person/HtmlEncode[[John Doe]]" />
<applet archive="HtmlEncode[[/]]A+Really(Crazy),Url.Is:This/HtmlEncode[[John Doe]]/Detail" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<menuitem icon="/Person" />
</menu>
<object data="/Person" archive="/Person/John Doe" data="/Person" archive="/Person/John Doe" />
<object archive="/Person/John Doe" />
<applet archive="/A+Really(Crazy),Url.Is:This/John Doe/Detail" />
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@



<input checked="HtmlEncode[[checked]]" processed />
<input checked="HtmlEncode[[checked]]" processed />
<input processed />
Expand All @@ -12,4 +14,5 @@
<input processed />
<input checked="" processed />
<input checked=" " processed />
<input checked=" HtmlEncode[[value]] HtmlEncode[[True]]" processed />
<input checked=" HtmlEncode[[value]] HtmlEncode[[True]]" processed />
<input checked=" True " processed />
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@



<input checked="checked" processed />
<input checked="checked" processed />
<input processed />
Expand All @@ -12,4 +14,5 @@
<input processed />
<input checked="" processed />
<input checked=" " processed />
<input checked=" value True" processed />
<input checked=" value True" processed />
<input checked=" True " processed />
8 changes: 8 additions & 0 deletions test/WebSites/RazorWebSite/Views/UrlResolution/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
var dynamicUrl = "~/SomeUrl";
}

@functions {
public Task DoSomething()
{
return Task.FromResult(true);
}
}

<html manifest="~/Person">
<head>
<base href="~/A+Really(Crazy),Url.Is:This/@Model.Name/Detail" target="_blank">
Expand Down Expand Up @@ -33,6 +40,7 @@
<menuitem icon=~/Person />
</menu>
<object data="~/Person" archive="~/Person/@Model.Name" data="~/Person" archive="~/Person/@Model.Name" />
<object archive="@if(Model.Name != null) { <text>~/Person/@Model.Name</text> } else { await DoSomething(); <text>~/Person</text> } " />
<applet archive="~/A+Really(Crazy),Url.Is:This/@Model.Name/Detail" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
var stringVar = "value";
string nullVar = null;
}

@functions {
public Task DoSomething()
{
return Task.FromResult(true);
}
}

<input checked="@true" />
<input checked="@trueVar" />
<input checked="@false" />
Expand All @@ -20,4 +28,5 @@
<input checked="@null" />
<input checked=" @nullVar" />
<input checked="@nullVar " />
<input checked=" @null @stringVar @trueVar" />
<input checked=" @null @stringVar @trueVar" />
<input checked=" @if (trueVar) { <text>True</text> } else { await DoSomething(); <text>False</text> } " />

0 comments on commit bebd3dc

Please sign in to comment.