From 88f22ec10f10654f9e531f22378e74fa2e40fa4d Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Tue, 6 Dec 2011 21:36:36 +0000 Subject: [PATCH] Added test which currently fails because Transaction processor is broken --- tests/es/es.TransactionProcessor.test.js | 31 +++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/es/es.TransactionProcessor.test.js b/tests/es/es.TransactionProcessor.test.js index fedcb0a725..4b4a0be0ac 100644 --- a/tests/es/es.TransactionProcessor.test.js +++ b/tests/es/es.TransactionProcessor.test.js @@ -1,6 +1,6 @@ module( 'es' ); -test( 'es.TransactionProcessor', 29, function() { +test( 'es.TransactionProcessor', 30, function() { var documentModel = es.DocumentModel.newFromPlainObject( esTest.obj ); // FIXME: These tests shouldn't use prepareFoo() because those functions @@ -348,4 +348,33 @@ test( 'es.TransactionProcessor', 29, function() { 'rollback keeps model tree up to date with list item split (final paragraph)' ); + var listSplit = documentModel.prepareInsertion( 17, [{ 'type': '/list' }, { 'type': 'list' }] ); + + // Test 30 + es.TransactionProcessor.commit( documentModel, listSplit ); + deepEqual( + documentModel.getData( new es.Range( 15, 21 ) ), + [ + { 'type': '/paragraph' }, + { 'type': '/listItem' }, + { 'type': '/list' }, + { 'type': 'list' }, + { 'type': 'listItem', 'attributes': { 'styles': ['bullet', 'bullet'] } }, + { 'type': 'paragraph' } + ], + 'commit splits list into two lists' + ); + + // Test 31 + es.TransactionProcessor.rollback( documentModel, listSplit ); + deepEqual( + documentModel.getData( new es.Range( 15, 19 ) ), + [ + { 'type': '/paragraph' }, + { 'type': '/listItem' }, + { 'type': 'listItem', 'attributes': { 'styles': ['bullet', 'bullet'] } }, + { 'type': 'paragraph' } + ], + 'rollback reverses list split' + ); } );