|
114 | 114 | { |
115 | 115 | // Arrange && Act |
116 | 116 | var cut = Render(@<FluentSelect TOption="string"> |
117 | | - <FluentOption Value="1"> |
118 | | - Search |
119 | | - <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Color="@Color.Neutral" Slot="start" /> |
120 | | - </FluentOption> |
121 | | - <FluentOption Value="2" Selected="true"> |
122 | | - Show |
123 | | - <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Color="@Color.Neutral" Slot="start" /> |
124 | | - </FluentOption> |
125 | | - <FluentOption Value="3"> |
126 | | - Generate |
127 | | - <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Color="@Color.Neutral" Slot="start" /> |
128 | | - </FluentOption> |
129 | | - </FluentSelect>); |
| 117 | + <FluentOption Value="1"> |
| 118 | + Search |
| 119 | + <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Color="@Color.Neutral" Slot="start" /> |
| 120 | + </FluentOption> |
| 121 | + <FluentOption Value="2" Selected="true"> |
| 122 | + Show |
| 123 | + <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Color="@Color.Neutral" Slot="start" /> |
| 124 | + </FluentOption> |
| 125 | + <FluentOption Value="3"> |
| 126 | + Generate |
| 127 | + <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Color="@Color.Neutral" Slot="start" /> |
| 128 | + </FluentOption> |
| 129 | + </FluentSelect>); |
130 | 130 |
|
131 | 131 | // Assert |
132 | 132 | cut.Verify(); |
|
138 | 138 | { |
139 | 139 | // Arrange && Act |
140 | 140 | var cut = Render(@<FluentSelect Position="SelectPosition.Above" TOption="string"> |
141 | | - <FluentOption>Position forced above</FluentOption> |
142 | | - <FluentOption>Option Two</FluentOption> |
143 | | - </FluentSelect>); |
| 141 | + <FluentOption>Position forced above</FluentOption> |
| 142 | + <FluentOption>Option Two</FluentOption> |
| 143 | + </FluentSelect>); |
144 | 144 |
|
145 | 145 | // Assert |
146 | 146 | cut.Verify(); |
|
151 | 151 | { |
152 | 152 | // Arrange && Act |
153 | 153 | var cut = Render(@<FluentSelect Position="SelectPosition.Below" TOption="string"> |
154 | | - <FluentOption>Position forced above</FluentOption> |
155 | | - <FluentOption>Option Two</FluentOption> |
156 | | - </FluentSelect>); |
| 154 | + <FluentOption>Position forced above</FluentOption> |
| 155 | + <FluentOption>Option Two</FluentOption> |
| 156 | + </FluentSelect>); |
157 | 157 |
|
158 | 158 | // Assert |
159 | 159 | cut.Verify(); |
|
165 | 165 | { |
166 | 166 | // Arrange && Act |
167 | 167 | var cut = Render(@<FluentSelect Items="@(Customers.Get())" OptionValue="@(context => context.Id.ToString())"> |
168 | | - <OptionTemplate> |
169 | | - <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Slot="end" /> |
170 | | - @(context.Name) |
171 | | - </OptionTemplate> |
172 | | - </FluentSelect> |
| 168 | + <OptionTemplate> |
| 169 | + <FluentIcon Value="@(new SampleIcons.Samples.MyCircle())" Slot="end" /> |
| 170 | + @(context.Name) |
| 171 | + </OptionTemplate> |
| 172 | +</FluentSelect> |
173 | 173 | ); |
174 | 174 |
|
175 | 175 | // Assert |
|
191 | 191 | Assert.Equal("Make a selection...", cut.Find("fluent-option").InnerHtml); |
192 | 192 | cut.Verify(); |
193 | 193 | } |
| 194 | + |
| 195 | + [Fact] |
| 196 | + public void FluentSelect_SelectValueFromDifferentObjectInstances() |
| 197 | + { |
| 198 | + IEnumerable<Customer> SelectedItems = [new Customer(1, "Marvin Klein")]; |
| 199 | + |
| 200 | + List<Customer> Items = new List<Customer> |
| 201 | + { |
| 202 | + new Customer(1, "Marvin Klein"), |
| 203 | + new Customer(2, "Alice Wonder"), |
| 204 | + new Customer(3, "Vincent Baaji") |
| 205 | + }; |
| 206 | + |
| 207 | + // Arrange |
| 208 | + var cut = Render<FluentSelect<Customer>>( |
| 209 | + @<FluentSelect @bind-SelectedOptions="SelectedItems" |
| 210 | + Multiple="true" |
| 211 | + Items="Items" |
| 212 | + OptionComparer="CustomerComparer.Instance" /> |
| 213 | + ); |
| 214 | + |
| 215 | + // Click on the second FluentOption |
| 216 | + var marvin = SelectedItems.First(i => i.Id == 1); |
| 217 | + cut.Find($"fluent-option[value='{marvin}']").Click(); |
| 218 | + |
| 219 | + // Assert (no item selected) |
| 220 | + Assert.Empty(SelectedItems); |
| 221 | + } |
194 | 222 | } |
0 commit comments