Fix mistake in array index
This commit is contained in:
parent
a82fd5099e
commit
3369208c28
|
|
@ -281,7 +281,7 @@ namespace Microsoft.AspNetCore.Blazor.Razor
|
||||||
var segments = attributeName.Split('-');
|
var segments = attributeName.Split('-');
|
||||||
for (var i = 0; i < segments.Length; i++)
|
for (var i = 0; i < segments.Length; i++)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(segments[0]))
|
if (string.IsNullOrEmpty(segments[i]))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -486,5 +486,26 @@ namespace Test
|
||||||
frame => AssertFrame.Whitespace(frame, 6),
|
frame => AssertFrame.Whitespace(frame, 6),
|
||||||
frame => AssertFrame.Whitespace(frame, 7));
|
frame => AssertFrame.Whitespace(frame, 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Render_Bind_With_IncorrectAttributeNames()
|
||||||
|
{
|
||||||
|
//more than 3 parts
|
||||||
|
Assert.Throws<InvalidOperationException>(() => CompileToComponent(@"
|
||||||
|
@addTagHelper *, TestAssembly
|
||||||
|
<input type=""text"" bind-first-second-third=""Text"" />
|
||||||
|
@functions {
|
||||||
|
public string Text { get; set; } = ""text"";
|
||||||
|
}"));
|
||||||
|
|
||||||
|
//ends with '-'
|
||||||
|
Assert.Throws<InvalidOperationException>(() => CompileToComponent(@"
|
||||||
|
@addTagHelper *, TestAssembly
|
||||||
|
<input type=""text"" bind-first-=""Text"" />
|
||||||
|
@functions {
|
||||||
|
public string Text { get; set; } = ""text"";
|
||||||
|
}"));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue