UNPKG

@ryusei/code

Version:

<div align="center"> <a href="https://code.ryuseijs.com"> <img alt="RyuseiCode" src="https://code.ryuseijs.com/images/svg/logo.svg" width="70"> </a>

27 lines (19 loc) 778 B
import { CLASS_READONLY } from '../../../constants/classes'; import { init } from '../../../test'; describe( 'Editor#readOnly()', () => { test( 'can make the editor read-only.', () => { const Editor = init(); Editor.readOnly = true; expect( Editor.elements.root.classList.contains( CLASS_READONLY ) ).toBe( true ); expect( Editor.elements.editable.contentEditable ).toBe( 'false' ); } ); test( 'can indicate whether the editor is read-only or not.', () => { const Editor = init(); // The value may be `undefined`. expect( Editor.readOnly ).toBeFalsy(); Editor.readOnly = true; expect( Editor.readOnly ).toBe( true ); Editor.readOnly = false; expect( Editor.readOnly ).toBe( false ); } ); } );