* Text Area Bind Fix for issue #434 * Correct Typo/Mispelling on test method name.
This commit is contained in:
parent
cda3692d0b
commit
ef3db51bbf
|
|
@ -228,6 +228,7 @@ export class BrowserRenderer {
|
|||
switch (element.tagName) {
|
||||
case 'INPUT':
|
||||
case 'SELECT':
|
||||
case 'TEXTAREA':
|
||||
if (isCheckbox(element)) {
|
||||
(element as HTMLInputElement).checked = value === 'True';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,35 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests
|
|||
target.SendKeys("Changed value\t");
|
||||
Assert.Equal("Changed value", boundValue.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanBindTextArea_InitiallyBlank()
|
||||
{
|
||||
var target = Browser.FindElement(By.Id("textarea-initially-blank"));
|
||||
var boundValue = Browser.FindElement(By.Id("textarea-initially-blank-value"));
|
||||
Assert.Equal(string.Empty, target.GetAttribute("value"));
|
||||
Assert.Equal(string.Empty, boundValue.Text);
|
||||
|
||||
// Modify target; verify value is updated
|
||||
target.SendKeys("Changed value");
|
||||
Assert.Equal(string.Empty, boundValue.Text); // Don't update as there's no change event fired yet.
|
||||
target.SendKeys("\t");
|
||||
Assert.Equal("Changed value", boundValue.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanBindTextArea_InitiallyPopulated()
|
||||
{
|
||||
var target = Browser.FindElement(By.Id("textarea-initially-populated"));
|
||||
var boundValue = Browser.FindElement(By.Id("textarea-initially-populated-value"));
|
||||
Assert.Equal("Hello", target.GetAttribute("value"));
|
||||
Assert.Equal("Hello", boundValue.Text);
|
||||
|
||||
// Modify target; verify value is updated
|
||||
target.Clear();
|
||||
target.SendKeys("Changed value\t");
|
||||
Assert.Equal("Changed value", boundValue.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanBindCheckbox_InitiallyUnchecked()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,18 @@
|
|||
<span id="textbox-initially-populated-value">@textboxInitiallyPopulatedValue</span>
|
||||
</p>
|
||||
|
||||
<h2>Text Area</h2>
|
||||
<p>
|
||||
Initially blank:
|
||||
<textarea id="textarea-initially-blank" @bind(textAreaIntiallyBlankValue)></textarea>
|
||||
<span id="textarea-initially-blank-value">@textAreaIntiallyBlankValue</span>
|
||||
</p>
|
||||
<p>
|
||||
Initially populated:
|
||||
<textarea id="textarea-initially-populated" @bind(textAreaIntiallyPopulatedValue)></textarea>
|
||||
<span id="textarea-initially-populated-value">@textAreaIntiallyPopulatedValue</span>
|
||||
</p>
|
||||
|
||||
<h2>Checkbox</h2>
|
||||
<p>
|
||||
Initially unchecked:
|
||||
|
|
@ -41,6 +53,9 @@
|
|||
string textboxInitiallyBlankValue = null;
|
||||
string textboxInitiallyPopulatedValue = "Hello";
|
||||
|
||||
string textAreaIntiallyBlankValue = null;
|
||||
string textAreaIntiallyPopulatedValue = "Hello";
|
||||
|
||||
bool checkboxInitiallyUncheckedValue = false;
|
||||
bool checkboxInitiallyCheckedValue = true;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue