/*! * VisualEditor ContentEditable MediaWiki-specific ContentBranchNode tests. * * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ QUnit.module( 've.ce.ContentBranchNode' ); /* Tests */ // FIXME runner copypasted from core, use data provider QUnit.test( 'getRenderedContents', function ( assert ) { var i, len, doc, $rendered, $wrapper, cases = [ { 'msg': 'Annotation spanning text and inline nodes', 'data': [ { 'type': 'paragraph' }, 'a', ['b', [ { 'type': 'textStyle/bold' } ]], { 'type': 'mwEntity', 'attributes': { 'character': 'c' }, 'htmlAttributes': [ { 'keys': [ 'typeof' ], 'values': { 'typeof': 'mw:Entity' } } ], 'annotations': [ { 'type': 'textStyle/bold' } ] }, { 'type': '/mwEntity' }, ['d', [ { 'type': 'textStyle/bold' } ]], { 'type': 'alienInline', 'attributes': { 'domElements': $( 'e' ).toArray() }, 'annotations': [ { 'type': 'textStyle/bold' } ] }, { 'type': '/alienInline' }, { 'type': '/paragraph' } ], 'html': 'abcde' } ]; QUnit.expect( cases.length ); for ( i = 0, len = cases.length; i < len; i++ ) { doc = new ve.dm.Document( ve.dm.example.preprocessAnnotations( cases[i].data ) ); $rendered = ( new ve.ce.ParagraphNode( doc.documentNode.getChildren()[0] ) ).getRenderedContents(); $wrapper = $( '