Skip to content

Commit

Permalink
Merge pull request #8705 from aoneill01/fix/variable-blocks-after-lan…
Browse files Browse the repository at this point in the history
…guage-switch

fix: load flyout correctly when switching languages
  • Loading branch information
Andy O'Neill authored Jan 10, 2023
2 parents a7c52cc + 2fa0880 commit 9d065da
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/containers/blocks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ class Blocks extends React.Component {
this.detachVM();
this.workspace.dispose();
clearTimeout(this.toolboxUpdateTimeout);

// Clear the flyout blocks so that they can be recreated on mount.
this.props.vm.clearFlyoutBlocks();
}
requestToolboxUpdate () {
clearTimeout(this.toolboxUpdateTimeout);
Expand Down
41 changes: 41 additions & 0 deletions test/integration/blocks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,45 @@ describe('Working with the blocks', () => {
await clickButton('OK');
await clickText('list1', scope.blocksTab);
});

test('Use variable blocks after switching languages', async () => {
const myVariable = 'my\u00A0variable';
const changeVariableByScope = "*[@data-id='data_changevariableby']";

await loadUri(uri);

await clickText('Code');
await clickBlocksCategory('Variables');

// change "my variable" by 1
await clickText('change', changeVariableByScope);

// check reported value 1
await clickText(myVariable, scope.blocksTab);
await findByText('1', scope.reportedValue);

// change language
await clickXpath('//*[@aria-label="language selector"]');
await clickText('Deutsch');

await clickText('Skripte');
await clickBlocksCategory('Variablen');

// make sure "my variable" is still 1
await clickText(myVariable);
await findByText('1', scope.reportedValue);

// change step from 1 to 10
await clickText('1', changeVariableByScope);
await driver.actions()
.sendKeys('10')
.perform();

// change "my variable" by 10
await clickText('ändere', changeVariableByScope);

// check it is turned up to 11
await clickText(myVariable);
await findByText('11', scope.reportedValue);
});
});

0 comments on commit 9d065da

Please sign in to comment.