jenkins-bot has submitted this change and it was merged.

Change subject: [parserTests] Ensure manual selser changes have a clean DOM
......................................................................


[parserTests] Ensure manual selser changes have a clean DOM

The test item for manual selser changes needs to be cloned from
the original item when --selser=noauto is activated from the
command line so that its DOM is not clobbered by a previous test.

Also, avoid directly changing the changes list in
applyManualChanges as that can affect following tests. To test,
pass both --wt2wt and --selser on the command line.

Change-Id: Ib8de2c8bb3b427fb31d3c1c95ddd67af3042bf83
---
M tests/parserTests.js
1 file changed, 15 insertions(+), 7 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/parserTests.js b/tests/parserTests.js
index 1a6f8cc..3888cc8 100755
--- a/tests/parserTests.js
+++ b/tests/parserTests.js
@@ -844,7 +844,7 @@
                        return;
                }
                if (change[1] === 'contents') {
-                       change.shift();
+                       change = change.slice(1);
                        els = Array.prototype.reduce.call(els, function(acc, 
el) {
                                acc.push.apply(acc, el.childNodes);
                                return acc;
@@ -1820,13 +1820,21 @@
                                }.bind( this, i, j ) );
                        }
                } else {
-                       // When manual changes were requested, exclude tests 
that don't have
-                       // any.
-                       if (modes[i] === 'selser' && options.selser === 
'noauto' &&
-                           !(item.options.parsoid && 
item.options.parsoid.changes)) {
-                               continue;
+                       if (modes[i] === 'selser' && options.selser === 
'noauto') {
+                               // Manual changes were requested on the command 
line,
+                               // check that the item does have them.
+                               if (item.options.parsoid && 
item.options.parsoid.changes) {
+                                       // If it does, we need to clone the 
item so that previous
+                                       // results don't clobber this one.
+                                       tasks.push(this.processTest.bind(this, 
Util.clone(item), options, modes[i]));
+                               } else {
+                                       // If it doesn't have manual changes, 
just skip it.
+                                       continue;
+                               }
+                       } else {
+                               // A non-selser task, we can reuse the item.
+                               tasks.push( this.processTest.bind( this, item, 
options, modes[i] ) );
                        }
-                       tasks.push( this.processTest.bind( this, item, options, 
modes[i] ) );
                }
        }
        return tasks;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8de2c8bb3b427fb31d3c1c95ddd67af3042bf83
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Marcoil <marc...@wikimedia.org>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: Marcoil <marc...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to