Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/table/src/cell/editableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ export class EditableCell extends React.Component<IEditableCellProps, IEditableC
}

public renderHotkeys() {
const { tabIndex } = this.props;

return (
<Hotkeys>
<Hotkeys tabIndex={tabIndex}>
<Hotkey
key="edit-cell"
label="Edit the currently focused cell"
Expand Down
18 changes: 17 additions & 1 deletion packages/table/test/editableCellTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as sinon from "sinon";

import { Classes } from "@blueprintjs/core";
import * as TableClasses from "../src/common/classes";
import { EditableCell } from "../src/index";
import { Cell, EditableCell } from "../src/index";
import { CellType, expectCellLoading } from "./cellTestUtils";

describe("<EditableCell>", () => {
Expand All @@ -35,6 +35,22 @@ describe("<EditableCell>", () => {
expectCellLoading(editableCellHarness.first().getDOMNode(), CellType.BODY_CELL);
});

it("renders cell with default tabIndex as zero", () => {
const tabIndex = 0;
const elem = mount(<EditableCell value="test-value-5000" />);
const cellInstance = elem.find(Cell).instance() as Cell;

expect(cellInstance.props.tabIndex).to.equal(tabIndex);
});

it("renders cell with tabIndex", () => {
const tabIndex = 1;
const elem = mount(<EditableCell tabIndex={tabIndex} value="test-value-5000" />);
const cellInstance = elem.find(Cell).instance() as Cell;

expect(cellInstance.props.tabIndex).to.equal(tabIndex);
});

it("renders new value if props.value changes", () => {
const VALUE_1 = "foo";
const VALUE_2 = "bar";
Expand Down