jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/335750 )
Change subject: Add TransactionProcessor tests for wrapping, unwrapping and rewrapping ...................................................................... Add TransactionProcessor tests for wrapping, unwrapping and rewrapping We had transaction builder tests for these, but there were no tests asserting that wrapping transactions (which are perhaps the weirdest case when it comes to tree synchronization) actually process correctly. Change-Id: Ib621308294ad3ae632f0af87ec129dee7d7aba27 --- M tests/dm/ve.dm.TransactionProcessor.test.js 1 file changed, 45 insertions(+), 0 deletions(-) Approvals: Divec: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/dm/ve.dm.TransactionProcessor.test.js b/tests/dm/ve.dm.TransactionProcessor.test.js index a79ab81..01bf70e 100644 --- a/tests/dm/ve.dm.TransactionProcessor.test.js +++ b/tests/dm/ve.dm.TransactionProcessor.test.js @@ -331,6 +331,51 @@ data.splice( 3, 1 ); } }, + 'wrapping elements': { + calls: [ + [ 'pushRetain', 55 ], + [ 'pushReplace', 55, 0, [ { type: 'list', attributes: { style: 'number' } }, { type: 'listItem' } ] ], + [ 'pushRetain', 3 ], + [ 'pushReplace', 58, 0, [ { type: '/listItem' }, { type: 'listItem' } ] ], + [ 'pushRetain', 3 ], + [ 'pushReplace', 61, 0, [ { type: '/listItem' }, { type: '/list' } ] ] + ], + expected: function ( data ) { + data.splice( 61, 0, { type: '/listItem' }, { type: '/list' } ); + data.splice( 58, 0, { type: '/listItem' }, { type: 'listItem' } ); + data.splice( 55, 0, { type: 'list', attributes: { style: 'number' } }, { type: 'listItem' } ); + } + }, + 'unwrapping elements': { + calls: [ + [ 'pushRetain', 43 ], + [ 'pushReplace', 43, 2, [] ], + [ 'pushRetain', 3 ], + [ 'pushReplace', 48, 2, [] ], + [ 'pushRetain', 3 ], + [ 'pushReplace', 53, 2, [] ] + ], + expected: function ( data ) { + data.splice( 53, 2 ); + data.splice( 48, 2 ); + data.splice( 43, 2 ); + } + }, + 'rewrapping elements': { + calls: [ + [ 'pushRetain', 43 ], + [ 'pushReplace', 43, 2, [ { type: 'list', attributes: { style: 'number' } }, { type: 'listItem' } ] ], + [ 'pushRetain', 3 ], + [ 'pushReplace', 48, 2, [ { type: '/listItem' }, { type: 'listItem' } ] ], + [ 'pushRetain', 3 ], + [ 'pushReplace', 53, 2, [ { type: '/listItem' }, { type: '/list' } ] ] + ], + expected: function ( data ) { + data.splice( 53, 2, { type: '/listItem' }, { type: '/list' } ); + data.splice( 48, 2, { type: '/listItem' }, { type: 'listItem' } ); + data.splice( 43, 2, { type: 'list', attributes: { style: 'number' } }, { type: 'listItem' } ); + } + }, 'applying a link across an existing annotation boundary': { data: [ { type: 'paragraph' }, -- To view, visit https://gerrit.wikimedia.org/r/335750 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib621308294ad3ae632f0af87ec129dee7d7aba27 Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Catrope <r...@wikimedia.org> Gerrit-Reviewer: Divec <da...@troi.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits