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

feat: add option to pass tableId as a prop #1472

Merged
merged 1 commit into from
Aug 20, 2020
Merged

Conversation

rfermann
Copy link
Contributor

This PR adds the option to pass a tableId prop to the <MUIDataTable /> component.

Additionally it sets a default tableId when options.draggableColumns.enable is set to true and the tableId prop hasn't been provided by the user.

It fixes #1452.

@patorjk i'm not used to enzyme as a testing library and I struggled finding a way to properly test for the availability of the data-tableid attribute. Hence I haven't added test cases for now. Could you guide me a bit in this?

@patorjk
Copy link
Collaborator

patorjk commented Aug 16, 2020

I haven't tried it out yet but it looks good.

As for a test, you could probably add a small one that included using the tableId option, and then did a check to see if it got added to the cells.

Example: https://github.com/gregnb/mui-datatables/blob/master/test/MUIDataTable.test.js#L437

    let count = mountWrapper
      .find('[data-tableid=' + options.tableId + ']')
      .length;

    assert.strictEqual(count, 10); // I'm not sure what the right number would be, the parameter would be added to THs and TDs though

@patorjk patorjk changed the base branch from master to v3_4_1 August 20, 2020 14:00
@patorjk patorjk merged commit b7062d5 into gregnb:v3_4_1 Aug 20, 2020
@patorjk patorjk mentioned this pull request Aug 20, 2020
@rfermann rfermann deleted the 1452 branch December 28, 2021 12:25
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

Successfully merging this pull request may close these issues.

Warning: Prop data-tableid did not match. Server: "08323920907465618" Client: "06902255999981364"
2 participants