Merge pull request #4481 from paulkaplan/hotfix/toolbox-language

[develop] hotfix toolbox language
This commit is contained in:
Paul Kaplan authored and GitHub committed 2019-02-04 11:35:21 -05:00
commit 361187dcaa
2 files changed
+14 -2

No files matched your search

+2 -1
View File
@@ -87,6 +87,7 @@ class Blocks extends React.Component {
componentDidMount () {
this.ScratchBlocks.FieldColourSlider.activateEyedropper_ = this.props.onActivateColorPicker;
this.ScratchBlocks.Procedures.externalProcedureDefCallback = this.props.onActivateCustomProcedures;
this.ScratchBlocks.ScratchMsgs.setLocale(this.props.locale);
const workspaceConfig = defaultsDeep({},
Blocks.defaultOptions,
@@ -526,7 +527,7 @@ Blocks.propTypes = {
extensionLibraryVisible: PropTypes.bool,
isRtl: PropTypes.bool,
isVisible: PropTypes.bool,
locale: PropTypes.string,
locale: PropTypes.string.isRequired,
messages: PropTypes.objectOf(PropTypes.string),
onActivateColorPicker: PropTypes.func,
onActivateCustomProcedures: PropTypes.func,
+12 -1
View File
@@ -24,7 +24,7 @@ describe('Localization', () => {
await driver.quit();
});
test('Localization', async () => {
test('Switching languages', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
@@ -52,4 +52,15 @@ describe('Localization', () => {
const logs = await getLogs();
await expect(logs).toEqual([]);
});
// Regression test for #4476, blocks in wrong language when loaded with locale
test('Loading with locale shows correct blocks', async () => {
await loadUri(`${uri}?locale=de`);
await clickXpath('//button[@title="Ausprobieren!"]'); // "Try It"
await clickText('Fühlen'); // Sensing category in German
await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks to scroll
await clickText('Antwort'); // Find the "answer" block in German
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});