[Fixes #2547] Fixed attribute value prefix with dynamic content being ignored
This commit is contained in:
parent
a0813faa48
commit
48e0b3261c
|
|
@ -548,7 +548,8 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
WritePositionTaggedLiteral(writer, prefix);
|
WritePositionTaggedLiteral(writer, prefix);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!string.IsNullOrEmpty(attrVal.Prefix))
|
||||||
{
|
{
|
||||||
WritePositionTaggedLiteral(writer, attrVal.Prefix);
|
WritePositionTaggedLiteral(writer, attrVal.Prefix);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,24 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ViewWithAttributePrefix_RendersWithoutIgnoringPrefix()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
||||||
|
var client = server.CreateClient();
|
||||||
|
var expectedContent = await _resourcesAssembly.ReadResourceAsStringAsync(
|
||||||
|
"compiler/resources/BasicWebSite.Home.ViewWithPrefixedAttributeValue.html");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.GetAsync("http://localhost/Home/ViewWithPrefixedAttributeValue");
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
Assert.Equal(expectedContent, responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CanReturn_ResultsWithoutContent()
|
public async Task CanReturn_ResultsWithoutContent()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
<span foo=" abc" />
|
||||||
|
<span bar=" Baz" />
|
||||||
|
<span baz=" Baz Baz" />
|
||||||
|
|
@ -667,6 +667,8 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
var sequence = new MockSequence();
|
var sequence = new MockSequence();
|
||||||
context.InSequence(sequence).Setup(f => f.BeginContext(0, 6, true)).Verifiable();
|
context.InSequence(sequence).Setup(f => f.BeginContext(0, 6, true)).Verifiable();
|
||||||
context.InSequence(sequence).Setup(f => f.EndContext()).Verifiable();
|
context.InSequence(sequence).Setup(f => f.EndContext()).Verifiable();
|
||||||
|
context.InSequence(sequence).Setup(f => f.BeginContext(0, 6, true)).Verifiable();
|
||||||
|
context.InSequence(sequence).Setup(f => f.EndContext()).Verifiable();
|
||||||
context.InSequence(sequence).Setup(f => f.BeginContext(8, 14, true)).Verifiable();
|
context.InSequence(sequence).Setup(f => f.BeginContext(8, 14, true)).Verifiable();
|
||||||
context.InSequence(sequence).Setup(f => f.EndContext()).Verifiable();
|
context.InSequence(sequence).Setup(f => f.EndContext()).Verifiable();
|
||||||
context.InSequence(sequence).Setup(f => f.BeginContext(22, 7, true)).Verifiable();
|
context.InSequence(sequence).Setup(f => f.BeginContext(22, 7, true)).Verifiable();
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,12 @@ namespace BasicWebSite.Controllers
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult ViewWithPrefixedAttributeValue()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
public string GetApplicationDescription()
|
public string GetApplicationDescription()
|
||||||
{
|
{
|
||||||
var actionDescriptor = (ControllerActionDescriptor)ActionContext.ActionDescriptor;
|
var actionDescriptor = (ControllerActionDescriptor)ActionContext.ActionDescriptor;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
@{
|
||||||
|
var attrValue = "Baz";
|
||||||
|
}
|
||||||
|
|
||||||
|
<span foo=" abc" />
|
||||||
|
<span bar=" @attrValue" />
|
||||||
|
<span baz=" @attrValue @attrValue" />
|
||||||
Loading…
Reference in New Issue