Merge branch 'master' into merge/blazor-wasm-to-master
This commit is contained in:
commit
02e51bdc26
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -372,7 +372,7 @@ export class BrowserRenderer {
|
|||
}
|
||||
case 'OPTION': {
|
||||
const value = attributeFrame ? frameReader.attributeValue(attributeFrame) : null;
|
||||
if (value) {
|
||||
if (value || value === '') {
|
||||
element.setAttribute('value', value);
|
||||
} else {
|
||||
element.removeAttribute('value');
|
||||
|
|
|
|||
|
|
@ -214,6 +214,11 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
|
|||
Browser.FindElement(By.Id("select-box-add-option")).Click();
|
||||
Browser.Equal("Fourth", () => boundValue.Text);
|
||||
Assert.Equal("Fourth choice", target.SelectedOption.Text);
|
||||
|
||||
// Verify we can select options whose value is empty
|
||||
// https://github.com/aspnet/AspNetCore/issues/17735
|
||||
target.SelectByText("Empty value");
|
||||
Browser.Equal(string.Empty, () => boundValue.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -227,6 +232,11 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
|
|||
// Modify target; verify value is updated
|
||||
target.SelectByText("Third choice");
|
||||
Browser.Equal("Third", () => boundValue.Text);
|
||||
|
||||
// Verify we can select options whose value is empty
|
||||
// https://github.com/aspnet/AspNetCore/issues/17735
|
||||
target.SelectByText("Empty value");
|
||||
Browser.Equal(string.Empty, () => boundValue.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@
|
|||
<select id="select-box" @bind="selectValue">
|
||||
<optgroup label="Some choices">
|
||||
<!-- Show it also works with optgroup -->
|
||||
<option value="">Empty value</option>
|
||||
<option value=@SelectableValue.First>First choice</option>
|
||||
<option value=@SelectableValue.Second>Second choice</option>
|
||||
<option value=@SelectableValue.Third>Third choice</option>
|
||||
|
|
@ -246,6 +247,7 @@
|
|||
<p>
|
||||
<select id="select-markup-box" @bind="selectMarkupValue">
|
||||
<optgroup label="Some choices">
|
||||
<option value="">Empty value</option>
|
||||
<option value="First">First choice</option>
|
||||
<option value="Second">Second choice</option>
|
||||
<option value="Third">Third choice</option>
|
||||
|
|
@ -368,8 +370,8 @@
|
|||
|
||||
bool includeFourthOption = false;
|
||||
enum SelectableValue { First, Second, Third, Fourth }
|
||||
SelectableValue selectValue = SelectableValue.Second;
|
||||
SelectableValue selectMarkupValue = SelectableValue.Second;
|
||||
SelectableValue? selectValue = SelectableValue.Second;
|
||||
SelectableValue? selectMarkupValue = SelectableValue.Second;
|
||||
|
||||
void AddAndSelectNewSelectOption()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue