Skip to content

Cannot trigger RowSelected eventcallback on SFgrid #1375

@bjerke2000

Description

@bjerke2000

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%">
                    <GridTextWrapSettings WrapMode="WrapMode.Content"></GridTextWrapSettings>
                    <GridSelectionSettings CellSelectionMode="CellSelectionMode.Flow" Mode="SelectionMode.Row" Type="SelectionType.Multiple"></GridSelectionSettings>
                    <GridEvents TValue="LocalBankTransactionJournal" RowSelected="RowSelectHandler" RowDeselected="RowDeSelectHandler" RowDataBound="RowBound"></GridEvents>
                    <!--Grid content in here-->
</SfGrid>

This code will not get past the wait for state:

var cut = this.RenderComponent<Component>();
var table = cut.WaitForElement("selector for table");
var rowToSelect = cut.Find("[automationid=\"known_row_id\"]");
rowToSelect.Click(); // or .Select()
cut.WaitForState(() => rowToSelect.GetAttribute("aria-selected") == "true"); //Becomes true when selected in webstite
Assert.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions