Skip to content

Commit

Permalink
fix: #592 spreadsheet fixes for better usability (#612)
Browse files Browse the repository at this point in the history
fix: #592 Spreadsheet fixes for better usability
  • Loading branch information
Cuong Vu authored Mar 13, 2020
1 parent ace6937 commit 9586c60
Show file tree
Hide file tree
Showing 15 changed files with 637 additions and 368 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'
import { Cell, SetData, SetSelected, SetContextMenuProp } from '../types'
import ReactDataSheet from 'react-datasheet'
import { Cell, SetData, SetSelected, SetContextMenuProp, AfterCellsChanged } from '../types'

export const parseResult = {
data: [
Expand Down Expand Up @@ -92,14 +91,14 @@ export const data: Cell[][] = [
],
]

export const cellRenderProps: ReactDataSheet.CellRendererProps<Cell> = {
export const cellRenderProps = {
row: 3,
col: 10,
cell: { value: '[email protected]' },
selected: false,
editing: false,
updated: false,
attributesRenderer: jest.fn() as ReactDataSheet.AttributesRenderer<Cell>,
attributesRenderer: jest.fn() as any,
className: 'cell',
style: { background: 'red' },
onMouseDown: jest.fn(),
Expand All @@ -118,3 +117,5 @@ export const selectedMatrix = {
start: { i: 0, j: 1 },
end: { i: 2, j: 3 },
}

export const afterCellsChanged = jest.fn() as AfterCellsChanged
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ exports[`ContextMenu should match snapshot with visible false 1`] = `
Clear row
</a>
</li>
<li
key="clear-col"
>
<a
id="clear-col"
>
Clear column
</a>
</li>
</ul>
</div>
<div
Expand All @@ -64,15 +55,6 @@ exports[`ContextMenu should match snapshot with visible false 1`] = `
Remove row
</a>
</li>
<li
key="remove-col"
>
<a
id="remove-col"
>
Remove column
</a>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -110,15 +92,6 @@ exports[`ContextMenu should match snapshot with visible true 1`] = `
Clear row
</a>
</li>
<li
key="clear-col"
>
<a
id="clear-col"
>
Clear column
</a>
</li>
</ul>
</div>
<div
Expand All @@ -142,15 +115,6 @@ exports[`ContextMenu should match snapshot with visible true 1`] = `
Remove row
</a>
</li>
<li
key="remove-col"
>
<a
id="remove-col"
>
Remove column
</a>
</li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exports[`customCellRenderer should match snapshot with CustomComponent 1`] = `
value="[email protected]"
>
<CustomComponent
afterCellsChanged={[MockFunction]}
cellRenderProps={
Object {
"attributesRenderer": [MockFunction],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports[`Spreadsheet should match snapshot with default props 1`] = `
onCellsChanged={[Function]}
onContextMenu={[Function]}
onSelect={[Function]}
overflow="clip"
overflow="wrap"
rowRenderer={[Function]}
selected={null}
sheetRenderer={[Function]}
Expand All @@ -72,9 +72,14 @@ exports[`Spreadsheet should match snapshot with default props 1`] = `
"visible": false,
}
}
data={
Array [
Array [],
]
}
onCellsChanged={[Function]}
selected={null}
setContextMenuProp={[Function]}
setData={[Function]}
/>
</div>
`;
Expand Down Expand Up @@ -106,7 +111,7 @@ exports[`Spreadsheet should match snapshot with full props 1`] = `
onCellsChanged={[Function]}
onContextMenu={[Function]}
onSelect={[Function]}
overflow="clip"
overflow="wrap"
rowRenderer={[Function]}
selected={null}
sheetRenderer={[Function]}
Expand All @@ -124,9 +129,14 @@ exports[`Spreadsheet should match snapshot with full props 1`] = `
"visible": false,
}
}
data={
Array [
Array [],
]
}
onCellsChanged={[Function]}
selected={null}
setContextMenuProp={[Function]}
setData={[Function]}
/>
</div>
`;
Expand Down
Loading

0 comments on commit 9586c60

Please sign in to comment.