From ed21909f07da7f14ea5bc34ecaad656df343472b Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Thu, 1 Nov 2018 11:07:34 -0400 Subject: [PATCH] Pass onActivateBlocksTab to sprite library to switch tabs after adding. I forgot that the integration test needs to try clicking, because finding text will find invisible text as well --- src/components/target-pane/target-pane.jsx | 3 +++ src/containers/target-pane.jsx | 1 + test/integration/sprites.test.js | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/target-pane/target-pane.jsx b/src/components/target-pane/target-pane.jsx index 57823a082..bffb876e8 100644 --- a/src/components/target-pane/target-pane.jsx +++ b/src/components/target-pane/target-pane.jsx @@ -21,6 +21,7 @@ const TargetPane = ({ fileInputRef, hoveredTarget, spriteLibraryVisible, + onActivateBlocksTab, onChangeSpriteDirection, onChangeSpriteName, onChangeSpriteRotationStyle, @@ -92,6 +93,7 @@ const TargetPane = ({ {spriteLibraryVisible ? ( <SpriteLibrary vm={vm} + onActivateBlocksTab={onActivateBlocksTab} onRequestClose={onRequestCloseSpriteLibrary} /> ) : null} @@ -128,6 +130,7 @@ TargetPane.propTypes = { hoveredSprite: PropTypes.string, receivedBlocks: PropTypes.bool }), + onActivateBlocksTab: PropTypes.func.isRequired, onChangeSpriteDirection: PropTypes.func, onChangeSpriteName: PropTypes.func, onChangeSpriteRotationStyle: PropTypes.func, diff --git a/src/containers/target-pane.jsx b/src/containers/target-pane.jsx index 3d54b86cb..22f5c7c8e 100644 --- a/src/containers/target-pane.jsx +++ b/src/containers/target-pane.jsx @@ -202,6 +202,7 @@ class TargetPane extends React.Component { <TargetPaneComponent {...componentProps} fileInputRef={this.setFileInput} + onActivateBlocksTab={this.handleActivateBlocksTab} onChangeSpriteDirection={this.handleChangeSpriteDirection} onChangeSpriteName={this.handleChangeSpriteName} onChangeSpriteRotationStyle={this.handleChangeSpriteRotationStyle} diff --git a/test/integration/sprites.test.js b/test/integration/sprites.test.js index 0aa957bfc..83a07793d 100644 --- a/test/integration/sprites.test.js +++ b/test/integration/sprites.test.js @@ -33,7 +33,7 @@ describe('Working with sprites', () => { await clickXpath('//button[@aria-label="Choose a Sprite"]'); await clickText('Apple', scope.modal); // Closes modal await rightClickText('Apple', scope.spriteTile); // Make sure it is there - await findByText('Motion'); // Make sure we are back to the code tab + await clickText('Motion'); // Make sure we are back to the code tab const logs = await getLogs(); await expect(logs).toEqual([]); }); -- GitLab