diff --git a/core/theme.js b/core/theme.js index d156b1227d9..e5bc08c52bd 100644 --- a/core/theme.js +++ b/core/theme.js @@ -149,6 +149,7 @@ class Theme { * @return {!Theme} A new Blockly theme. */ static defineTheme(name, themeObj) { + name = name.toLowerCase(); const theme = new Theme(name); let base = themeObj['base']; if (base) { diff --git a/tests/mocha/theme_test.js b/tests/mocha/theme_test.js index 95d61ce0d04..cc29797f112 100644 --- a/tests/mocha/theme_test.js +++ b/tests/mocha/theme_test.js @@ -274,4 +274,11 @@ suite('Theme', function() { this.constants.validatedBlockStyle_(inputStyle), expectedOutput); }); }); + + suite('defineTheme', function() { + test('Normalizes to lowercase', function() { + const theme = Blockly.Theme.defineTheme('TEST', {}); + chai.assert.equal(theme.name, 'test'); + }); + }); });