( 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 ) { /*jshint onevar: false */ var tests = 1; if ( opt.after.selected !== null ) { tests++; } QUnit.expect( tests ); var $textarea = $( '