|
41 | 41 | Assert.NotNull(row.Instance.ChildContent); |
42 | 42 | } |
43 | 43 |
|
| 44 | + [Fact] |
| 45 | + public void FluentDataGridRow_Columns() |
| 46 | + { |
| 47 | + // Arrange |
| 48 | + var grid = Render<FluentDataGrid<object>>( |
| 49 | + @<FluentDataGrid TGridItem="object" GenerateHeader="DataGridGeneratedHeaderType.None"> |
| 50 | + <FluentDataGridRow> |
| 51 | + <FluentDataGridCell /> |
| 52 | + </FluentDataGridRow> |
| 53 | + </FluentDataGrid> |
| 54 | + ); |
| 55 | + |
| 56 | + // Act |
| 57 | + var row = grid.FindComponent<FluentDataGridRow<object>>(); |
| 58 | + |
| 59 | + // Assert |
| 60 | + Assert.NotNull(grid); |
| 61 | + Assert.NotNull(row); |
| 62 | + |
| 63 | + Assert.NotNull(row.Instance.Columns); |
| 64 | + } |
| 65 | + |
44 | 66 | [Fact] |
45 | 67 | public void FluentDataGridRow_Properties_CompileCorrectly() |
46 | 68 | { |
|
238 | 260 | <FluentDataGridRow> |
239 | 261 | <FluentDataGridCell /> |
240 | 262 | </FluentDataGridRow> |
241 | | - </FluentDataGrid>); |
| 263 | + </FluentDataGrid> |
| 264 | + ); |
242 | 265 |
|
243 | | - // Act |
244 | | - var cell = cut.FindComponent<FluentDataGridRow<object>>(); |
245 | | - await cell.Instance.HandleOnRowFocusAsync(); |
246 | | - // Assert |
247 | | - Assert.True(rowFocusInvoked); |
248 | | - } |
| 266 | + // Act |
| 267 | + var cell = cut.FindComponent<FluentDataGridRow<object>>(); |
| 268 | + await cell.Instance.HandleOnRowFocusAsync(); |
| 269 | + // Assert |
| 270 | + Assert.True(rowFocusInvoked); |
| 271 | + } |
249 | 272 |
|
250 | | - [Fact] |
251 | | - public async Task FluentDataGridRow_HandleOnRowKeyDownAsync_HandlesKeyEnter() |
252 | | - { |
253 | | - // Arrange |
254 | | - var items = new List<Person>(People).AsQueryable(); |
255 | | - var rowKeyDownInvoked = false; |
| 273 | + [Fact] |
| 274 | + public async Task FluentDataGridRow_HandleOnRowKeyDownAsync_HandlesKeyEnter() |
| 275 | + { |
| 276 | + // Arrange |
| 277 | + var items = new List<Person>(People).AsQueryable(); |
| 278 | + var rowKeyDownInvoked = false; |
| 279 | + bool click = false; |
256 | 280 |
|
257 | 281 | var cut = Render<FluentDataGrid<Person>>( |
258 | | - @<FluentDataGrid TGridItem="Person" Items="@People" GenerateHeader="DataGridGeneratedHeaderType.None"> |
| 282 | + @<FluentDataGrid TGridItem="Person" Items="@People" GenerateHeader="DataGridGeneratedHeaderType.None" OnRowClick="()=>{click=true;}"> |
259 | 283 | <SelectColumn TGridItem="Person" |
260 | 284 | SelectMode="DataGridSelectMode.Multiple" |
261 | 285 | Selectable="@(x => x.PersonId > 0)" |
262 | 286 | SelectFromEntireRow="true" |
263 | 287 | OnSelect="@(e => rowKeyDownInvoked = true)" /> |
264 | 288 | <PropertyColumn Property="@(x => x)" Title="Value" /> |
265 | | - </FluentDataGrid>); |
| 289 | + </FluentDataGrid> |
| 290 | + ); |
266 | 291 |
|
267 | | - // Act |
268 | | - var keyboardEvent = new KeyboardEventArgs { Code = "Enter" }; |
269 | | - var row = cut.FindComponent<FluentDataGridRow<Person>>(); |
270 | | - await row.Instance.HandleOnRowKeyDownAsync(row.Instance.RowId, keyboardEvent); |
| 292 | + // Act |
| 293 | + var keyboardEvent = new KeyboardEventArgs { Code = "Enter" }; |
| 294 | + var row = cut.FindComponent<FluentDataGridRow<Person>>(); |
| 295 | + await row.Instance.HandleOnRowKeyDownAsync(row.Instance.RowId, keyboardEvent); |
271 | 296 |
|
272 | | - // Assert |
273 | | - Assert.True(rowKeyDownInvoked); |
274 | | - } |
| 297 | + // Assert |
| 298 | + Assert.True(rowKeyDownInvoked); |
| 299 | + Assert.True(click); |
| 300 | + } |
275 | 301 |
|
276 | 302 |
|
277 | 303 | [Fact] |
|
0 commit comments