Fixes for jquery.localize unit test IE6,IE7,IE8:
authorKrinkle <krinkle@users.mediawiki.org>
Wed, 13 Jul 2011 23:57:11 +0000 (23:57 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Wed, 13 Jul 2011 23:57:11 +0000 (23:57 +0000)
- localize doesn't offically support "self" modification, only for children via find(). Which is why most were wrapped in a <div> (otherwise find('[title-msg]') won't find it). Now adding a <div> around the others as well to be consistent, and hopefully fix the breakage on testswarm in IE6-8

tests/qunit/suites/resources/jquery/jquery.localize.js

index 52ae467..43eac09 100644 (file)
@@ -12,16 +12,16 @@ test( 'Handle basic replacements', function() {
        mw.messages.set( 'basic', 'Basic stuff' );
 
        // Tag: html:msg
-       html = '<span><html:msg key="basic"></span>';
-       $lc = $( html ).localize();
+       html = '<div><span><html:msg key="basic"></span></div>';
+       $lc = $( html ).localize().find( 'span' );
 
-       strictEqual( $lc.html(), 'Basic stuff', 'Tag: html:msg' );
+       strictEqual( $lc.text(), 'Basic stuff', 'Tag: html:msg' );
 
        // Tag: msg (deprecated)
-       html = '<span><msg key="basic"></span>';
-       $lc = $( html ).localize();
+       html = '<div><span><msg key="basic"></span></div>';
+       $lc = $( html ).localize().find( 'span' );
 
-       strictEqual( $lc.html(), 'Basic stuff', 'Tag: msg' );
+       strictEqual( $lc.text(), 'Basic stuff', 'Tag: msg' );
 
        // Attribute: title-msg
        html = '<div><span title-msg="basic"></span></div>';
@@ -46,8 +46,8 @@ test( 'Proper escaping', function() {
        // making sure it is actually using text() and attr() (or something with the same effect)
 
        // Text escaping
-       html = '<span><html:msg key="properfoo"></span>';
-       $lc = $( html ).localize();
+       html = '<div><span><html:msg key="properfoo"></span></div>';
+       $lc = $( html ).localize().find( 'span' );
 
        strictEqual( $lc.text(), mw.msg( 'properfoo' ), 'Content is inserted as text, not as html.' );
 
@@ -95,12 +95,12 @@ test( 'Options', function() {
        strictEqual( $lc.text(), 'The Bars', 'Variable keys mapping - text' );
 
        // Passing parameteters to mw.msg
-       html = '<span><html:msg key="foo-welcome" /></span>';
+       html = '<div><span><html:msg key="foo-welcome" /></span></div>';
        $lc = $( html ).localize( {
                params: {
                        'foo-welcome': [sitename, 'yesterday']
                }
-       } );
+       } ).find( 'span' );
 
        strictEqual( $lc.text(), 'Welcome to Wikipedia! (last visit: yesterday)', 'Passing parameteters to mw.msg' );