Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.client.test.js |
— | — | @@ -285,19 +285,25 @@ |
286 | 286 | test( 'User-agent matches against WikiEditor\'s compatibility map', function() { |
287 | 287 | expect( uacount * 2 ); // double since we test both LTR and RTL |
288 | 288 | |
| 289 | + var $body = $( 'body' ), |
| 290 | + bodyClasses = $body.attr( 'class' ); |
| 291 | + |
289 | 292 | // Loop through and run tests |
290 | | - $.each( uas, function( agent, data ) { |
291 | | - $.each( ['ltr', 'rtl'], function( i, dir ) { |
292 | | - $('body').addClass(dir); |
| 293 | + $.each( uas, function ( agent, data ) { |
| 294 | + $.each( ['ltr', 'rtl'], function ( i, dir ) { |
| 295 | + $body.removeClass( 'ltr rtl' ).addClass( dir ); |
293 | 296 | var profile = $.client.profile( { |
294 | 297 | userAgent: agent, |
295 | 298 | platform: data.platform |
296 | 299 | } ); |
297 | 300 | var testMatch = $.client.test( testMap, profile ); |
298 | | - $('body').removeClass(dir); |
| 301 | + $body.removeClass( dir ); |
299 | 302 | |
300 | 303 | equal( testMatch, data.wikiEditor[dir], 'testing comparison based on ' + dir + ', ' + agent ); |
301 | 304 | }); |
302 | 305 | }); |
| 306 | + |
| 307 | + // Restore body classes |
| 308 | + $body.attr( 'class', bodyClasses ); |
303 | 309 | }); |
304 | 310 | |