2012-02-07 00:12:31 +00:00
|
|
|
module( 've/dm' );
|
2011-11-14 23:10:00 +00:00
|
|
|
|
2012-02-07 00:12:31 +00:00
|
|
|
test( 've.dm.TransactionProcessor', 31, function() {
|
|
|
|
var documentModel = ve.dm.DocumentNode.newFromPlainObject( veTest.obj );
|
2011-11-14 23:10:00 +00:00
|
|
|
|
|
|
|
// FIXME: These tests shouldn't use prepareFoo() because those functions
|
|
|
|
// normalize the transactions they create and are tested separately.
|
|
|
|
// We should be creating transactions directly and feeding those into
|
|
|
|
// commit()/rollback() --Roan
|
|
|
|
var elementAttributeChange = documentModel.prepareElementAttributeChange(
|
2012-03-02 23:12:38 +00:00
|
|
|
0, 'test', 1
|
2011-11-14 23:10:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// Test 1
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, elementAttributeChange );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph', 'attributes': { 'test': 1 } },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'commit applies an element attribute change transaction to the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 2
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, elementAttributeChange );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'rollback reverses the effect of an element attribute change transaction on the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
var contentAnnotation = documentModel.prepareContentAnnotation(
|
2012-02-07 00:12:31 +00:00
|
|
|
new ve.Range( 1, 4 ), 'set', { 'type': 'textStyle/bold' }
|
2011-11-14 23:10:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// Test 3
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, contentAnnotation );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
2011-11-21 22:32:22 +00:00
|
|
|
['a', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
'c',
|
2011-11-21 22:32:22 +00:00
|
|
|
{ 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' },
|
|
|
|
{ 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }
|
2011-11-14 23:10:00 +00:00
|
|
|
],
|
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'commit applies a content annotation transaction to the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 4
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, contentAnnotation );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'rollback reverses the effect of a content annotation transaction on the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
var insertion = documentModel.prepareInsertion( 3, ['d'] );
|
|
|
|
|
|
|
|
// Test 5
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, insertion );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 6 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
'd',
|
2011-11-21 22:32:22 +00:00
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'commit applies an insertion transaction to the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 6
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[0].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
'd',
|
2011-11-21 22:32:22 +00:00
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }]
|
2011-11-14 23:10:00 +00:00
|
|
|
],
|
|
|
|
'commit keeps model tree up to date with insertions'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 7
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, insertion );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'rollback reverses the effect of an insertion transaction on the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 8
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[0].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }]
|
2011-11-14 23:10:00 +00:00
|
|
|
],
|
|
|
|
'rollback keeps model tree up to date with insertions'
|
|
|
|
);
|
|
|
|
|
2012-02-07 00:12:31 +00:00
|
|
|
var removal = documentModel.prepareRemoval( new ve.Range( 2, 4 ) );
|
2011-11-14 23:10:00 +00:00
|
|
|
|
|
|
|
// Test 9
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, removal );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 3 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'commit applies a removal transaction to the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 10
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[0].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
['a'],
|
|
|
|
'commit keeps model tree up to date with removals'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 11
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, removal );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'rollback reverses the effect of a removal transaction on the content'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 12
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[0].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }]
|
2011-11-14 23:10:00 +00:00
|
|
|
],
|
|
|
|
'rollback keeps model tree up to date with removals'
|
|
|
|
);
|
|
|
|
|
2011-11-15 18:17:26 +00:00
|
|
|
var paragraphBreak = documentModel.prepareInsertion(
|
|
|
|
2, [{ 'type': '/paragraph' }, { 'type': 'paragraph' }]
|
|
|
|
);
|
2011-11-14 23:10:00 +00:00
|
|
|
|
|
|
|
// Test 13
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, paragraphBreak );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 7 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': 'paragraph' },
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'commit applies an insertion transaction that splits the paragraph'
|
|
|
|
);
|
2011-11-15 18:17:26 +00:00
|
|
|
|
2011-11-14 23:10:00 +00:00
|
|
|
// Test 14
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[0].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
['a'],
|
|
|
|
'commit keeps model tree up to date with paragraph split (paragraph 1)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 15
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[1].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }]
|
2011-11-14 23:10:00 +00:00
|
|
|
],
|
|
|
|
'commit keeps model tree up to date with paragraph split (paragraph 2)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 16
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, paragraphBreak );
|
2011-11-14 23:10:00 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 0, 5 ) ),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }],
|
2011-11-14 23:10:00 +00:00
|
|
|
{ 'type': '/paragraph' }
|
|
|
|
],
|
|
|
|
'rollback reverses the effect of a paragraph split on the content'
|
|
|
|
);
|
2011-11-15 18:17:26 +00:00
|
|
|
|
2011-11-14 23:10:00 +00:00
|
|
|
// Test 17
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.getChildren()[0].getContentData(),
|
2011-11-14 23:10:00 +00:00
|
|
|
[
|
|
|
|
'a',
|
2011-11-21 22:32:22 +00:00
|
|
|
['b', { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }],
|
|
|
|
['c', { 'type': 'textStyle/italic', 'hash': '{"type":"textStyle/italic"}' }]
|
2011-11-14 23:10:00 +00:00
|
|
|
],
|
|
|
|
'rollback keeps model tree up to date with paragraph split (paragraphs are merged back)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 18
|
|
|
|
deepEqual(
|
|
|
|
documentModel.getChildren()[1].getElementType(),
|
|
|
|
'table',
|
|
|
|
'rollback keeps model tree up to date with paragraph split (table follows the paragraph)'
|
|
|
|
);
|
2011-11-18 10:17:35 +00:00
|
|
|
|
2012-02-07 00:12:31 +00:00
|
|
|
var listItemMerge = documentModel.prepareRemoval( new ve.Range( 14, 19 ) );
|
2011-11-18 10:17:35 +00:00
|
|
|
|
|
|
|
// Test 19
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, listItemMerge );
|
2011-11-18 10:17:35 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 12, 22 ) ),
|
2011-11-18 10:17:35 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['bullet'] } },
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'f',
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' },
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['number'] } },
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'g',
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' }
|
|
|
|
],
|
|
|
|
'removal merges two list items with paragraphs'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 20
|
|
|
|
deepEqual( documentModel.children[1].children[0].children[0].children[1].children.length, 2,
|
|
|
|
'removal keeps model tree up to date with list item merge (number of children)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 21
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[1].children[0].children[0].children[1].children[0].children[0].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'f' ],
|
|
|
|
'removal keeps model tree up to date with list item merge (first list item)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 22
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[1].children[0].children[0].children[1].children[1].children[0].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'g' ],
|
|
|
|
'removal keeps model tree up to date with list item merge (second list item)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 23
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[2].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'h' ],
|
|
|
|
'rollback keeps model tree up to date with list item split (final paragraph)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 24
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, listItemMerge );
|
2011-11-18 10:17:35 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 12, 27 ) ),
|
2011-11-18 10:17:35 +00:00
|
|
|
[
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['bullet'] } },
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'e',
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' },
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['bullet', 'bullet'] } },
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'f',
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' },
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['number'] } },
|
|
|
|
{ 'type': 'paragraph' },
|
|
|
|
'g',
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' }
|
|
|
|
],
|
|
|
|
'rollback reverses list item merge (splits the list items)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 25
|
|
|
|
deepEqual( documentModel.children[1].children[0].children[0].children[1].children.length, 3,
|
|
|
|
'rollback keeps model tree up to date with list item split (number of children)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 26
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[1].children[0].children[0].children[1].children[0].children[0].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'e' ],
|
|
|
|
'rollback keeps model tree up to date with list item split (first list item)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 27
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[1].children[0].children[0].children[1].children[1].children[0].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'f' ],
|
|
|
|
'rollback keeps model tree up to date with list item split (second list item)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 28
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[1].children[0].children[0].children[1].children[2].children[0].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'g' ],
|
|
|
|
'rollback keeps model tree up to date with list item split (third list item)'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 29
|
|
|
|
deepEqual(
|
2011-12-05 19:41:04 +00:00
|
|
|
documentModel.children[2].getContentData(),
|
2011-11-18 10:17:35 +00:00
|
|
|
[ 'h' ],
|
|
|
|
'rollback keeps model tree up to date with list item split (final paragraph)'
|
|
|
|
);
|
|
|
|
|
2011-12-06 21:36:36 +00:00
|
|
|
var listSplit = documentModel.prepareInsertion( 17, [{ 'type': '/list' }, { 'type': 'list' }] );
|
2011-12-06 22:04:18 +00:00
|
|
|
|
2011-12-06 21:36:36 +00:00
|
|
|
// Test 30
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.commit( documentModel, listSplit );
|
2011-12-06 21:36:36 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 15, 21 ) ),
|
2011-12-06 21:36:36 +00:00
|
|
|
[
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' },
|
|
|
|
{ 'type': '/list' },
|
|
|
|
{ 'type': 'list' },
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['bullet', 'bullet'] } },
|
|
|
|
{ 'type': 'paragraph' }
|
|
|
|
],
|
|
|
|
'commit splits list into two lists'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Test 31
|
2012-02-07 00:12:31 +00:00
|
|
|
ve.dm.TransactionProcessor.rollback( documentModel, listSplit );
|
2011-12-06 21:36:36 +00:00
|
|
|
deepEqual(
|
2012-02-07 00:12:31 +00:00
|
|
|
documentModel.getData( new ve.Range( 15, 19 ) ),
|
2011-12-06 21:36:36 +00:00
|
|
|
[
|
|
|
|
{ 'type': '/paragraph' },
|
|
|
|
{ 'type': '/listItem' },
|
|
|
|
{ 'type': 'listItem', 'attributes': { 'styles': ['bullet', 'bullet'] } },
|
|
|
|
{ 'type': 'paragraph' }
|
|
|
|
],
|
|
|
|
'rollback reverses list split'
|
|
|
|
);
|
2011-11-14 23:10:00 +00:00
|
|
|
} );
|