-
-
Notifications
You must be signed in to change notification settings - Fork 73
Issue 591 - Row and column selection with multiple tables #594
Conversation
- additional tests against tables without id
return (this.state.tableProps2 ? <DataTable | ||
{...this.state.tableProps2} | ||
id={baseId ? 'table2' : baseId} | ||
/> : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the 2 tables test behavior so that
- the props are not shared between the tables 🙄
- the 2nd table will have an
id
only if the 1st one has one
@@ -42,7 +42,7 @@ function rowSelectCell(idx: number, rowSelectable: Selection, selectedRows: numb | |||
<input | |||
type={rowSelectable === 'single' ? 'radio' : 'checkbox'} | |||
style={{ verticalAlign: 'middle' }} | |||
name='row-select' | |||
name={`row-select-${id}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the table's id to make the group unique
@@ -230,7 +231,7 @@ function getter( | |||
column_selectable === 'single', | |||
!allSelected | |||
)} | |||
name='column-header--select' | |||
name={`column-select-${id}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the table's id to make the group unique
export default class DashTable { | ||
static getCell(row: number, column: number, editable: State = State.Ready) { | ||
return cy.get(`#table ${getSelector(editable)} tbody tr td.column-${column}`).eq(row); | ||
export class DashTableHelper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generalize the helper to work for multiple tables - Leaving the static implementation below for existing tests
}); | ||
}); | ||
|
||
describe('select rows & columns in multiple tables without id', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the file to take into consideration that there are now rows and columns tests.
Create two tables without ids and check that row and column selections are not shared between them.
tests/cypress/src/DashTable.ts
Outdated
cy.get('.row-1').then($el => { | ||
$el[0].style.overflow = toggled ? '' : 'unset'; | ||
}); | ||
} | ||
} | ||
|
||
export default class DashTable { | ||
private static __helper = new DashTableHelper('table'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it not work to just say export default const DashTable = new DashTableHelper('table');
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😞 very much so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Just one question about 🌴 but since it's just in the 🐅 it's non-⛔️
💃
Fixes #591