Skip to content

Commit 30ed8fe

Browse files
authored
Match the Created column's ID to what is expected by React Table (#3174)
1 parent da9fc60 commit 30ed8fe

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

webview/src/experiments/components/App.test.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,8 @@ describe('App', () => {
736736

737737
it('should have the same options in the empty placeholders', () => {
738738
renderTableWithPlaceholder()
739-
const header = screen.getByTestId('header-timestamp')
740-
const placeholders = screen.getAllByTestId(
741-
/header-timestamp.+placeholder/
742-
)
739+
const header = screen.getByTestId('header-Created')
740+
const placeholders = screen.getAllByTestId(/header-Created.+placeholder/)
743741
const entireColumn = [header, ...placeholders]
744742

745743
expect(entireColumn).toHaveLength(5)
@@ -787,7 +785,7 @@ describe('App', () => {
787785
it('should send the column id and not the placeholder id as the message payload', () => {
788786
renderTableWithPlaceholder()
789787
const placeholders = screen.getAllByTestId(
790-
/header-timestamp.+placeholder/
788+
/header-Created.+placeholder/
791789
)
792790
const placeholder = placeholders[0]
793791
fireEvent.contextMenu(placeholder, { bubbles: true })
@@ -801,7 +799,7 @@ describe('App', () => {
801799

802800
expect(mockPostMessage).toHaveBeenCalledTimes(1)
803801
expect(mockPostMessage).toHaveBeenCalledWith({
804-
payload: 'timestamp',
802+
payload: 'Created',
805803
type: MessageFromWebviewType.HIDE_EXPERIMENTS_TABLE_COLUMN
806804
})
807805
})

webview/src/experiments/components/table/Table.test.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,23 +192,23 @@ describe('Table', () => {
192192
it('should not have the workspaceChange class on a cell if there are no changes', async () => {
193193
renderExperimentsTable()
194194

195-
const row = await screen.findByTestId('timestamp___workspace')
195+
const row = await screen.findByTestId('Created___workspace')
196196

197197
expect(row?.className.includes(styles.workspaceChange)).toBe(false)
198198
})
199199

200200
it('should not have the workspaceChange class on a cell if there are changes to other columns but not this one', async () => {
201201
renderExperimentsTable({ changes: ['a_change'] })
202202

203-
const row = await screen.findByTestId('timestamp___workspace')
203+
const row = await screen.findByTestId('Created___workspace')
204204

205205
expect(row?.className.includes(styles.workspaceChange)).toBe(false)
206206
})
207207

208208
it('should have the workspaceChange class on a cell if there are changes matching the column id', async () => {
209-
renderExperimentsTable({ changes: ['timestamp'] })
209+
renderExperimentsTable({ changes: ['Created'] })
210210

211-
const row = await screen.findByTestId('timestamp___workspace')
211+
const row = await screen.findByTestId('Created___workspace')
212212

213213
expect(row?.className.includes(styles.workspaceChange)).toBe(true)
214214
})
@@ -250,13 +250,7 @@ describe('Table', () => {
250250
})
251251

252252
it('should order the columns with the columnOrder from the data', async () => {
253-
const columnOrder = [
254-
'id',
255-
'timestamp',
256-
'params:C',
257-
'params:B',
258-
'params:A'
259-
]
253+
const columnOrder = ['id', 'Created', 'params:C', 'params:B', 'params:A']
260254
const tableDataWithCustomColOrder = {
261255
...sortingTableDataFixture,
262256
columnOrder

webview/src/experiments/util/buildColumns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const getMainColumnProperties = (
5151
CellContext<Column, CellValue>
5252
>,
5353
header: () => <TimestampHeader />,
54-
id: ColumnType.TIMESTAMP
54+
id: 'Created'
5555
}
5656
}
5757

0 commit comments

Comments
 (0)