Browse Source

Add test case for converting multiple markers in one document.

Maciej Gołaszewski 6 years ago
parent
commit
79d4a8601b
1 changed files with 16 additions and 0 deletions
  1. 16 0
      packages/ckeditor5-restricted-editing/tests/restrictedediting.js

+ 16 - 0
packages/ckeditor5-restricted-editing/tests/restrictedediting.js

@@ -65,6 +65,22 @@ describe( 'RestrictedEditing', () => {
 				expect( marker.getStart().path ).to.deep.equal( [ 0, 4 ] );
 				expect( marker.getEnd().path ).to.deep.equal( [ 0, 7 ] );
 			} );
+
+			it( 'should convert multiple <span class="ck-restricted-editing-exception">', () => {
+				editor.setData(
+					'<p>foo <span class="ck-restricted-editing-exception">bar</span> baz</p>' +
+					'<p>ABCDEF<span class="ck-restricted-editing-exception">GHIJK</span>LMNOPQRST</p>'
+				);
+
+				expect( model.markers.has( 'restricted-editing-exception:1' ) ).to.be.true;
+				expect( model.markers.has( 'restricted-editing-exception:2' ) ).to.be.true;
+
+				// Data for the first marker is the same as in previous tests so no need to test it again.
+				const secondMarker = model.markers.get( 'restricted-editing-exception:2' );
+
+				expect( secondMarker.getStart().path ).to.deep.equal( [ 1, 6 ] );
+				expect( secondMarker.getEnd().path ).to.deep.equal( [ 1, 11 ] );
+			} );
 		} );
 
 		describe( 'downcast', () => {