diff --git a/app/actions.js b/app/actions.js index c2a1ef8..e5e7e20 100644 --- a/app/actions.js +++ b/app/actions.js @@ -156,8 +156,7 @@ export function deleteCaption(captionId) { return { type: DELETE_CAPTION, captionId }; } -export function deleteSelection(event, selection) { - event.preventDefault(); +export function deleteSelection(selection) { return { type: DELETE_SELECTION, selection }; } diff --git a/app/components/Root.jsx b/app/components/Root.jsx index bd4aef6..2c22d71 100644 --- a/app/components/Root.jsx +++ b/app/components/Root.jsx @@ -73,7 +73,10 @@ class Root extends Component { 'resetZoom': () => dispatch(resetZoom()), 'shiftDown': () => this.setState({ shiftKey: true }), 'shiftUp': () => this.setState({ shiftKey: false }), - 'delete': (event) => dispatch(deleteSelection(event, selection)) + 'delete': (event) => { + event.preventDefault(); + dispatch(deleteSelection(selection)); + } }; let graphApi = { diff --git a/app/components/__tests__/Edge-test.jsx b/app/components/__tests__/Edge-test.jsx index 709f7c7..8ff6768 100644 --- a/app/components/__tests__/Edge-test.jsx +++ b/app/components/__tests__/Edge-test.jsx @@ -72,14 +72,4 @@ describe("Edge Component", () => { TestUtils.Simulate.click(select); expect(clickEdge.mock.calls[0][0]).toBe(data.id); }); - - it("should be removed when delete hotkey is pressed", () => { - let deleteEdge = jest.genMockFunction(); - let edge = TestUtils.renderIntoDocument( - - ); - let element = ReactDOM.findDOMNode(edge); - TestUtils.Simulate.keyDown(element, {key: "Delete", keyCode: 46, which: 46}); - expect(deleteEdge.mock.calls[0]).toBeUndefined(); - }); }); \ No newline at end of file diff --git a/app/components/__tests__/Node-test.jsx b/app/components/__tests__/Node-test.jsx index be3179e..429e278 100644 --- a/app/components/__tests__/Node-test.jsx +++ b/app/components/__tests__/Node-test.jsx @@ -81,14 +81,4 @@ describe("Node Component", () => { expect(moveNode.mock.calls.length).toBe(1); }); - - it("should be removed when delete hotkey is pressed", () => { - let deleteNode = jest.genMockFunction(); - let wrapper = shallow( - - ); - let element = wrapper.find("g.node"); - TestUtils.Simulate.keyDown(element, {key: "Delete", keyCode: 46, which: 46}); - expect(deleteNode.mock.calls[0]).toBeUndefined(); - }); }); \ No newline at end of file diff --git a/app/main.jsx b/app/main.jsx index 98fa5dd..bd40316 100644 --- a/app/main.jsx +++ b/app/main.jsx @@ -201,8 +201,8 @@ class Oligrapher { this.root.dispatchProps.dispatch(deselectAll()); } - deleteSelection(event) { - this.root.dispatchProps.dispatch(deleteSelection(event, this.getSelection())); + deleteSelection() { + this.root.dispatchProps.dispatch(deleteSelection(this.getSelection())); } updateNode(nodeId, data) {