summaryrefslogtreecommitdiff
path: root/tests/qunit/suites/resources/jquery
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qunit/suites/resources/jquery')
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.byteLength.test.js24
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js120
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.client.test.js283
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.localize.test.js10
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js287
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js166
-rw-r--r--tests/qunit/suites/resources/jquery/jquery.textSelection.test.js7
7 files changed, 740 insertions, 157 deletions
diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js
index e4e579b0..e6aa3aa8 100644
--- a/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js
@@ -16,20 +16,22 @@
} );
- QUnit.test( 'Special text', 5, function ( assert ) {
- // http://en.wikipedia.org/wiki/UTF-8
+ QUnit.test( 'Special text', 4, function ( assert ) {
+ // https://en.wikipedia.org/wiki/UTF-8
var u0024 = '$',
+ // Cent symbol
u00A2 = '\u00A2',
+ // Euro symbol
u20AC = '\u20AC',
- u024B62 = '\u024B62',
- // The normal one doesn't display properly, try the below which is the same
- // according to http://www.fileformat.info/info/unicode/char/24B62/index.htm
- u024B62alt = '\uD852\uDF62';
+ // Character \U00024B62 (Han script) can't be represented in javascript as a single
+ // code point, instead it is composed as a surrogate pair of two separate code units.
+ // http://codepoints.net/U+24B62
+ // http://www.fileformat.info/info/unicode/char/24B62/index.htm
+ u024B62 = '\uD852\uDF62';
- assert.strictEqual( $.byteLength( u0024 ), 1, 'U+0024: 1 byte. $ (dollar sign)' );
- assert.strictEqual( $.byteLength( u00A2 ), 2, 'U+00A2: 2 bytes. \u00A2 (cent sign)' );
- assert.strictEqual( $.byteLength( u20AC ), 3, 'U+20AC: 3 bytes. \u20AC (euro sign)' );
- assert.strictEqual( $.byteLength( u024B62 ), 4, 'U+024B62: 4 bytes. \uD852\uDF62 (a Han character)' );
- assert.strictEqual( $.byteLength( u024B62alt ), 4, 'U+024B62: 4 bytes. \uD852\uDF62 (a Han character) - alternative method' );
+ assert.strictEqual( $.byteLength( u0024 ), 1, 'U+0024' );
+ assert.strictEqual( $.byteLength( u00A2 ), 2, 'U+00A2' );
+ assert.strictEqual( $.byteLength( u20AC ), 3, 'U+20AC' );
+ assert.strictEqual( $.byteLength( u024B62 ), 4, 'U+024B62 (surrogate pair: \\uD852\\uDF62)' );
} );
}( jQuery ) );
diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js
index c21844eb..22d2af19 100644
--- a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js
@@ -31,55 +31,34 @@
/**
* Test factory for $.fn.byteLimit
*
- * @param $input {jQuery} jQuery object in an input element
- * @param hasLimit {Boolean} Wether a limit should apply at all
- * @param limit {Number} Limit (if used) otherwise undefined
- * The limit should be less than 20 (the sample data's length)
+ * @param {Object} options
+ * @param {string} options.description Test name
+ * @param {jQuery} options.$input jQuery object in an input element
+ * @param {string} options.sample Sequence of characters to simulate being
+ * added one by one
+ * @param {string} options.expected Expected final value of `$input`
*/
function byteLimitTest( options ) {
var opt = $.extend( {
description: '',
$input: null,
sample: '',
- hasLimit: false,
- expected: '',
- limit: null
+ expected: ''
}, options );
- QUnit.asyncTest( opt.description, opt.hasLimit ? 3 : 2, function ( assert ) {
+ QUnit.asyncTest( opt.description, 1, function ( assert ) {
setTimeout( function () {
- var rawVal, fn, effectiveVal;
-
opt.$input.appendTo( '#qunit-fixture' );
// Simulate pressing keys for each of the sample characters
addChars( opt.$input, opt.sample );
- rawVal = opt.$input.val();
- fn = opt.$input.data( 'byteLimit.callback' );
- effectiveVal = fn ? fn( rawVal ) : rawVal;
-
- if ( opt.hasLimit ) {
- assert.ltOrEq(
- $.byteLength( effectiveVal ),
- opt.limit,
- 'Prevent keypresses after byteLimit was reached, length never exceeded the limit'
- );
- assert.equal(
- $.byteLength( rawVal ),
- $.byteLength( opt.expected ),
- 'Not preventing keypresses too early, length has reached the expected length'
- );
- assert.equal( rawVal, opt.expected, 'New value matches the expected string' );
-
- } else {
- assert.equal(
- $.byteLength( effectiveVal ),
- $.byteLength( opt.expected ),
- 'Unlimited scenarios are not affected, expected length reached'
- );
- assert.equal( rawVal, opt.expected, 'New value matches the expected string' );
- }
+ assert.equal(
+ opt.$input.val(),
+ opt.expected,
+ 'New value matches the expected string'
+ );
+
QUnit.start();
}, 10 );
} );
@@ -89,7 +68,6 @@
description: 'Plain text input',
$input: $( '<input type="text"/>' ),
sample: simpleSample,
- hasLimit: false,
expected: simpleSample
} );
@@ -98,7 +76,6 @@
$input: $( '<input type="text"/>' )
.byteLimit(),
sample: simpleSample,
- hasLimit: false,
expected: simpleSample
} );
@@ -108,8 +85,6 @@
.attr( 'maxlength', '10' )
.byteLimit(),
sample: simpleSample,
- hasLimit: true,
- limit: 10,
expected: '1234567890'
} );
@@ -118,8 +93,6 @@
$input: $( '<input type="text"/>' )
.byteLimit( 10 ),
sample: simpleSample,
- hasLimit: true,
- limit: 10,
expected: '1234567890'
} );
@@ -129,8 +102,6 @@
.attr( 'maxlength', '10' )
.byteLimit( 15 ),
sample: simpleSample,
- hasLimit: true,
- limit: 15,
expected: '123456789012345'
} );
@@ -139,8 +110,6 @@
$input: $( '<input type="text"/>' )
.byteLimit( 14 ),
sample: mbSample,
- hasLimit: true,
- limit: 14,
expected: '1234567890' + U_20AC + '1'
} );
@@ -149,8 +118,6 @@
$input: $( '<input type="text"/>' )
.byteLimit( 12 ),
sample: mbSample,
- hasLimit: true,
- limit: 12,
expected: '1234567890' + '12'
} );
@@ -158,17 +125,11 @@
description: 'Pass the limit and a callback as input filter',
$input: $( '<input type="text"/>' )
.byteLimit( 6, function ( val ) {
- // Invalid title
- if ( val === '' ) {
- return '';
- }
-
+ var title = mw.Title.newFromText( String( val ) );
// Return without namespace prefix
- return new mw.Title( String( val ) ).getMain();
+ return title ? title.getMain() : '';
} ),
sample: 'User:Sample',
- hasLimit: true,
- limit: 6, // 'Sample' length
expected: 'User:Sample'
} );
@@ -177,20 +138,53 @@
$input: $( '<input type="text"/>' )
.attr( 'maxlength', '6' )
.byteLimit( function ( val ) {
- // Invalid title
- if ( val === '' ) {
- return '';
- }
-
+ var title = mw.Title.newFromText( String( val ) );
// Return without namespace prefix
- return new mw.Title( String( val ) ).getMain();
+ return title ? title.getMain() : '';
} ),
sample: 'User:Sample',
- hasLimit: true,
- limit: 6, // 'Sample' length
expected: 'User:Sample'
} );
+ byteLimitTest( {
+ description: 'Pass the limit and a callback as input filter',
+ $input: $( '<input type="text"/>' )
+ .byteLimit( 6, function ( val ) {
+ var title = mw.Title.newFromText( String( val ) );
+ // Return without namespace prefix
+ return title ? title.getMain() : '';
+ } ),
+ sample: 'User:Example',
+ // The callback alters the value to be used to calculeate
+ // the length. The altered value is "Exampl" which has
+ // a length of 6, the "e" would exceed the limit.
+ expected: 'User:Exampl'
+ } );
+
+ byteLimitTest( {
+ description: 'Input filter that increases the length',
+ $input: $( '<input type="text"/>' )
+ .byteLimit( 10, function ( text ) {
+ return 'prefix' + text;
+ } ),
+ sample: simpleSample,
+ // Prefix adds 6 characters, limit is reached after 4
+ expected: '1234'
+ } );
+
+ // Regression tests for bug 41450
+ byteLimitTest( {
+ description: 'Input filter of which the base exceeds the limit',
+ $input: $( '<input type="text"/>' )
+ .byteLimit( 3, function ( text ) {
+ return 'prefix' + text;
+ } ),
+ sample: simpleSample,
+ hasLimit: true,
+ limit: 6, // 'prefix' length
+ expected: ''
+ } );
+
QUnit.test( 'Confirm properties and attributes set', 4, function ( assert ) {
var $el, $elA, $elB;
diff --git a/tests/qunit/suites/resources/jquery/jquery.client.test.js b/tests/qunit/suites/resources/jquery/jquery.client.test.js
index 88bbf5c4..4c7c3022 100644
--- a/tests/qunit/suites/resources/jquery/jquery.client.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.client.test.js
@@ -1,16 +1,11 @@
( function ( $ ) {
- var uacount, uas, testMap;
QUnit.module( 'jquery.client', QUnit.newMwEnvironment() );
- /** Number of user-agent defined */
- uacount = 0;
-
- uas = ( function () {
-
+ var uacount = 0,
// Object keyed by userAgent. Value is an array (human-readable name, client-profile object, navigator.platform value)
// Info based on results from http://toolserver.org/~krinkle/testswarm/job/174/
- var uas = {
+ uas = {
// Internet Explorer 6
// Internet Explorer 7
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)': {
@@ -39,7 +34,7 @@
profile: {
name: 'msie',
layout: 'trident',
- layoutVersion: 'unknown', // should be able to report 6?
+ layoutVersion: 6,
platform: 'win',
version: '10.0',
versionBase: '10',
@@ -50,6 +45,60 @@
rtl: true
}
},
+ // Internet Explorer 11
+ 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko': {
+ title: 'Internet Explorer 11',
+ platform: 'Win32',
+ profile: {
+ name: 'msie',
+ layout: 'trident',
+ layoutVersion: 7,
+ platform: 'win',
+ version: '11.0',
+ versionBase: '11',
+ versionNumber: 11
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
+ // Internet Explorer 11 - Windows 8.1 x64 Modern UI
+ 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; rv:11.0) like Gecko': {
+ title: 'Internet Explorer 11',
+ platform: 'Win64',
+ profile: {
+ name: 'msie',
+ layout: 'trident',
+ layoutVersion: 7,
+ platform: 'win',
+ version: '11.0',
+ versionBase: '11',
+ versionNumber: 11
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
+ // Internet Explorer 11 - Windows 8.1 x64 desktop UI
+ 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko': {
+ title: 'Internet Explorer 11',
+ platform: 'WOW64',
+ profile: {
+ name: 'msie',
+ layout: 'trident',
+ layoutVersion: 7,
+ platform: 'win',
+ version: '11.0',
+ versionBase: '11',
+ versionNumber: 11
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
// Firefox 2
// Firefox 3.5
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.19) Gecko/20110420 Firefox/3.5.19': {
@@ -141,6 +190,24 @@
rtl: true
}
},
+ // Iceweasel 15.0.1
+ 'Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 Iceweasel/15.0.1': {
+ title: 'Iceweasel 15.0.1',
+ platform: 'Linux',
+ profile: {
+ name: 'iceweasel',
+ layout: 'gecko',
+ layoutVersion: 20100101,
+ platform: 'linux',
+ version: '15.0.1',
+ versionBase: '15',
+ versionNumber: 15
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
// Firefox 5
// Safari 3
// Safari 4
@@ -179,6 +246,42 @@
}
},
// Safari 5
+ // Safari 6
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.29.13 (KHTML, like Gecko) Version/6.0.4 Safari/536.29.13': {
+ title: 'Safari 6',
+ platform: 'MacIntel',
+ profile: {
+ name: 'safari',
+ layout: 'webkit',
+ layoutVersion: 536,
+ platform: 'mac',
+ version: '6.0.4',
+ versionBase: '6',
+ versionNumber: 6
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
+ // Safari 6.0.5+ (doesn't have the comma in "KHTML, like Gecko")
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 1084) AppleWebKit/536.30.1 (KHTML like Gecko) Version/6.0.5 Safari/536.30.1': {
+ title: 'Safari 6',
+ platform: 'MacIntel',
+ profile: {
+ name: 'safari',
+ layout: 'webkit',
+ layoutVersion: 536,
+ platform: 'mac',
+ version: '6.0.5',
+ versionBase: '6',
+ versionNumber: 6
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
// Opera 10+
'Opera/9.80 (Windows NT 5.1)': {
title: 'Opera 10+ (exact version unspecified)',
@@ -215,6 +318,24 @@
rtl: true
}
},
+ // Opera 15 (WebKit-based)
+ 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.130': {
+ title: 'Opera 15',
+ platform: 'Win32',
+ profile: {
+ name: 'opera',
+ layout: 'webkit',
+ layoutVersion: 537,
+ platform: 'win',
+ version: '15.0.1147.130',
+ versionBase: '15',
+ versionNumber: 15
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
// Chrome 5
// Chrome 6
// Chrome 7
@@ -257,6 +378,24 @@
rtl: true
}
},
+ // Android WebKit Browser 2.3
+ 'Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1': {
+ title: 'Android WebKit Browser 2.3',
+ platform: 'Linux armv7l',
+ profile: {
+ name: 'android',
+ layout: 'webkit',
+ layoutVersion: 533,
+ platform: 'linux',
+ version: '2.3.5',
+ versionBase: '2',
+ versionNumber: 2.3
+ },
+ wikiEditor: {
+ ltr: true,
+ rtl: true
+ }
+ },
// Bug #34924
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.34 (KHTML, like Gecko) rekonq Safari/534.34': {
title: 'Rekonq',
@@ -275,28 +414,42 @@
rtl: true
}
}
- };
- $.each( uas, function () {
- uacount++;
- } );
- return uas;
- }() );
-
- QUnit.test( 'profile userAgent support', uacount, function ( assert ) {
- // Generate a client profile object and compare recursively
- var uaTest = function ( rawUserAgent, data ) {
- var ret = $.client.profile( {
- userAgent: rawUserAgent,
- platform: data.platform
- } );
- assert.deepEqual( ret, data.profile, 'Client profile support check for ' + data.title + ' (' + data.platform + '): ' + rawUserAgent );
- };
+ },
+ testMap = {
+ // Example from WikiEditor
+ // Make sure to use raw numbers, a string like "7.0" would fail on a
+ // version 10 browser since in string comparaison "10" is before "7.0" :)
+ 'ltr': {
+ 'msie': [['>=', 7.0]],
+ 'firefox': [['>=', 2]],
+ 'opera': [['>=', 9.6]],
+ 'safari': [['>=', 3]],
+ 'chrome': [['>=', 3]],
+ 'netscape': [['>=', 9]],
+ 'blackberry': false,
+ 'ipod': false,
+ 'iphone': false
+ },
+ 'rtl': {
+ 'msie': [['>=', 8]],
+ 'firefox': [['>=', 2]],
+ 'opera': [['>=', 9.6]],
+ 'safari': [['>=', 3]],
+ 'chrome': [['>=', 3]],
+ 'netscape': [['>=', 9]],
+ 'blackberry': false,
+ 'ipod': false,
+ 'iphone': false
+ }
+ }
+ ;
- // Loop through and run tests
- $.each( uas, uaTest );
+ // Count test cases
+ $.each( uas, function () {
+ uacount++;
} );
- QUnit.test( 'profile return validation for current user agent', 7, function ( assert ) {
+ QUnit.test( 'profile( navObject )', 7, function ( assert ) {
var p = $.client.profile();
function unknownOrType( val, type, summary ) {
@@ -312,44 +465,58 @@
assert.equal( typeof p.versionNumber, 'number', 'p.versionNumber is a number' );
} );
- // Example from WikiEditor
- // Make sure to use raw numbers, a string like "7.0" would fail on a
- // version 10 browser since in string comparaison "10" is before "7.0" :)
- testMap = {
- 'ltr': {
- 'msie': [['>=', 7.0]],
- 'firefox': [['>=', 2]],
- 'opera': [['>=', 9.6]],
- 'safari': [['>=', 3]],
- 'chrome': [['>=', 3]],
- 'netscape': [['>=', 9]],
- 'blackberry': false,
- 'ipod': false,
- 'iphone': false
- },
- 'rtl': {
- 'msie': [['>=', 8]],
- 'firefox': [['>=', 2]],
- 'opera': [['>=', 9.6]],
- 'safari': [['>=', 3]],
- 'chrome': [['>=', 3]],
- 'netscape': [['>=', 9]],
- 'blackberry': false,
- 'ipod': false,
- 'iphone': false
- }
- };
+ QUnit.test( 'profile( navObject ) - samples', uacount, function ( assert ) {
+ // Loop through and run tests
+ $.each( uas, function ( rawUserAgent, data ) {
+ // Generate a client profile object and compare recursively
+ var ret = $.client.profile( {
+ userAgent: rawUserAgent,
+ platform: data.platform
+ } );
+ assert.deepEqual( ret, data.profile, 'Client profile support check for ' + data.title + ' (' + data.platform + '): ' + rawUserAgent );
+ } );
+ } );
- QUnit.test( 'test', 1, function ( assert ) {
+ QUnit.test( 'test( testMap )', 4, function ( assert ) {
// .test() uses eval, make sure no exceptions are thrown
// then do a basic return value type check
- var testMatch = $.client.test( testMap );
+ var testMatch = $.client.test( testMap ),
+ ie7Profile = $.client.profile( {
+ 'userAgent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
+ 'platform': ''
+ } );
+
+ assert.equal( typeof testMatch, 'boolean', 'map with ltr/rtl split returns a boolean value' );
+
+ testMatch = $.client.test( testMap.ltr );
+
+ assert.equal( typeof testMatch, 'boolean', 'simple map (without ltr/rtl split) returns a boolean value' );
+
+ assert.equal( $.client.test( {
+ 'msie': null
+ }, ie7Profile ), true, 'returns true if any version of a browser are allowed (null)' );
+
+ assert.equal( $.client.test( {
+ 'msie': false
+ }, ie7Profile ), false, 'returns false if all versions of a browser are not allowed (false)' );
+ } );
+
+ QUnit.test( 'test( testMap, exactMatchOnly )', 2, function ( assert ) {
+ var ie7Profile = $.client.profile( {
+ 'userAgent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
+ 'platform': ''
+ } );
- assert.equal( typeof testMatch, 'boolean', 'test returns a boolean value' );
+ assert.equal( $.client.test( {
+ 'firefox': [['>=', 2]]
+ }, ie7Profile, false ), true, 'returns true if browser not found and exactMatchOnly not set' );
+ assert.equal( $.client.test( {
+ 'firefox': [['>=', 2]]
+ }, ie7Profile, true ), false, 'returns false if browser not found and exactMatchOnly is set' );
} );
- QUnit.test( 'User-agent matches against WikiEditor\'s compatibility map', uacount * 2, function ( assert ) {
+ QUnit.test( 'test( testMap) - WikiEditor sample', uacount * 2, function ( assert ) {
var $body = $( 'body' ),
bodyClasses = $body.attr( 'class' );
diff --git a/tests/qunit/suites/resources/jquery/jquery.localize.test.js b/tests/qunit/suites/resources/jquery/jquery.localize.test.js
index d3877e05..3ef27903 100644
--- a/tests/qunit/suites/resources/jquery/jquery.localize.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.localize.test.js
@@ -38,7 +38,7 @@
// making sure it is actually using text() and attr() (or something with the same effect)
// Text escaping
- html = '<div><span><html:msg key="properfoo"></span></div>';
+ html = '<div><span><html:msg key="properfoo" /></span></div>';
$lc = $( html ).localize().find( 'span' );
assert.strictEqual( $lc.text(), mw.msg( 'properfoo' ), 'Content is inserted as text, not as html.' );
@@ -63,7 +63,7 @@
var html, $lc, x, sitename = 'Wikipedia';
// Message key prefix
- html = '<div><span title-msg="lorem"><html:msg key="ipsum"></span></div>';
+ html = '<div><span title-msg="lorem"><html:msg key="ipsum" /></span></div>';
$lc = $( html ).localize( {
prefix: 'foo-'
} ).find( 'span' );
@@ -73,7 +73,7 @@
// Variable keys mapping
x = 'bar';
- html = '<div><span title-msg="title"><html:msg key="label"></span></div>';
+ html = '<div><span title-msg="title"><html:msg key="label" /></span></div>';
$lc = $( html ).localize( {
keys: {
'title': 'foo-' + x + '-title',
@@ -85,7 +85,7 @@
assert.strictEqual( $lc.text(), 'The Bars', 'Variable keys mapping - text' );
// Passing parameteters to mw.msg
- html = '<div><span><html:msg key="foo-welcome"></span></div>';
+ html = '<div><span><html:msg key="foo-welcome" /></span></div>';
$lc = $( html ).localize( {
params: {
'foo-welcome': [sitename, 'yesterday']
@@ -96,7 +96,7 @@
// Combination of options prefix, params and keys
x = 'bazz';
- html = '<div><span title-msg="title"><html:msg key="label"></span></div>';
+ html = '<div><span title-msg="title"><html:msg key="label" /></span></div>';
$lc = $( html ).localize( {
prefix: 'foo-',
keys: {
diff --git a/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js b/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
new file mode 100644
index 00000000..6da56ed2
--- /dev/null
+++ b/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
@@ -0,0 +1,287 @@
+( function ( mw, $ ) {
+ var loremIpsum = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.';
+
+ QUnit.module( 'jquery.makeCollapsible', QUnit.newMwEnvironment() );
+
+ function prepareCollapsible( html, options ) {
+ return $( $.parseHTML( html ) )
+ .appendTo( '#qunit-fixture' )
+ // options might be undefined here - this is okay
+ .makeCollapsible( options );
+ }
+
+ // This test is first because if it fails, then almost all of the latter tests are meaningless.
+ QUnit.asyncTest( 'testing hooks/triggers', 4, function ( assert ) {
+ var $collapsible, $content, $toggle;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' + loremIpsum + '</div>'
+ );
+ $content = $collapsible.find( '.mw-collapsible-content' );
+ $toggle = $collapsible.find( '.mw-collapsible-toggle' );
+
+ // In one full collapse-expand cycle, each event will be fired once
+
+ // On collapse...
+ $collapsible.on( 'beforeCollapse.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':visible' ), 'first beforeCollapseExpand: content is visible' );
+ } );
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':hidden' ), 'first afterCollapseExpand: content is hidden' );
+
+ // On expand...
+ $collapsible.on( 'beforeExpand.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':hidden' ), 'second beforeCollapseExpand: content is hidden' );
+ } );
+ $collapsible.on( 'afterExpand.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':visible' ), 'second afterCollapseExpand: content is visible' );
+
+ QUnit.start();
+ } );
+
+ // ...expanding happens here
+ $toggle.trigger( 'click' );
+ } );
+
+ // ...collapsing happens here
+ $toggle.trigger( 'click' );
+ } );
+
+ QUnit.asyncTest( 'basic operation (<div>)', 5, function ( assert ) {
+ var $collapsible, $content, $toggle;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' + loremIpsum + '</div>'
+ );
+ $content = $collapsible.find( '.mw-collapsible-content' );
+ $toggle = $collapsible.find( '.mw-collapsible-toggle' );
+
+ assert.equal( $content.length, 1, 'content is present' );
+ assert.equal( $content.find( $toggle ).length, 0, 'toggle is not a descendant of content' );
+
+ assert.assertTrue( $content.is( ':visible' ), 'content is visible' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':hidden' ), 'after collapsing: content is hidden' );
+
+ $collapsible.on( 'afterExpand.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':visible' ), 'after expanding: content is visible' );
+ QUnit.start();
+ } );
+
+ $toggle.trigger( 'click' );
+ } );
+
+ $toggle.trigger( 'click' );
+ } );
+
+ QUnit.asyncTest( 'basic operation (<table>)', 7, function ( assert ) {
+ var $collapsible, $headerRow, $contentRow, $toggle;
+ $collapsible = prepareCollapsible(
+ '<table class="mw-collapsible">' +
+ '<tr><td>' + loremIpsum + '</td><td>' + loremIpsum + '</td></tr>' +
+ '<tr><td>' + loremIpsum + '</td><td>' + loremIpsum + '</td></tr>' +
+ '<tr><td>' + loremIpsum + '</td><td>' + loremIpsum + '</td></tr>' +
+ '</table>'
+ );
+ $headerRow = $collapsible.find( 'tr:first' );
+ $contentRow = $collapsible.find( 'tr:last' );
+
+ $toggle = $headerRow.find( 'td:last .mw-collapsible-toggle' );
+ assert.equal( $toggle.length, 1, 'toggle is added to last cell of first row' );
+
+ assert.assertTrue( $headerRow.is( ':visible' ), 'headerRow is visible' );
+ assert.assertTrue( $contentRow.is( ':visible' ), 'contentRow is visible' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.assertTrue( $headerRow.is( ':visible' ), 'after collapsing: headerRow is still visible' );
+ assert.assertTrue( $contentRow.is( ':hidden' ), 'after collapsing: contentRow is hidden' );
+
+ $collapsible.on( 'afterExpand.mw-collapsible', function () {
+ assert.assertTrue( $headerRow.is( ':visible' ), 'after expanding: headerRow is still visible' );
+ assert.assertTrue( $contentRow.is( ':visible' ), 'after expanding: contentRow is visible' );
+ QUnit.start();
+ } );
+
+ $toggle.trigger( 'click' );
+ } );
+
+ $toggle.trigger( 'click' );
+ } );
+
+ function listTest( listType, assert ) {
+ var $collapsible, $toggleItem, $contentItem, $toggle;
+ $collapsible = prepareCollapsible(
+ '<' + listType + ' class="mw-collapsible">' +
+ '<li>' + loremIpsum + '</li>' +
+ '<li>' + loremIpsum + '</li>' +
+ '</' + listType + '>'
+ );
+ $toggleItem = $collapsible.find( 'li.mw-collapsible-toggle-li:first-child' );
+ $contentItem = $collapsible.find( 'li:last' );
+
+ $toggle = $toggleItem.find( '.mw-collapsible-toggle' );
+ assert.equal( $toggle.length, 1, 'toggle is present, added inside new zeroth list item' );
+
+ assert.assertTrue( $toggleItem.is( ':visible' ), 'toggleItem is visible' );
+ assert.assertTrue( $contentItem.is( ':visible' ), 'contentItem is visible' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.assertTrue( $toggleItem.is( ':visible' ), 'after collapsing: toggleItem is still visible' );
+ assert.assertTrue( $contentItem.is( ':hidden' ), 'after collapsing: contentItem is hidden' );
+
+ $collapsible.on( 'afterExpand.mw-collapsible', function () {
+ assert.assertTrue( $toggleItem.is( ':visible' ), 'after expanding: toggleItem is still visible' );
+ assert.assertTrue( $contentItem.is( ':visible' ), 'after expanding: contentItem is visible' );
+ QUnit.start();
+ } );
+
+ $toggle.trigger( 'click' );
+ } );
+
+ $toggle.trigger( 'click' );
+ }
+
+ QUnit.asyncTest( 'basic operation (<ul>)', 7, function ( assert ) {
+ listTest( 'ul', assert );
+ } );
+
+ QUnit.asyncTest( 'basic operation (<ol>)', 7, function ( assert ) {
+ listTest( 'ol', assert );
+ } );
+
+ QUnit.test( 'basic operation when synchronous (options.instantHide)', 2, function ( assert ) {
+ var $collapsible, $content;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' + loremIpsum + '</div>',
+ { instantHide: true }
+ );
+ $content = $collapsible.find( '.mw-collapsible-content' );
+
+ assert.assertTrue( $content.is( ':visible' ), 'content is visible' );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
+
+ assert.assertTrue( $content.is( ':hidden' ), 'after collapsing: content is hidden' );
+ } );
+
+ QUnit.test( 'mw-made-collapsible data added', 1, function ( assert ) {
+ var $collapsible;
+ $collapsible = prepareCollapsible(
+ '<div>' + loremIpsum + '</div>'
+ );
+ assert.equal( $collapsible.data( 'mw-made-collapsible' ), true, 'mw-made-collapsible data present' );
+ } );
+
+ QUnit.test( 'mw-collapsible added when missing', 1, function ( assert ) {
+ var $collapsible;
+ $collapsible = prepareCollapsible(
+ '<div>' + loremIpsum + '</div>'
+ );
+ assert.assertTrue( $collapsible.hasClass( 'mw-collapsible' ), 'mw-collapsible class present' );
+ } );
+
+ QUnit.test( 'mw-collapsed added when missing', 1, function ( assert ) {
+ var $collapsible;
+ $collapsible = prepareCollapsible(
+ '<div>' + loremIpsum + '</div>',
+ { collapsed: true }
+ );
+ assert.assertTrue( $collapsible.hasClass( 'mw-collapsed' ), 'mw-collapsed class present' );
+ } );
+
+ QUnit.asyncTest( 'initial collapse (mw-collapsed class)', 2, function ( assert ) {
+ var $collapsible, $content;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible mw-collapsed">' + loremIpsum + '</div>'
+ );
+ $content = $collapsible.find( '.mw-collapsible-content' );
+
+ // Synchronous - mw-collapsed should cause instantHide: true to be used on initial collapsing
+ assert.assertTrue( $content.is( ':hidden' ), 'content is hidden' );
+
+ $collapsible.on( 'afterExpand.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':visible' ), 'after expanding: content is visible' );
+ QUnit.start();
+ } );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
+ } );
+
+ QUnit.asyncTest( 'initial collapse (options.collapsed)', 2, function ( assert ) {
+ var $collapsible, $content;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' + loremIpsum + '</div>',
+ { collapsed: true }
+ );
+ $content = $collapsible.find( '.mw-collapsible-content' );
+
+ // Synchronous - collapsed: true should cause instantHide: true to be used on initial collapsing
+ assert.assertTrue( $content.is( ':hidden' ), 'content is hidden' );
+
+ $collapsible.on( 'afterExpand.mw-collapsible', function () {
+ assert.assertTrue( $content.is( ':visible' ), 'after expanding: content is visible' );
+ QUnit.start();
+ } );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
+ } );
+
+ QUnit.test( 'clicks on links inside toggler pass through (options.linksPassthru)' , 2, function ( assert ) {
+ var $collapsible, $content;
+
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' +
+ '<div class="mw-collapsible-toggle">' +
+ 'Toggle <a href="#top">toggle</a> toggle <b>toggle</b>' +
+ '</div>' +
+ '<div class="mw-collapsible-content">' + loremIpsum + '</div>' +
+ '</div>',
+ // Can't do asynchronous because we're testing that the event *doesn't* happen
+ { instantHide: true }
+ );
+ $content = $collapsible.find( '.mw-collapsible-content' );
+
+ $collapsible.find( '.mw-collapsible-toggle a' ).trigger( 'click' );
+ assert.assertTrue( $content.is( ':visible' ), 'click event on link inside toggle passes through (content not toggled)' );
+
+ $collapsible.find( '.mw-collapsible-toggle b' ).trigger( 'click' );
+ assert.assertTrue( $content.is( ':hidden' ), 'click event on non-link inside toggle toggles content' );
+ } );
+
+ QUnit.asyncTest( 'collapse/expand text (data-collapsetext, data-expandtext)', 2, function ( assert ) {
+ var $collapsible, $toggleLink;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible" data-collapsetext="Collapse me!" data-expandtext="Expand me!">' +
+ loremIpsum +
+ '</div>'
+ );
+ $toggleLink = $collapsible.find( '.mw-collapsible-toggle a' );
+
+ assert.equal( $toggleLink.text(), 'Collapse me!', 'data-collapsetext is respected' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.equal( $toggleLink.text(), 'Expand me!', 'data-expandtext is respected' );
+ QUnit.start();
+ } );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
+ } );
+
+ QUnit.asyncTest( 'collapse/expand text (options.collapseText, options.expandText)', 2, function ( assert ) {
+ var $collapsible, $toggleLink;
+ $collapsible = prepareCollapsible(
+ '<div class="mw-collapsible">' + loremIpsum + '</div>',
+ { collapseText: 'Collapse me!', expandText: 'Expand me!' }
+ );
+ $toggleLink = $collapsible.find( '.mw-collapsible-toggle a' );
+
+ assert.equal( $toggleLink.text(), 'Collapse me!', 'options.collapseText is respected' );
+
+ $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+ assert.equal( $toggleLink.text(), 'Expand me!', 'options.expandText is respected' );
+ QUnit.start();
+ } );
+
+ $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
+ } );
+
+}( mediaWiki, jQuery ) );
diff --git a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
index 307b0440..f73fd7bf 100644
--- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
@@ -5,6 +5,8 @@
wgMonthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
wgMonthNamesShort: ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
wgDefaultDateFormat: 'dmy',
+ wgSeparatorTransformTable: ['', ''],
+ wgDigitTransformTable: ['', ''],
wgContentLanguage: 'en'
};
@@ -180,6 +182,18 @@
}
);
tableTest(
+ 'Basic planet table: ascending by name (multiple clicks)',
+ header,
+ planets,
+ ascendingName,
+ function ( $table ) {
+ $table.tablesorter();
+ $table.find( '.headerSort:eq(0)' ).click();
+ $table.find( '.headerSort:eq(1)' ).click();
+ $table.find( '.headerSort:eq(0)' ).click();
+ }
+ );
+ tableTest(
'Basic planet table: descending by name',
header,
planets,
@@ -273,6 +287,35 @@
$table.data( 'tablesorter' ).sort();
}
);
+ tableTest(
+ 'Sort via click event after having initialized the tablesorter with initial sorting',
+ header,
+ initial,
+ descasc,
+ function ( $table ) {
+ $table.tablesorter(
+ { sortList: [ { 0: 'asc' }, { 1: 'asc' } ] }
+ );
+ $table.find( '.headerSort:eq(0)' ).click();
+ }
+ );
+ tableTest(
+ 'Multi-sort via click event after having initialized the tablesorter with initial sorting',
+ header,
+ initial,
+ asc,
+ function ( $table ) {
+ $table.tablesorter(
+ { sortList: [ { 0: 'desc' }, { 1: 'desc' } ] }
+ );
+ $table.find( '.headerSort:eq(0)' ).click();
+
+ // Pretend to click while pressing the multi-sort key
+ var event = $.Event( 'click' );
+ event[$table.data( 'tablesorter' ).config.sortMultiSortKey] = true;
+ $table.find( '.headerSort:eq(1)' ).trigger( event );
+ }
+ );
QUnit.test( 'Reset sorting making table appear unsorted', 3, function ( assert ) {
var $table = tableCreate( header, initial );
$table.tablesorter(
@@ -319,12 +362,26 @@
function ( $table ) {
// Make colspanned header for test
$table.find( 'tr:eq(0) th:eq(1), tr:eq(0) th:eq(2)' ).remove();
- $table.find( 'tr:eq(0) th:eq(0)' ).prop( 'colspan', '3' );
+ $table.find( 'tr:eq(0) th:eq(0)' ).attr( 'colspan', '3' );
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
}
);
+ tableTest( 'Sorting with colspanned headers: sort spanned column twice',
+ header,
+ initial,
+ [ caa4, bbc2, abc3, aab5, aaa1 ],
+ function ( $table ) {
+ // Make colspanned header for test
+ $table.find( 'tr:eq(0) th:eq(1), tr:eq(0) th:eq(2)' ).remove();
+ $table.find( 'tr:eq(0) th:eq(0)' ).attr( 'colspan', '3' );
+
+ $table.tablesorter();
+ $table.find( '.headerSort:eq(0)' ).click();
+ $table.find( '.headerSort:eq(0)' ).click();
+ }
+ );
tableTest( 'Sorting with colspanned headers: subsequent column',
header,
initial,
@@ -332,12 +389,40 @@
function ( $table ) {
// Make colspanned header for test
$table.find( 'tr:eq(0) th:eq(1), tr:eq(0) th:eq(2)' ).remove();
- $table.find( 'tr:eq(0) th:eq(0)' ).prop( 'colspan', '3' );
+ $table.find( 'tr:eq(0) th:eq(0)' ).attr( 'colspan', '3' );
$table.tablesorter();
$table.find( '.headerSort:eq(1)' ).click();
}
);
+ tableTest( 'Sorting with colspanned headers: sort subsequent column twice',
+ header,
+ initial,
+ [ aab5, caa4, abc3, bbc2, aaa1 ],
+ function ( $table ) {
+ // Make colspanned header for test
+ $table.find( 'tr:eq(0) th:eq(1), tr:eq(0) th:eq(2)' ).remove();
+ $table.find( 'tr:eq(0) th:eq(0)' ).attr( 'colspan', '3' );
+
+ $table.tablesorter();
+ $table.find( '.headerSort:eq(1)' ).click();
+ $table.find( '.headerSort:eq(1)' ).click();
+ }
+ );
+
+
+ tableTest(
+ 'Basic planet table: one unsortable column',
+ header,
+ planets,
+ planets,
+ function ( $table ) {
+ $table.find( 'tr:eq(0) > th:eq(0)' ).addClass( 'unsortable' );
+
+ $table.tablesorter();
+ $table.find( 'tr:eq(0) > th:eq(0)' ).click();
+ }
+ );
// Regression tests!
tableTest(
@@ -489,12 +574,12 @@
$table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove();
// - Set rowspan for 2nd cell of 3rd row to 3.
// This covers the removed cell in the 4th and 5th row.
- $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' );
+ $table.find( 'tr:eq(2) td:eq(1)' ).attr( 'rowspan', '3' );
$table.tablesorter();
assert.equal(
- $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan' ),
+ $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowSpan' ),
3,
'Rowspan not exploded'
);
@@ -521,7 +606,7 @@
$table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove();
// - Set rowspan for 2nd cell of 3rd row to 3.
// This covers the removed cell in the 4th and 5th row.
- $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' );
+ $table.find( 'tr:eq(2) td:eq(1)' ).attr( 'rowspan', '3' );
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
@@ -538,7 +623,7 @@
$table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove();
// - Set rowspan for 2nd cell of 3rd row to 3.
// This covers the removed cell in the 4th and 5th row.
- $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' );
+ $table.find( 'tr:eq(2) td:eq(1)' ).attr( 'rowspan', '3' );
$table.tablesorter( { sortList: [
{ 0: 'asc' }
@@ -556,7 +641,7 @@
$table.find( 'tr:eq(3) td:eq(0), tr:eq(4) td:eq(0)' ).remove();
// - Set rowspan for 1st cell of 3rd row to 3.
// This covers the removed cell in the 4th and 5th row.
- $table.find( 'tr:eq(2) td:eq(0)' ).prop( 'rowspan', '3' );
+ $table.find( 'tr:eq(2) td:eq(0)' ).attr( 'rowspan', '3' );
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
@@ -642,7 +727,7 @@
}
);
- QUnit.test( 'Test detection routine', function ( assert ) {
+ QUnit.test( 'Test detection routine', 1, function ( assert ) {
var $table;
$table = $(
'<table class="sortable">' +
@@ -663,7 +748,7 @@
} );
/** FIXME: the diff output is not very readeable. */
- QUnit.test( 'bug 32047 - caption must be before thead', function ( assert ) {
+ QUnit.test( 'bug 32047 - caption must be before thead', 1, function ( assert ) {
var $table;
$table = $(
'<table class="sortable">' +
@@ -683,7 +768,7 @@
);
} );
- QUnit.test( 'data-sort-value attribute, when available, should override sorting position', function ( assert ) {
+ QUnit.test( 'data-sort-value attribute, when available, should override sorting position', 3, function ( assert ) {
var $table, data;
// Example 1: All cells except one cell without data-sort-value,
@@ -953,7 +1038,7 @@
}
);
- QUnit.test( 'Sorting images using alt text', function ( assert ) {
+ QUnit.test( 'Sorting images using alt text', 1, function ( assert ) {
var $table = $(
'<table class="sortable">' +
'<tr><th>THEAD</th></tr>' +
@@ -970,7 +1055,7 @@
);
} );
- QUnit.test( 'Sorting images using alt text (complex)', function ( assert ) {
+ QUnit.test( 'Sorting images using alt text (complex)', 1, function ( assert ) {
var $table = $(
'<table class="sortable">' +
'<tr><th>THEAD</th></tr>' +
@@ -991,7 +1076,7 @@
);
} );
- QUnit.test( 'Sorting images using alt text (with format autodetection)', function ( assert ) {
+ QUnit.test( 'Sorting images using alt text (with format autodetection)', 1, function ( assert ) {
var $table = $(
'<table class="sortable">' +
'<tr><th>THEAD</th></tr>' +
@@ -1010,6 +1095,61 @@
);
} );
+ QUnit.test( 'bug 38911 - The row with the largest amount of columns should receive the sort indicators', 3, function ( assert ) {
+ var $table = $(
+ '<table class="sortable">' +
+ '<thead>' +
+ '<tr><th rowspan="2" id="A1">A1</th><th colspan="2">B2a</th></tr>' +
+ '<tr><th id="B2b">B2b</th><th id="C2b">C2b</th></tr>' +
+ '</thead>' +
+ '<tr><td>A</td><td>Aa</td><td>Ab</td></tr>' +
+ '<tr><td>B</td><td>Ba</td><td>Bb</td></tr>' +
+ '</table>'
+ );
+ $table.tablesorter();
+
+ assert.equal(
+ $table.find( '#A1' ).attr( 'class' ),
+ 'headerSort',
+ 'The first column of the first row should be sortable'
+ );
+ assert.equal(
+ $table.find( '#B2b' ).attr( 'class' ),
+ 'headerSort',
+ 'The th element of the 2nd row of the 2nd column should be sortable'
+ );
+ assert.equal(
+ $table.find( '#C2b' ).attr( 'class' ),
+ 'headerSort',
+ 'The th element of the 2nd row of the 3rd column should be sortable'
+ );
+ } );
+
+ QUnit.test( 'rowspans in table headers should prefer the last row when rows are equal in length', 2, function ( assert ) {
+ var $table = $(
+ '<table class="sortable">' +
+ '<thead>' +
+ '<tr><th rowspan="2" id="A1">A1</th><th>B2a</th></tr>' +
+ '<tr><th id="B2b">B2b</th></tr>' +
+ '</thead>' +
+ '<tr><td>A</td><td>Aa</td></tr>' +
+ '<tr><td>B</td><td>Ba</td></tr>' +
+ '</table>'
+ );
+ $table.tablesorter();
+
+ assert.equal(
+ $table.find( '#A1' ).attr( 'class' ),
+ 'headerSort',
+ 'The first column of the first row should be sortable'
+ );
+ assert.equal(
+ $table.find( '#B2b' ).attr( 'class' ),
+ 'headerSort',
+ 'The th element of the 2nd row of the 2nd column should be sortable'
+ );
+ } );
+
// bug 41889 - exploding rowspans in more complex cases
tableTestHTML(
'Rowspan exploding with row headers',
diff --git a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
index ce03b697..5fe23944 100644
--- a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
@@ -48,13 +48,6 @@
var start = opt.before.start,
end = opt.before.end;
- if ( window.opera ) {
- // Compensate for Opera's craziness converting \n to \r\n and counting that as two chars
- var newLinesBefore = opt.before.text.substring( 0, start ).split( '\n' ).length - 1,
- newLinesInside = opt.before.text.substring( start, end ).split( '\n' ).length - 1;
- start += newLinesBefore;
- end += newLinesBefore + newLinesInside;
- }
var options = $.extend( {}, opt.replace ); // Clone opt.replace
options.selectionStart = start;