Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performing a Click() (via BUnit) on a Table Cell does not fire the onclick method in the page #2412

Closed
Smurf-IV opened this issue May 25, 2021 · 8 comments
Assignees

Comments

@Smurf-IV
Copy link

Describe the bug
As stated.

Tracked here:
bUnit-dev/bUnit#399

Example project included in the above

@andz-gl
Copy link

andz-gl commented Sep 20, 2021

Hello!

any update?

for me it does not work also (.Click() on tr/td of Blazorise's DataGrid)

please type here when it is fixed/resolved or you have any workaround

@stsrki
Copy link
Collaborator

stsrki commented Sep 21, 2021

@David-Moreira can you please have a look at this?

@andz-gl
Copy link

andz-gl commented Sep 21, 2021

here is test code:
WebApplication1.zip

image

'span.hfghjgfjhkg' should be visible/accessible via cut.Find("span.hfghjgfjhkg") after tableRow.Click() but it's not the case :(

@andz-gl
Copy link

andz-gl commented Sep 21, 2021

another helpful info is here (at the end of bUnit discussion): bUnit-dev/bUnit#399

specifically last posts, please look, it could help with debigging

@David-Moreira
Copy link
Contributor

Hello,
We've debugged on the Blazorise side. We've answered on BUnit's issue as we need help from the author.
Branch : https://github.com/Megabit/Blazorise/tree/rel-0.9.4-BUnit-DataGrid-RowClickTrigger

@David-Moreira
Copy link
Contributor

@andz-gl as a temporary workaround, please use the suggestion provided by @egil on the BUnit's issue, setting the click event argument detail to 1.

Also, expect to not need to explicitly set it in the future, as @egil is expecting to fix it in BUnit in the future.

Updated the branch with working example:

    public class DataGridComponentTest : TestContext
    {
        public DataGridComponentTest()
        {
            BlazoriseConfig.AddBootstrapProviders( Services );
        }

        [Fact]
        public void DetailRow_OnClick_ShouldRender()
        {
            // Arrange
            var cut = RenderComponent<DataGridComponent>();

            // Act
            var tableRow = cut.Find( "tr.table-row-selectable" );
            tableRow.Click( detail: 1 );

            // Assert
            var detailRow = cut.Find( "span.detail-row" );
            Assert.NotNull( detailRow );
            Assert.NotNull( cut.Instance.SelectedRow );
        }

    }

@andz-gl
Copy link

andz-gl commented Sep 28, 2021

Click(detail: 1) works. Thank you!

@David-Moreira
Copy link
Contributor

Great! Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants