MudDataGrid : Fix Resize column when neighboring is hidden#9643
MudDataGrid : Fix Resize column when neighboring is hidden#9643ScarletKuro merged 9 commits intoMudBlazor:devfrom
Conversation
|
The fix work in a demo project, but not in the test. In test, I just see a difference in the tag of the header : In the demo (where it works) : <th scope="col" class="mud-table-cell" style="" colspan="1" _bl_4cb3ad82-3a91-4780-838d-12652c54752e="">In the demo (where it don't work) : <th scope="col" class="mud-table-cell" style="" colspan="1" blazor:elementReference="">Sound like Does anyone have any hints? |
|
The test display a data grid with 3 columns. When a column is hidden, the element reference on ...
// Open column menu
var columnMenu = comp.FindAll("th .mud-menu button").ElementAt(1);
columnMenu.Click();
// Click on 'Hide' menu item
comp.WaitForAssertion(() => comp.FindAll(".mud-list-item").ElementAt(1));
var hideMenuItem = comp.FindAll(".mud-list-item").ElementAt(1);
hideMenuItem.InnerHtml.Contains("Hidde");
var thBeforeHidde = comp.Find("th").OuterHtml;
// <th scope="col" class="mud-table-cell" style="" colspan="1" blazor:elementreference="101ba4cb-9363-4b36-bfe1-7a904c3349a8">
hideMenuItem.Click();
var thAfterHidde = comp.Find("th").OuterHtml;
// <th scope="col" class="mud-table-cell" style="" colspan="1" blazor:elementreference=""> |
More info here: https://bunit.dev/docs/test-doubles/emulating-ijsruntime.html |
|
@ScarletKuro, thank. It's worked and it progress. |
|
Now, I need to simulate the mouse move. Have you a hint/example to mock it? |
|
I don't think you can really simulate the You need to do it on a different level, either on the As I understand the datagrid subscribes to event: And then the MudBlazor/src/MudBlazor/Services/EventManager/EventManager.cs Lines 81 to 82 in e279503 And it invokes this lambda I'm just invoking the method directly in the test and the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #9643 +/- ##
==========================================
+ Coverage 89.82% 90.63% +0.80%
==========================================
Files 412 406 -6
Lines 11878 12786 +908
Branches 2364 2474 +110
==========================================
+ Hits 10670 11588 +918
+ Misses 681 640 -41
- Partials 527 558 +31 ☔ View full report in Codecov by Sentry. |
|
I think last commit contains things that it shouldn't. |
959d9b4 to
bba2dc6
Compare
My mistake... I forget to select files before commit... so demo projects were pushed. It's cleaned.
Thank for the tip. |
|
Finally, the test reproduces the bug. |
Thanks for the fix. That fix makes sense, all read and writes should be done via the hidden state not the parameter, and apparently there is one more place where parameter is used instead of the state. |
|
@ScarletKuro, nice catch.
|
This ones are fine. |
|
Thanks. It's interesting that var eventListener = (EventListener)Context.Services.GetRequiredService<IEventListener>();in tests. |
Description
When a column is resized and the neighboring column is hidden, then the application crash.
Fixes #9585
How Has This Been Tested?
I added a test case that reproduce the bug.
Type of Changes
Checklist
dev).