/*! * VisualEditor UserInterface Actions IndentationAction tests. * * @copyright See AUTHORS.txt */ QUnit.module( 've.ui.IndentationAction' ); /* Tests */ QUnit.test( 'increase/decrease', ( assert ) => { const cases = [ { rangeOrSelection: new ve.Range( 13, 14 ), method: 'increase', expectedRangeOrSelection: new ve.Range( 13, 14 ), expectedData: function ( data ) { data.splice( 20, 0, { type: '/listItem' }, { type: '/list' } ); data.splice( 10, 1, { type: 'list', attributes: { style: 'bullet' } } ); }, undo: true, msg: 'increase indentation on Item 2' }, { rangeOrSelection: new ve.Range( 14, 16 ), method: 'decrease', expectedRangeOrSelection: new ve.Range( 14, 16 ), expectedData: function ( data ) { data.splice( 11, 2, { type: '/list' }, { type: 'paragraph' } ); data.splice( 19, 2, { type: '/paragraph' }, { type: 'list', attributes: { style: 'bullet' } } ); }, undo: true, msg: 'decrease indentation on partial selection of list item "Item 2"' }, { rangeOrSelection: new ve.Range( 3, 19 ), method: 'decrease', expectedRangeOrSelection: new ve.Range( 1, 15 ), expectedData: function ( data ) { data.splice( 0, 2 ); data.splice( 8, 2 ); data.splice( 16, 1, { type: 'list', attributes: { style: 'bullet' } } ); delete data[ 0 ].internal; delete data[ 8 ].internal; }, undo: true, msg: 'decrease indentation on Items 1 & 2' }, { rangeOrSelection: new ve.Range( 3, 19 ), method: 'increase', expectedRangeOrSelection: new ve.Range( 5, 21 ), expectedData: function ( data ) { data.splice( 0, 0, { type: 'list', attributes: { style: 'bullet' } }, { type: 'listItem' } ); data.splice( 23, 0, { type: '/list' }, { type: '/listItem' } ); }, undo: true, msg: 'increase indentation on Items 1 & 2' }, { html: '
| A |
| A |
a
b
c
| A |