jenkins-bot has submitted this change and it was merged. Change subject: Add before/after/html change methods to the manual-selser parsertest mode. ......................................................................
Add before/after/html change methods to the manual-selser parsertest mode. These match the corresponding jQuery methods: http://api.jquery.com/after/ http://api.jquery.com/before/ http://api.jquery.com/html/ Change-Id: I53758f0a7563c94c3dbb14ee03ad3903e0977466 --- M tests/parserTests.js M tests/parserTests.txt 2 files changed, 30 insertions(+), 0 deletions(-) Approvals: Subramanya Sastry: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/parserTests.js b/tests/parserTests.js index 99b1301..ec05097 100755 --- a/tests/parserTests.js +++ b/tests/parserTests.js @@ -785,8 +785,18 @@ // on the results of the selector in the first argument, which is // a good way to get at the text and comment nodes var jquery = { + after: function(html) { + var div = this.ownerDocument.createElement('div'); + div.innerHTML = html; + DU.migrateChildren(div, this.parentNode, this.nextSibling); + }, attr: function(name, val) { this.setAttribute(name, val); + }, + before: function(html) { + var div = this.ownerDocument.createElement('div'); + div.innerHTML = html; + DU.migrateChildren(div, this.parentNode, this); }, removeAttr: function(name) { this.removeAttribute(name); @@ -800,6 +810,9 @@ text: function(t) { this.textContent = t; }, + html: function(h) { + this.innerHTML = h; + }, remove: function(optSelector) { // jquery lets us specify an optional selector to further // restrict the removed elements. diff --git a/tests/parserTests.txt b/tests/parserTests.txt index e0084fb..30a16d8 100644 --- a/tests/parserTests.txt +++ b/tests/parserTests.txt @@ -23775,6 +23775,23 @@ </table> !! end +!! test +WTS change modes +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + [ "#xyz", "before", "<b>before</b> stuff " ], + [ "#xyz", "after", " stuff <i>after</i>" ], + [ "#xyz", "html", "x <b>y</b> z" ] + ] +} +!! wikitext +<span id="xyz">hello</span> +!! wikitext/edited +'''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after'' +!! end + # ----------------------------------------------------------------- # End of section for Parsoid-only html2wt tests for serialization # of new content -- To view, visit https://gerrit.wikimedia.org/r/197422 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I53758f0a7563c94c3dbb14ee03ad3903e0977466 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Cscott <[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
