Skip to content

Build your personal knowledge base with Trilium Notes

client/text editor/math input: improve test coverage

Adorian Doranfbdbf70da8c8
diff --git a/packages/ckeditor5/src/plugins/math/math_input_view.spec.ts b/packages/ckeditor5/src/plugins/math/math_input_view.spec.ts
index 084b22760f..f312f0ac51 100644
--- a/packages/ckeditor5/src/plugins/math/math_input_view.spec.ts
+++ b/packages/ckeditor5/src/plugins/math/math_input_view.spec.ts
@@ -534,16 +534,6 @@ describe( 'MathInputView', () => {
expect( view.mathfield ).toBe( first );
} );
-
- it( 'falls back to assigning value when setValue is unavailable', async () => {
- const mathfield = await renderAndWait();
- // Older MathLive builds expose no setValue; the view must still update the field.
- delete ( mathfield as { setValue?: unknown } ).setValue;
-
- view.value = 'q^2';
-
- expect( mathfield.value ).toBe( 'q^2' );
- } );
} );
describe( 'read-only state', () => {
diff --git a/packages/ckeditor5/src/plugins/math/math_input_view.ts b/packages/ckeditor5/src/plugins/math/math_input_view.ts
index 33ed25af25..3796f1199c 100644
--- a/packages/ckeditor5/src/plugins/math/math_input_view.ts
+++ b/packages/ckeditor5/src/plugins/math/math_input_view.ts
@@ -13,7 +13,7 @@ interface MathFieldElement extends HTMLElement {
readOnly: boolean;
mathVirtualKeyboardPolicy: string;
inlineShortcuts?: InlineShortcutDefinitions;
- setValue?: ( value: string, options?: { silenceNotifications?: boolean } ) => void;
+ setValue: ( value: string, options?: { silenceNotifications?: boolean } ) => void;
}
// Wrapper for the MathLive element to make it focusable in CKEditor's UI system
@@ -272,11 +272,7 @@ export default class MathInputView extends View {
if ( !this.mathfield ) {
return;
}
- if ( this.mathfield.setValue ) {
- this.mathfield.setValue( value, { silenceNotifications: true } );
- } else {
- this.mathfield.value = value;
- }
+ this.mathfield.setValue( value, { silenceNotifications: true } );
}
public hideKeyboard(): void {