Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js |
— | — | @@ -36,16 +36,14 @@ |
37 | 37 | |
38 | 38 | test( opt.description, function() { |
39 | 39 | var tests = 1; |
40 | | - if (opt.after.selected !== null) { |
| 40 | + if ( opt.after.selected !== null ) { |
41 | 41 | tests++; |
42 | 42 | } |
43 | | - expect(tests); |
| 43 | + expect( tests ); |
44 | 44 | |
45 | | - var $fixture = $( '<div id="qunit-fixture"></div>' ); |
46 | 45 | var $textarea = $( '<textarea>' ); |
47 | 46 | |
48 | | - $fixture.append($textarea); |
49 | | - $( 'body' ).append($fixture); |
| 47 | + $( '#qunit-fixture' ).append( $textarea ); |
50 | 48 | |
51 | 49 | //$textarea.textSelection( 'setContents', opt.before.text); // this method is actually missing atm... |
52 | 50 | $textarea.val( opt.before.text ); // won't work with the WikiEditor iframe? |
— | — | @@ -228,11 +226,9 @@ |
229 | 227 | test(options.description, function() { |
230 | 228 | expect(2); |
231 | 229 | |
232 | | - var $fixture = $( '<div id="qunit-fixture"></div>' ); |
233 | 230 | var $textarea = $( '<textarea>' ).text(options.text); |
234 | 231 | |
235 | | - $fixture.append($textarea); |
236 | | - $( 'body' ).append($fixture); |
| 232 | + $( '#qunit-fixture' ).append( $textarea ); |
237 | 233 | |
238 | 234 | if (options.mode == 'set') { |
239 | 235 | $textarea.textSelection('setSelection', { |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js |
— | — | @@ -6,8 +6,8 @@ |
7 | 7 | }); |
8 | 8 | |
9 | 9 | function createWrappedDiv( text, width ) { |
10 | | - var $wrapper = $( '<div />' ).css( 'width', width ); |
11 | | - var $div = $( '<div />' ).text( text ); |
| 10 | + var $wrapper = $( '<div>' ).css( 'width', width ); |
| 11 | + var $div = $( '<div>' ).text( text ); |
12 | 12 | $wrapper.append( $div ); |
13 | 13 | return $wrapper; |
14 | 14 | } |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | // We need this thing to be visible, so append it to the DOM |
28 | 28 | var origText = 'This is a really long random string and there is no way it fits in 100 pixels.'; |
29 | 29 | var $wrapper = createWrappedDiv( origText, '100px' ); |
30 | | - $( 'body' ).append( $wrapper ); |
| 30 | + $( '#qunit-fixture' ).append( $wrapper ); |
31 | 31 | $wrapper.autoEllipsis( { position: 'right' } ); |
32 | 32 | |
33 | 33 | // Verify that, and only one, span element was created |
— | — | @@ -47,12 +47,9 @@ |
48 | 48 | // Put this text in the span and verify it doesn't fit |
49 | 49 | $span.text( spanTextNew ); |
50 | 50 | // In IE6 width works like min-width, allow IE6's width to be "equal to" |
51 | | - if ( $.browser.msie && Number( $.browser.version ) == 6 ) { |
| 51 | + if ( $.browser.msie && Number( $.browser.version ) === 6 ) { |
52 | 52 | gtOrEq( $span.width(), $span.parent().width(), 'Fit is maximal (adding two characters makes it not fit any more) - IE6: Maybe equal to as well due to width behaving like min-width in IE6' ); |
53 | 53 | } else { |
54 | 54 | gt( $span.width(), $span.parent().width(), 'Fit is maximal (adding two characters makes it not fit any more)' ); |
55 | 55 | } |
56 | | - |
57 | | - // Clean up |
58 | | - $wrapper.remove(); |
59 | 56 | }); |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js |
— | — | @@ -18,14 +18,11 @@ |
19 | 19 | '<textarea tabindex="5">Foobar</textarea>' + |
20 | 20 | '</form>'; |
21 | 21 | |
22 | | - var $testA = $( '<div>' ).html( testEnvironment ).appendTo( 'body' ); |
| 22 | + var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' ); |
23 | 23 | strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' ); |
24 | 24 | |
25 | 25 | var $testB = $( '<div>' ); |
26 | 26 | strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' ); |
27 | | - |
28 | | - // Clean up |
29 | | - $testA.add( $testB ).remove(); |
30 | 27 | }); |
31 | 28 | |
32 | 29 | test( 'lastTabIndex', function() { |
— | — | @@ -39,12 +36,9 @@ |
40 | 37 | '<textarea tabindex="5">Foobar</textarea>' + |
41 | 38 | '</form>'; |
42 | 39 | |
43 | | - var $testA = $( '<div>' ).html( testEnvironment ).appendTo( 'body' ); |
| 40 | + var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' ); |
44 | 41 | strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' ); |
45 | 42 | |
46 | 43 | var $testB = $( '<div>' ); |
47 | 44 | strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' ); |
48 | | - |
49 | | - // Clean up |
50 | | - $testA.add( $testB ).remove(); |
51 | 45 | }); |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | |
48 | 48 | test( opt.description, function() { |
49 | 49 | |
50 | | - opt.$input.appendTo( 'body' ); |
| 50 | + opt.$input.appendTo( '#qunit-fixture' ); |
51 | 51 | |
52 | 52 | // Simulate pressing keys for each of the sample characters |
53 | 53 | $.addChars( opt.$input, opt.sample ); |
— | — | @@ -66,8 +66,6 @@ |
67 | 67 | equal( newVal, opt.expected, 'New value matches the expected string' ); |
68 | 68 | equal( $.byteLength( newVal ), $.byteLength( opt.expected ), 'Unlimited scenarios are not affected, expected length reached' ); |
69 | 69 | } |
70 | | - |
71 | | - opt.$input.remove(); |
72 | 70 | } ); |
73 | 71 | }; |
74 | 72 | |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | test('jquery.delayedBind with data option', function() { |
3 | | - var $fixture = $('<div>').appendTo('body'), |
| 3 | + var $fixture = $('<div>').appendTo('#qunit-fixture'), |
4 | 4 | data = { magic: "beeswax" }, |
5 | 5 | delay = 50; |
6 | 6 | |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | }); |
22 | 22 | |
23 | 23 | test('jquery.delayedBind without data option', function() { |
24 | | - var $fixture = $('<div>').appendTo('body'), |
| 24 | + var $fixture = $('<div>').appendTo('#qunit-fixture'), |
25 | 25 | data = { magic: "beeswax" }, |
26 | 26 | delay = 50; |
27 | 27 | |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js |
— | — | @@ -79,7 +79,6 @@ |
80 | 80 | expect(1); |
81 | 81 | |
82 | 82 | var $table = tableCreate( header, data ); |
83 | | - //$( 'body' ).append($table); |
84 | 83 | |
85 | 84 | // Give caller a chance to set up sorting and manipulate the table. |
86 | 85 | callback( $table ); |
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | test( 'addCSS', function() { |
54 | 54 | expect(3); |
55 | 55 | |
56 | | - var $testEl = $( '<div>' ).attr( 'id', 'mw-addcsstest' ).appendTo( 'body' ); |
| 56 | + var $testEl = $( '<div>' ).attr( 'id', 'mw-addcsstest' ).appendTo( '#qunit-fixture' ); |
57 | 57 | |
58 | 58 | var style = mw.util.addCSS( '#mw-addcsstest { visibility: hidden; }' ); |
59 | 59 | equal( typeof style, 'object', 'addCSS returned an object' ); |
— | — | @@ -61,9 +61,7 @@ |
62 | 62 | equal( $testEl.css( 'visibility' ), 'hidden', 'Added style properties are in effect' ); |
63 | 63 | |
64 | 64 | // Clean up |
65 | | - $( style.ownerNode ) |
66 | | - .add( $testEl ) |
67 | | - .remove(); |
| 65 | + $( style.ownerNode ).remove(); |
68 | 66 | }); |
69 | 67 | |
70 | 68 | test( 'toggleToc', function() { |
— | — | @@ -79,7 +77,7 @@ |
80 | 78 | '</div>' + |
81 | 79 | '<ul><li></li></ul>' + |
82 | 80 | '</td></tr></table>', |
83 | | - $toc = $(tocHtml).appendTo( 'body' ), |
| 81 | + $toc = $(tocHtml).appendTo( '#qunit-fixture' ), |
84 | 82 | $toggleLink = $( '#togglelink' ); |
85 | 83 | |
86 | 84 | strictEqual( $toggleLink.length, 1, 'Toggle link is appended to the page.' ); |
— | — | @@ -90,9 +88,6 @@ |
91 | 89 | |
92 | 90 | var actionC = function() { |
93 | 91 | start(); |
94 | | - |
95 | | - // Clean up |
96 | | - $toc.remove(); |
97 | 92 | }; |
98 | 93 | var actionB = function() { |
99 | 94 | start(); stop(); |
— | — | @@ -158,8 +153,8 @@ |
159 | 154 | <h5>Views</h5>\ |
160 | 155 | <ul></ul>\ |
161 | 156 | </div>', |
162 | | - $mwPanel = $(mwPanel).appendTo( 'body' ), |
163 | | - $vectorTabs = $(vectorTabs).appendTo( 'body' ); |
| 157 | + $mwPanel = $(mwPanel).appendTo( '#qunit-fixture' ), |
| 158 | + $vectorTabs = $(vectorTabs).appendTo( '#qunit-fixture' ); |
164 | 159 | |
165 | 160 | var tbRL = mw.util.addPortletLink( 'p-test-tb', '//mediawiki.org/wiki/ResourceLoader', |
166 | 161 | 'ResourceLoader', 't-rl', 'More info about ResourceLoader on MediaWiki.org ', 'l' ); |
— | — | @@ -186,10 +181,7 @@ |
187 | 182 | strictEqual( $( caFoo ).find( 'span').length, 1, 'A <span> element should be added for porlets with vectorTabs class.' ); |
188 | 183 | |
189 | 184 | // Clean up |
190 | | - $( [tbRL, tbMW, tbRLDM, caFoo] ) |
191 | | - .add( $mwPanel ) |
192 | | - .add( $vectorTabs ) |
193 | | - .remove(); |
| 185 | + $( [tbRL, tbMW, tbRLDM, caFoo] ).remove(); |
194 | 186 | }); |
195 | 187 | |
196 | 188 | test( 'jsMessage', function() { |