Skip to content

Commit f76ba2e

Browse files
committed
Implement #4036
1 parent 16469d7 commit f76ba2e

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

src/Core/Components/DataGrid/FluentDataGridCell.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public partial class FluentDataGridCell<TGridItem> : FluentComponentBase
1717
/// <summary>
1818
/// Gets a reference to the column that this cell belongs to.
1919
/// </summary>
20-
private ColumnBase<TGridItem>? Column => Grid._columns.ElementAtOrDefault(GridColumn - 1);
20+
public ColumnBase<TGridItem>? Column => Grid._columns.ElementAtOrDefault(GridColumn - 1);
2121

2222
internal string CellId { get; set; } = string.Empty;
2323

src/Core/Components/DataGrid/FluentDataGridRow.razor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public FluentDataGridRow(LibraryConfiguration configuration) : base(configuratio
8686
/// </summary>
8787
protected FluentDataGrid<TGridItem> Grid => InternalGridContext.Grid;
8888

89+
/// <summary>
90+
/// Gets the columns associated with this data grid row.
91+
/// </summary>
92+
public IReadOnlyList<ColumnBase<TGridItem>> Columns => Grid._columns;
93+
8994
/// <summary>
9095
/// Sets the RowIndex for this row.
9196
/// </summary>

tests/Core/Components/DataGrid/FluentDataGridCellTests.razor

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@
4242
Assert.Null(cell.Instance.ChildContent);
4343
}
4444

45+
[Fact]
46+
public void FluentDataGridCell_Properties_CompileCorrectly()
47+
{
48+
// This test verifies that our new public properties compile correctly
49+
// by checking that they exist and are public using reflection
50+
51+
var cellType = typeof(FluentDataGridCell<object>);
52+
53+
// Verify that the Column property exists on DataGridCell
54+
var columnProperty = cellType.GetProperty("Column");
55+
Assert.NotNull(columnProperty);
56+
Assert.True(columnProperty.CanRead);
57+
Assert.True(columnProperty.GetMethod?.IsPublic);
58+
}
59+
4560
[Fact]
4661
public async Task FluentDataGridCell_HandleOnCellClickAsync_InvokesCallbacks()
4762
{

tests/Core/Components/DataGrid/FluentDataGridRowTests.razor

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@
4141
Assert.NotNull(row.Instance.ChildContent);
4242
}
4343

44+
[Fact]
45+
public void FluentDataGridRow_Properties_CompileCorrectly()
46+
{
47+
// This test verifies that our new public properties compile correctly
48+
// by checking that they exist and are public using reflection
49+
50+
var rowType = typeof(FluentDataGridRow<object>);
51+
52+
// Verify that the Columns property exists on DataGridRow
53+
var columnsProperty = rowType.GetProperty("Columns");
54+
Assert.NotNull(columnsProperty);
55+
Assert.True(columnsProperty.CanRead);
56+
Assert.True(columnsProperty.GetMethod?.IsPublic);
57+
}
4458

4559
[Fact]
4660
public void FluentDataGridRow_TestNativeHandlers()

tests/Core/Components/DataGrid/FluentDataGridTests.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,7 @@
19101910
Assert.DoesNotContain("Customer Name", headerContent); // Display attribute should be ignored
19111911
}
19121912

1913+
19131914
// Sample data with Display attributes
19141915
19151916

0 commit comments

Comments
 (0)