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

Change subject: jquery.textSelection: Add setContents function
......................................................................


jquery.textSelection: Add setContents function

This function is specified in the commands handler below, but did not
have an implementation for the plain textarea case.

Better we make this work. A user wanted this api call so his JS
cleanup script could work consistently on both plain textarea and the
CodeEditor

Change-Id: Ib3afc505037a5b12269e55b4b130a38a3fac7823
---
M resources/src/jquery/jquery.textSelection.js
M tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
2 files changed, 7 insertions(+), 5 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/src/jquery/jquery.textSelection.js 
b/resources/src/jquery/jquery.textSelection.js
index 0573f66..e5444eb 100644
--- a/resources/src/jquery/jquery.textSelection.js
+++ b/resources/src/jquery/jquery.textSelection.js
@@ -63,6 +63,12 @@
                                return this.val();
                        },
                        /**
+                        * Set the contents of the textarea, replacing anything 
that was there before
+                        */
+                       setContents: function ( content ) {
+                               this.val( content );
+                       },
+                       /**
                         * Get the currently selected text in this textarea. 
Will focus the textarea
                         * in some browsers (IE/Opera)
                         */
diff --git a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js 
b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
index 2191c3b..56b0fa9 100644
--- a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
@@ -43,11 +43,7 @@
 
                        $( '#qunit-fixture' ).append( $textarea );
 
-                       // This method is actually missing atm...
-                       //$textarea.textSelection( 'setContents', 
opt.before.text);
-
-                       // Won't work with the WikiEditor iframe?
-                       $textarea.val( opt.before.text );
+                       $textarea.textSelection( 'setContents', opt.before.text 
);
 
                        start = opt.before.start;
                        end = opt.before.end;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3afc505037a5b12269e55b4b130a38a3fac7823
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
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