|
@@ -132,6 +132,19 @@ describe( 'view', () => {
|
|
|
expect( viewRoot.getAttribute( 'contenteditable' ) ).to.equal( 'false' );
|
|
expect( viewRoot.getAttribute( 'contenteditable' ) ).to.equal( 'false' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+ it( 'should handle the ".ck-read-only" class management on #isReadOnly change', () => {
|
|
|
|
|
+ const domDiv = document.createElement( 'div' );
|
|
|
|
|
+ const viewRoot = createViewRoot( viewDocument, 'div', 'main' );
|
|
|
|
|
+
|
|
|
|
|
+ view.attachDomRoot( domDiv );
|
|
|
|
|
+
|
|
|
|
|
+ viewRoot.isReadOnly = false;
|
|
|
|
|
+ expect( viewRoot.hasClass( 'ck-read-only' ) ).to.be.false;
|
|
|
|
|
+
|
|
|
|
|
+ viewRoot.isReadOnly = true;
|
|
|
|
|
+ expect( viewRoot.hasClass( 'ck-read-only' ) ).to.be.true;
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
it( 'should call observe on each observer', () => {
|
|
it( 'should call observe on each observer', () => {
|
|
|
// The variable will be overwritten.
|
|
// The variable will be overwritten.
|
|
|
view.destroy();
|
|
view.destroy();
|
|
@@ -222,6 +235,23 @@ describe( 'view', () => {
|
|
|
|
|
|
|
|
domDiv.remove();
|
|
domDiv.remove();
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should remove the ".ck-read-only" class from the DOM root', () => {
|
|
|
|
|
+ const domDiv = document.createElement( 'div' );
|
|
|
|
|
+ const viewRoot = createViewRoot( viewDocument, 'div', 'main' );
|
|
|
|
|
+
|
|
|
|
|
+ view.attachDomRoot( domDiv );
|
|
|
|
|
+ view.forceRender();
|
|
|
|
|
+
|
|
|
|
|
+ viewRoot.isReadOnly = true;
|
|
|
|
|
+ expect( domDiv.classList.contains( 'ck-read-only' ) ).to.be.true;
|
|
|
|
|
+
|
|
|
|
|
+ view.detachDomRoot( 'main' );
|
|
|
|
|
+
|
|
|
|
|
+ expect( domDiv.classList.contains( 'ck-read-only' ) ).to.be.false;
|
|
|
|
|
+
|
|
|
|
|
+ domDiv.remove();
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'addObserver()', () => {
|
|
describe( 'addObserver()', () => {
|