From 14f74d141ab5580688bfd46d2f74c026e43ed967 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 1 Apr 2015 06:11:44 +0200 Subject: Update to MediaWiki 1.24.2 --- .../resources/jquery/jquery.textSelection.test.js | 273 +++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 tests/qunit/suites/resources/jquery/jquery.textSelection.test.js (limited to 'tests/qunit/suites/resources/jquery/jquery.textSelection.test.js') diff --git a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js new file mode 100644 index 00000000..56b0fa92 --- /dev/null +++ b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js @@ -0,0 +1,273 @@ +( function ( $ ) { + + QUnit.module( 'jquery.textSelection', QUnit.newMwEnvironment() ); + + /** + * Test factory for $.fn.textSelection( 'encapsulateText' ) + * + * @param options {object} associative array containing: + * description {string} + * input {string} + * output {string} + * start {int} starting char for selection + * end {int} ending char for selection + * params {object} add'l parameters for $().textSelection( 'encapsulateText' ) + */ + function encapsulateTest( options ) { + var opt = $.extend( { + description: '', + before: {}, + after: {}, + replace: {} + }, options ); + + opt.before = $.extend( { + text: '', + start: 0, + end: 0 + }, opt.before ); + opt.after = $.extend( { + text: '', + selected: null + }, opt.after ); + + QUnit.test( opt.description, function ( assert ) { + var $textarea, start, end, options, text, selected, + tests = 1; + if ( opt.after.selected !== null ) { + tests++; + } + QUnit.expect( tests ); + + $textarea = $( '