fix: adding and removing css classes that contained spaces (#6455)

* fix: adding CSS classes

* fix: removing css classes

* fix: add a test for multiple icon classes

* chore: format
This commit is contained in:
Beka Westberg
2022-09-28 15:51:17 -07:00
committed by GitHub
parent f678531389
commit 8530e6d537
26 changed files with 146 additions and 99 deletions

View File

@@ -18,6 +18,7 @@ import './events/events_block_change.js';
import type {BlockSvg} from './block_svg.js';
import * as browserEvents from './browser_events.js';
import * as dialog from './dialog.js';
import * as dom from './utils/dom.js';
import * as dropDownDiv from './dropdowndiv.js';
import * as eventUtils from './events/utils.js';
import {FieldConfig, Field} from './field.js';
@@ -244,10 +245,10 @@ export class FieldTextInput extends Field {
this.resizeEditor_();
const htmlInput = this.htmlInput_ as HTMLElement;
if (!this.isTextValid_) {
htmlInput.classList.add('blocklyInvalidInput');
dom.addClass(htmlInput, 'blocklyInvalidInput');
aria.setState(htmlInput, aria.State.INVALID, true);
} else {
htmlInput.classList.remove('blocklyInvalidInput');
dom.removeClass(htmlInput, 'blocklyInvalidInput');
aria.setState(htmlInput, aria.State.INVALID, false);
}
}
@@ -331,7 +332,7 @@ export class FieldTextInput extends Field {
eventUtils.setGroup(true);
const div = WidgetDiv.getDiv();
this.getClickTarget_().classList.add('editing');
dom.addClass(this.getClickTarget_(), 'editing');
const htmlInput = (document.createElement('input'));
htmlInput.className = 'blocklyHtmlInput';
@@ -400,7 +401,7 @@ export class FieldTextInput extends Field {
style.boxShadow = '';
this.htmlInput_ = null;
this.getClickTarget_().classList.remove('editing');
dom.removeClass(this.getClickTarget_(), 'editing');
}
/**