Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/254336

Change subject: Improve tests of data-parsoid annotation comparisons
......................................................................

Improve tests of data-parsoid annotation comparisons

So that it actually fails if you remove the key feature.

Depends on Iff15190e in core.

Change-Id: I1557f683241193aa4a97e04af0b4daf244a8b121
---
M modules/ve-mw/tests/dm/ve.dm.mwExample.js
1 file changed, 36 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/36/254336/1

diff --git a/modules/ve-mw/tests/dm/ve.dm.mwExample.js 
b/modules/ve-mw/tests/dm/ve.dm.mwExample.js
index 769df50..5806bdd 100644
--- a/modules/ve-mw/tests/dm/ve.dm.mwExample.js
+++ b/modules/ve-mw/tests/dm/ve.dm.mwExample.js
@@ -763,62 +763,66 @@
 ve.dm.mwExample.complexInternalData.internalListNextUniqueNumber = 1;
 
 ve.dm.mwExample.domToDataCases = {
-       'adjacent annotations': {
-               body:
-                       '<b>a</b><b data-parsoid="1">b</b><b>c</b><b 
data-parsoid="2">d</b> ' +
-                       '<b>a</b><b>b</b> ' +
-                       '<b data-parsoid="3">ab</b><b data-parsoid="4">c</b>',
+       'adjacent annotations (data-parsoid)': {
+               preserveAnnotationDomElements: true,
+               body: '<b>a</b><b data-parsoid="1">b</b><b 
data-parsoid="2">c</b> ' +
+                       '<b>d</b><b>d</b>',
                data: [
                        { type: 'paragraph', internal: { generated: 'wrapper' } 
},
-                       [ 'a', [ ve.dm.example.bold ] ],
-                       [
-                               'b',
-                               [ {
-                                       type: 'textStyle/bold',
-                                       attributes: { nodeName: 'b' }
-                               } ]
-                       ],
-                       [ 'c', [ ve.dm.example.bold ] ],
-                       [
-                               'd',
-                               [ {
-                                       type: 'textStyle/bold',
-                                       attributes: { nodeName: 'b' }
-                               } ]
-                       ],
-                       ' ',
-                       [ 'a', [ ve.dm.example.bold ] ],
-                       [ 'b', [ ve.dm.example.bold ] ],
-                       ' ',
                        [
                                'a',
                                [ {
                                        type: 'textStyle/bold',
-                                       attributes: { nodeName: 'b' }
+                                       attributes: { nodeName: 'b' },
+                                       originalDomElements: $( '<b>a</b>' 
).toArray()
                                } ]
                        ],
                        [
                                'b',
                                [ {
                                        type: 'textStyle/bold',
-                                       attributes: { nodeName: 'b' }
+                                       attributes: { nodeName: 'b' },
+                                       originalDomElements: $( '<b 
data-parsoid="1">b</b>' ).toArray()
                                } ]
                        ],
                        [
                                'c',
                                [ {
                                        type: 'textStyle/bold',
-                                       attributes: { nodeName: 'b' }
+                                       attributes: { nodeName: 'b' },
+                                       originalDomElements: $( '<b 
data-parsoid="2">c</b>' ).toArray()
+                               } ]
+                       ],
+                       ' ',
+                       [
+                               'd',
+                               [ {
+                                       type: 'textStyle/bold',
+                                       attributes: { nodeName: 'b' },
+                                       originalDomElements: $( '<b>a</b>' 
).toArray()
+                               } ]
+                       ],
+                       [
+                               'd',
+                               [ {
+                                       type: 'textStyle/bold',
+                                       attributes: { nodeName: 'b' },
+                                       originalDomElements: $( '<b>a</b>' 
).toArray()
                                } ]
                        ],
                        { type: '/paragraph' },
                        { type: 'internalList' },
                        { type: '/internalList' }
                ],
-               normalizedBody: '<b>a</b><b data-parsoid="1">b</b><b>c</b><b 
data-parsoid="2">d</b> ' +
-                       '<b>ab</b> ' +
-                       '<b data-parsoid="3">ab</b><b data-parsoid="4">c</b>',
-               fromDataBody: '<b>abcd</b> <b>ab</b> <b>abc</b>'
+               modify: function ( model ) {
+                       var data = [ 'x', [ ve.dm.example.bold ] ],
+                               linearData = 
ve.dm.example.preprocessAnnotations( [ data ], model.getStore() );
+                       model.data.data.splice( 3, 0, linearData.data[ 0 ] );
+               },
+               normalizedBody: '<b>a</b><b data-parsoid="1">bx</b><b 
data-parsoid="2">c</b> ' +
+                       '<b>dd</b>',
+               fromDataBody: '<b>a</b><b data-parsoid="1">bx</b><b 
data-parsoid="2">c</b> ' +
+                       '<b>dd</b>'
        },
        mwImage: {
                body: '<p>' + ve.dm.mwExample.MWInlineImage.html + '</p>',

-- 
To view, visit https://gerrit.wikimedia.org/r/254336
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1557f683241193aa4a97e04af0b4daf244a8b121
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to