From 6dd6c68595e39f95af553a7eae2575b118128b1b Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Wed, 6 Feb 2019 09:42:37 -0500 Subject: [PATCH] Add an integration test for toolbox updating after see-inside. I needed to update the player css because the editor side wasn't large enough to be useable. --- src/playground/player.css | 8 ++++++++ src/playground/player.jsx | 6 +----- test/integration/blocks.test.js | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/playground/player.css b/src/playground/player.css index 355eeeecd..a0a00f9aa 100644 --- a/src/playground/player.css +++ b/src/playground/player.css @@ -2,6 +2,14 @@ width: calc(480px + 1rem); } +.editor { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; +} + .stage-only * { box-sizing: border-box; } diff --git a/src/playground/player.jsx b/src/playground/player.jsx index 2235bbac7..8224ad648 100644 --- a/src/playground/player.jsx +++ b/src/playground/player.jsx @@ -21,11 +21,7 @@ if (process.env.NODE_ENV === 'production' && typeof window === 'object') { import styles from './player.css'; const Player = ({isPlayerOnly, onSeeInside, projectId}) => ( - <Box - className={classNames({ - [styles.stageOnly]: isPlayerOnly - })} - > + <Box className={classNames(isPlayerOnly ? styles.stageOnly : styles.editor)}> {isPlayerOnly && <button onClick={onSeeInside}>{'See inside'}</button>} <GUI enableCommunity diff --git a/test/integration/blocks.test.js b/test/integration/blocks.test.js index d70396032..b2b048e41 100644 --- a/test/integration/blocks.test.js +++ b/test/integration/blocks.test.js @@ -228,4 +228,21 @@ describe('Working with the blocks', () => { await driver.sleep(500); // Wait for scroll to finish await clickText('Meow', scope.blocksTab); // Meow, not A Bass }); + + // Regression test for switching between editor/player causing toolbox to stop updating + test('"See inside" after being on project page re-initializing variables', async () => { + const playerUri = path.resolve(__dirname, '../../build/player.html'); + await loadUri(playerUri); + await clickText('See inside'); + await clickText('Variables'); + await driver.sleep(500); // Wait for scroll to finish + await clickText('my\u00A0variable'); + + await clickText('See Project Page'); + await clickText('See inside'); + + await clickText('Variables'); + await driver.sleep(500); // Wait for scroll to finish + await clickText('my\u00A0variable'); + }); }); -- GitLab