Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font color and font background color throw error while having buttons in the main toolbar and the balloon toolbar #15658

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,12 @@ export default class ColorGridsFragmentView extends View {
*/
public updateSelectedColors(): void {
const documentColorsGrid = this.documentColorsGrid;
const staticColorsGrid = this.staticColorsGrid!;
const staticColorsGrid = this.staticColorsGrid;
const selectedColor = this.selectedColor;

staticColorsGrid.selectedColor = selectedColor;
if ( staticColorsGrid ) {
staticColorsGrid.selectedColor = selectedColor;
}

if ( documentColorsGrid ) {
documentColorsGrid.selectedColor = selectedColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,15 @@ describe( 'ColorSelectorView', () => {
sinon.assert.calledOnce( spy );
} );

it( 'should call updateSelectedColors when color grid is not defined without errors', () => {
const spy = sinon.spy( colorSelectorView, 'updateSelectedColors' );

colorSelectorView.colorGridsFragmentView.staticColorsGrid = null;
colorSelectorView.updateSelectedColors();

sinon.assert.calledOnce( spy );
} );

it( 'should unset selected color', () => {
setModelData( model,
'<paragraph><$text testColor="gold">Bar</$text></paragraph>' +
Expand Down