Skip to content

Commit

Permalink
ExperimentList tests, use immer.js (#86)
Browse files Browse the repository at this point in the history
* experiment list tests

* use produce in more places

* remove extra test

* remove extra import
  • Loading branch information
yebrahim authored and k8s-ci-robot committed Nov 6, 2018
1 parent bba07e9 commit 0e2030c
Show file tree
Hide file tree
Showing 10 changed files with 710 additions and 45 deletions.
5 changes: 5 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"d3-dsv": "^1.0.10",
"dagre": "^0.8.2",
"http-proxy-middleware": "^0.19.0",
"immer": "^1.7.4",
"js-yaml": "^3.12.0",
"portable-fetch": "^3.0.0",
"re-resizable": "^4.9.0",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/TestUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export default class TestUtils {
* Mounts the given component with a fake router and returns the mounted tree
*/
// tslint:disable-next-line:variable-name
public static mountWithRouter(ComponentClass: React.ComponentClass, props: any) {
public static mountWithRouter(component: React.ReactElement<any>) {
const childContextTypes = {
router: object,
};
const context = createRouterContext();
const tree = mount(<ComponentClass {...props} />, { context, childContextTypes });
const tree = mount(component, { context, childContextTypes });
return tree;
}

Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/CustomTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@

import * as React from 'react';
import ArrowRight from '@material-ui/icons/ArrowRight';
import Checkbox, { CheckboxProps } from '@material-ui/core/Checkbox';
import ChevronLeft from '@material-ui/icons/ChevronLeft';
import ChevronRight from '@material-ui/icons/ChevronRight';
import IconButton from '@material-ui/core/IconButton';
import MenuItem from '@material-ui/core/MenuItem';
import Radio from '@material-ui/core/Radio';
import Separator from '../atoms/Separator';
import TableSortLabel from '@material-ui/core/TableSortLabel';
import TextField from '@material-ui/core/TextField';
import Tooltip from '@material-ui/core/Tooltip';
import WarningIcon from '@material-ui/icons/WarningRounded';
import { ListRequest } from '../lib/Apis';
import Checkbox, { CheckboxProps } from '@material-ui/core/Checkbox';
import { TextFieldProps } from '@material-ui/core/TextField';
import { classes, stylesheet } from 'typestyle';
import { fonts, fontsize, dimension, commonCss, color, padding } from '../Css';
Expand Down Expand Up @@ -256,6 +257,10 @@ export default class CustomTable extends React.Component<CustomTableProps, Custo
onChange={this.handleSelectAllClick.bind(this)} />
</div>
)}
{/* Shift cells to account for expand button */}
{!!this.props.getExpandComponent && (
<Separator orientation='horizontal' units={40} />
)}
{this.props.columns.map((col, i) => {
const isColumnSortable = !!this.props.columns[i].sortKey;
const isCurrentSortColumn = sortBy === this.props.columns[i].sortKey;
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/__snapshots__/CustomTable.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ exports[`CustomTable renders a collapsed row 1`] = `
onChange={[Function]}
/>
</div>
<Component
orientation="horizontal"
units={40}
/>
<div
className="columnName"
key="0"
Expand Down Expand Up @@ -399,6 +403,10 @@ exports[`CustomTable renders a collapsed row when selection is disabled 1`] = `
<div
className="header"
>
<Component
orientation="horizontal"
units={40}
/>
<div
className="columnName"
key="0"
Expand Down Expand Up @@ -932,6 +940,10 @@ exports[`CustomTable renders an expanded row with expanded component below it 1`
onChange={[Function]}
/>
</div>
<Component
orientation="horizontal"
units={40}
/>
<div
className="columnName"
key="0"
Expand Down
Loading

0 comments on commit 0e2030c

Please sign in to comment.