fix: Theme.name does not match registered name (#6186) (#6226)

* fix: Theme.name does not match registered name (#6186)

* chore(tests): add test for defineTheme normalizing to lower case
This commit is contained in:
Thomas Wehr
2022-06-23 22:24:11 +02:00
committed by GitHub
parent 233cce8883
commit 9797943938
2 changed files with 8 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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');
});
});
});