/*! * VisualEditor Cite-specific DiffElement tests. * * @copyright 2011-2018 VisualEditor Team and others; see http://ve.mit-license.org */ QUnit.module( 've.ui.DiffElement (Cite)' ); QUnit.test( 'Diffing', function ( assert ) { var i, len, // spacer = '
', ref = function ( text, num, name ) { var dataMw = { name: 'ref', body: { html: text } }; if ( name ) { dataMw.attrs = { name: name }; } return '' + '[' + num + ']' + ''; }, cases = [ { msg: 'Simple ref change', oldDoc: '

' + ref( 'Foo' ) + ref( 'Bar' ) + ref( 'Baz' ) + '

' + '

Notes

' + '
', newDoc: '

' + ref( 'Foo' ) + ref( 'Bar ish' ) + ref( 'Baz' ) + '

' + '

Notes

' + '
', expected: '
' + '

' + ref( 'Foo', '1' ) + '' + ref( 'Bar', '2', ':0' ) + '' + '' + ref( 'Bar ish', '2', ':0' ) + '' + ref( 'Baz', '3' ) + '

' + '
' + '

Notes

' + '
' + '
    ' + '
  1. Foo

  2. ' + '
' + '
    ' + '
  1. Bar ish
  2. ' + '
' + '
    ' + '
  1. Baz

  2. ' + '
' + '
' } ]; for ( i = 0, len = cases.length; i < len; i++ ) { ve.test.utils.runDiffElementTest( assert, cases[ i ] ); } } );