GWicke has submitted this change and it was merged.

Change subject: ParserTests: Reset editMode before each html2wt conversion.
......................................................................


ParserTests: Reset editMode before each html2wt conversion.

* In 324865ba, I added an editMode option but didn't properly
  clone the environment before modifying it.  This in turn
  affected the results of wt2wt tests when running alongwith
  selser.

* For now, I turned off the incorrect cloning and am resetting
  the flag before each test.  This seems like a temporary fix.

* wt2wt results are now identical with/without selser on.

Change-Id: Idb4b530d227b385233b9131f3ac68aab06f72ab2
---
M js/lib/mediawiki.SelectiveSerializer.js
M js/tests/parserTests.js
2 files changed, 4 insertions(+), 7 deletions(-)

Approvals:
  Cscott: Looks good to me, but someone else must approve
  GWicke: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/js/lib/mediawiki.SelectiveSerializer.js 
b/js/lib/mediawiki.SelectiveSerializer.js
index 8ddd7d1..1b3a80c 100644
--- a/js/lib/mediawiki.SelectiveSerializer.js
+++ b/js/lib/mediawiki.SelectiveSerializer.js
@@ -387,7 +387,6 @@
 var SelectiveSerializer = function ( options ) {
        // Set edit mode
        this.env = options.env || { conf : { parsoid : {} } };
-       this.env.conf.parsoid = Util.clone(this.env.conf.parsoid);
        this.env.conf.parsoid.editMode = true;
 
        this.wts = options.wts || new WikitextSerializer( options );
diff --git a/js/tests/parserTests.js b/js/tests/parserTests.js
index 6498415..d88d96a 100644
--- a/js/tests/parserTests.js
+++ b/js/tests/parserTests.js
@@ -404,6 +404,10 @@
  * @param {string/null} processWikitextCB.res
  */
 ParserTests.prototype.convertHtml2Wt = function( options, mode, item, doc, 
processWikitextCB ) {
+       // SSS FIXME: SelSer clobbers this flag -- need a better fix for this.
+       // Maybe pass this as an option, or clone the entire environment.
+       this.env.conf.parsoid.editMode = false;
+
        // In some cases (which?) the full document is passed in, but we are
        // interested in the body. So check if we got a document.
        var content = doc.nodeType === doc.DOCUMENT_NODE ? doc.body : doc,
@@ -1302,12 +1306,6 @@
                if ( options.html2html || options.wt2wt || options.wt2html || 
options.selser ) {
                        var parserPipelineFactory = new ParserPipelineFactory( 
this.env );
                        this.parserPipeline = 
parserPipelineFactory.makePipeline( 'text/x-mediawiki/full' );
-               }
-               if ( options.wt2wt || options.html2wt || options.html2html || 
options.selser ) {
-                       this.serializer = new WikitextSerializer({env: 
this.env});
-               }
-               if ( options.selser ) {
-                       this.selectiveSerializer = new SelectiveSerializer( { 
env: this.env, wts: this.serializer } );
                }
 
                if ( options.changesin ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idb4b530d227b385233b9131f3ac68aab06f72ab2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to