fix test and sortable

This commit is contained in:
yoshinobc
2022-04-27 00:24:28 +09:00
parent acf61177e7
commit 8e2956f22f
2 changed files with 6 additions and 4 deletions
@@ -604,13 +604,14 @@ export const TrialTable: FC<{ studyDetail: StudyDetail | null }> = ({
studyDetail?.intersection_search_space.length
) {
studyDetail?.intersection_search_space.forEach((s) => {
const sortable = s.distribution !== "CategoricalDistribution"
columns.push({
field: "params",
label: `Param ${s.name}`,
toCellValue: (i) =>
trials[i].params.find((p) => p.name === s.name)?.value || null,
sortable: true,
filterable: false,
sortable: sortable,
filterable: false, // TODO(yoshinobc): Support filtering by categorical parameters
less: (firstEl, secondEl): number => {
const firstVal = firstEl.params.find((p) => p.name === s.name)?.value
const secondVal = secondEl.params.find(
+3 -2
View File
@@ -86,13 +86,14 @@ it("Sort TrialTable by trial number", () => {
<TrialTable studyDetail={studyDetail} />
)
const rows = getAllByRole("row")
expect(within(rows[1]).getByText("0")).toBeTruthy()
expect(within(rows[3]).getByText("1")).toBeTruthy()
expect(within(rows[3]).getAllByText("1")[0]).toBeTruthy()
fireEvent.click(getByText("Number"))
const rows_updated = getAllByRole("row")
expect(within(rows_updated[1]).getByText("1")).toBeTruthy()
expect(within(rows_updated[1]).getAllByText("1")[0]).toBeTruthy()
expect(within(rows_updated[3]).getByText("0")).toBeTruthy()
})