You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot trigger RowSelected eventcallback on SFgrid #1375
Using bUnit to find a row element within a SyncFusionGrid and
clicking that element does not trigger the set RowSelected callback for that grid
Hopefully there should be a way i can trigger the RowHandler such that i can test some logic further down when it comes to multiple selected rows. But i can't get the RowSelectHandler to trigger, i have been testing this by debugging the test, with a breakpoint at the RowSelectHandler function.
Relevant SFgrid:
<SfGrid@ref="DefaultGrid"DataSource="@this.GridList"AllowPaging="false"AllowSelection="true"EnableHover="true"AllowResizing="true"Width="100%">
<GridTextWrapSettingsWrapMode="WrapMode.Content"></GridTextWrapSettings>
<GridSelectionSettingsCellSelectionMode="CellSelectionMode.Flow"Mode="SelectionMode.Row"Type="SelectionType.Multiple"></GridSelectionSettings>
<GridEventsTValue="LocalBankTransactionJournal"RowSelected="RowSelectHandler"RowDeselected="RowDeSelectHandler"RowDataBound="RowBound"></GridEvents>
<!--Grid content in here-->
</SfGrid>
This code will not get past the wait for state:
varcut=this.RenderComponent<Component>();vartable=cut.WaitForElement("selector for table");varrowToSelect=cut.Find("[automationid=\"known_row_id\"]");rowToSelect.Click();// or .Select()cut.WaitForState(()=>rowToSelect.GetAttribute("aria-selected")=="true");//Becomes true when selected in webstiteAssert.True(true)//Just for testing
Version info:
bUnit version: 1.27.5
.NET Runtime and Blazor version: 8.0
OS type and version: Win 10
Additional context:
I am testing a system that was not made with testing in mind, so direct assignment of values is difficult.
Even though it is third party code, i would like to be able to click and check that stuff works in the grid.
I am guessing aria-selected is a boolean attribute which means the value of it does not need to be true to be "true". So you may want to use rowToSelect.HasAttribute("aria-selected") instead.
Also, you may want to consider whether you want to test the functionality of SF components thenselves, which you are essentially doing here it seems, or your own business logic. Put differently, when you are testing that a specific attribute is being added to the markup by SF components, you are testing SF components implementation detail, and not your own business logic.
I am guessing aria-selected is a boolean attribute which means the value of it does not need to be true to be "true". So you may want to use rowToSelect.HasAttribute("aria-selected") instead.
Also, you may want to consider whether you want to test the functionality of SF components thenselves, which you are essentially doing here it seems, or your own business logic. Put differently, when you are testing that a specific attribute is being added to the markup by SF components, you are testing SF components implementation detail, and not your own business logic.
I just used aria-selected as an example of the line being successfully selected, it itself is not that usefull.
The issue is that i cannot find a way to select the entry in my table, such that i can test the changes that selection should have for other elements on the page. For example if a "delete" button should be enabled or disabled, based on if one or more rows are selected.
In that case this is more a discussion QA than an issue, as this is not a bUnit problem but specifically a syncfusion question. I'll move it over to our QA forum.
Activity
egil commentedon Feb 14, 2024
I am guessing
aria-selectedis a boolean attribute which means the value of it does not need to betrueto be "true". So you may want to userowToSelect.HasAttribute("aria-selected")instead.Also, you may want to consider whether you want to test the functionality of SF components thenselves, which you are essentially doing here it seems, or your own business logic. Put differently, when you are testing that a specific attribute is being added to the markup by SF components, you are testing SF components implementation detail, and not your own business logic.
bjerke2000 commentedon Feb 14, 2024
I just used aria-selected as an example of the line being successfully selected, it itself is not that usefull.
The issue is that i cannot find a way to select the entry in my table, such that i can test the changes that selection should have for other elements on the page. For example if a "delete" button should be enabled or disabled, based on if one or more rows are selected.
egil commentedon Feb 16, 2024
In that case this is more a discussion QA than an issue, as this is not a bUnit problem but specifically a syncfusion question. I'll move it over to our QA forum.