|
|
@@ -5,8 +5,12 @@
|
|
|
|
|
|
/* bender-tags: document, delta */
|
|
|
|
|
|
+/* bender-include: ../../_tools/tools.js */
|
|
|
+
|
|
|
'use strict';
|
|
|
|
|
|
+const getIteratorCount = bender.tools.core.getIteratorCount;
|
|
|
+
|
|
|
const modules = bender.amd.require(
|
|
|
'document/transaction',
|
|
|
'document/document',
|
|
|
@@ -56,9 +60,7 @@ describe( 'Transaction', () => {
|
|
|
let count = 0;
|
|
|
|
|
|
for ( let delta of transaction ) {
|
|
|
- for ( let operation of delta ) {
|
|
|
- count++;
|
|
|
- }
|
|
|
+ count += getIteratorCount( delta );
|
|
|
}
|
|
|
|
|
|
return count;
|
|
|
@@ -69,9 +71,7 @@ describe( 'Transaction', () => {
|
|
|
|
|
|
for ( let delta of transaction ) {
|
|
|
for ( let operation of delta ) {
|
|
|
- for ( let value of operation.range ) {
|
|
|
- count++;
|
|
|
- }
|
|
|
+ count += getIteratorCount( operation.range );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -81,6 +81,7 @@ describe( 'Transaction', () => {
|
|
|
function getCompressedAttrs() {
|
|
|
// default: 111---111222---111
|
|
|
const range = Range.createFromElement( root );
|
|
|
+
|
|
|
return Array.from( range ).map( value => value.node.getAttr( 'a' ) || '-' ).join( '' );
|
|
|
}
|
|
|
|
|
|
@@ -134,7 +135,6 @@ describe( 'Transaction', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
-
|
|
|
describe( 'removeAttr', () => {
|
|
|
it( 'should remove the attribute on the range', () => {
|
|
|
transaction.removeAttr( 'a', getRange( 0, 2 ) );
|