Преглед изворни кода

Imroved some test assertions.

Oskar Wrobel пре 9 година
родитељ
комит
0959cedce9

+ 4 - 1
packages/ckeditor5-engine/tests/_utils-tests/model.js

@@ -10,6 +10,7 @@ import Element from '/ckeditor5/engine/model/element.js';
 import Text from '/ckeditor5/engine/model/text.js';
 import Range from '/ckeditor5/engine/model/range.js';
 import Position from '/ckeditor5/engine/model/position.js';
+import count from '/ckeditor5/utils/count.js';
 
 describe( 'model test utils', () => {
 	let document, root, selection, sandbox;
@@ -288,6 +289,7 @@ describe( 'model test utils', () => {
 					'<a></a>foo<$text bold="true">bar</$text>[]<b></b>'
 				);
 				expect( selection.getAttribute( 'bold' ) ).to.true;
+				expect( count( selection.getAttributes() ) ).to.equal( 1 );
 			} );
 
 			it( 'writes selection collapsed at the end of the root', () => {
@@ -308,6 +310,7 @@ describe( 'model test utils', () => {
 					'<a></a>foo<$text bold="true">b[]ar</$text><b></b>'
 				);
 				expect( selection.getAttribute( 'bold' ) ).to.true;
+				expect( count( selection.getAttributes() ) ).to.equal( 1 );
 			} );
 
 			it( 'writes flat selection containing couple of nodes', () => {
@@ -531,7 +534,7 @@ describe( 'model test utils', () => {
 				data: 'x[y]z'
 			} );
 
-			it( 'sets a backward selection containing an element', () => {
+			it( 'sets selection within a text with different attributes', () => {
 				const result = parse( '<$text bold="true">fo[o</$text>ba]r', document.schema, {
 					selectionAttributes: { bold: true }
 				} );

+ 2 - 2
packages/ckeditor5-engine/tests/_utils/view.js

@@ -266,8 +266,8 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
  * When set to `null` root element will be created automatically. If set to
  * {@link engine.view.Element Element} or {@link engine.view.DocumentFragment DocumentFragment} - this node
  * will be used as root for all parsed nodes.
- * @param {Boolean} [options.sameSelectionCharacters=false] When set to `true` then selection inside text should be marked using `{` and `}`
- * and selection outside text using `[` and `]`. When set to `false` then both should be marked with `[` and `]` only.
+ * @param {Boolean} [options.sameSelectionCharacters=false] When set to `false` then selection inside text should be marked using
+ * `{` and `}` and selection outside text using `[` and `]`. When set to `true` then both should be marked with `[` and `]` only.
  * @returns {engine.view.Text|engine.view.Element|engine.view.DocumentFragment|Object} Returns parsed view node
  * or object with two fields `view` and `selection` when selection ranges were included in data to parse.
  */