r109334 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109333‎ | r109334 | r109335 >
Date:07:31, 18 January 2012
Author:amire80
Status:resolved (Comments)
Tags:i18nreview 
Comment:
Added tests for application of web fonts to body, input, select and textarea.
Modified paths:
  • /trunk/extensions/WebFonts/tests/qunit/ext.webfonts.tests.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/tests/qunit/ext.webfonts.tests.js
@@ -7,7 +7,7 @@
88 } );
99
1010 test( '-- Web font application to body', function() {
11 - expect( 4 );
 11+ expect( 17 );
1212
1313 var invalidFont = 'NonExistingFont';
1414 assertTrue( mw.webfonts.set( invalidFont ) === undefined, 'A non-existent font is not initialized' );
@@ -19,15 +19,35 @@
2020 fontFamily: $body.css( 'font-family' ),
2121 fontSize: $body.css( 'font-size' )
2222 };
23 - var teluguFont = mw.webfonts.config.languages.te[0]
 23+ var teluguFont = mw.webfonts.config.languages.te[0];
2424 $body.attr( 'lang', 'te' );
2525
 26+ ok( $( 'body' ).append( "<input class='webfonts-testing-element'>input content</input>"), 'An input element for testing was appended to body' );
 27+ $inputElement = $( 'input.webfonts-testing-element' )
 28+ assertTrue( $inputElement !== [], 'The input test element is defined' );
 29+ ok( $( 'body' ).append( "<select class='webfonts-testing-element'>select content</select>"), 'A select element for testing was appended to body' );
 30+ $selectElement = $( 'select.webfonts-testing-element' )
 31+ assertTrue( $selectElement !== [], 'The select test element is defined' );
 32+ ok( $( 'body' ).append( "<textarea class='webfonts-testing-element'>textarea content</textarea>"), 'A textarea element for testing was appended to body' );
 33+ $textareaElement = $( 'textarea.webfonts-testing-element' )
 34+ assertTrue( $textareaElement !== [], 'The textarea test element is defined' );
 35+
2636 ok( mw.webfonts.set( teluguFont ), 'Attempted to load a Telugu font for the whole page' );
 37+ var fallbackFonts = 'Helvetica,Arial,sans-serif';
2738 deepEqual( oldConfig, mw.webfonts.oldconfig, 'Previous body css was saved properly' );
2839
 40+ // Font application
 41+ equal( $body.css( 'font-family' ), '"' + teluguFont + '",' + fallbackFonts, 'The web font was applied to font-family of body' );
 42+ equal( $inputElement.css( 'font-family' ), '"' + teluguFont + '",' + fallbackFonts, 'The web font was applied to font-family of input' );
 43+ equal( $selectElement.css( 'font-family' ), '"' + teluguFont + '",' + fallbackFonts, 'The web font was applied to font-family of select' );
 44+ equal( $textareaElement.css( 'font-family' ), '"' + teluguFont + '",' + fallbackFonts, 'The web font was applied to font-family of textarea' );
 45+
2946 // Restore <body>
3047 $body.attr( 'lang', bodyLang );
3148 ok( mw.webfonts.reset(), 'Reset body after testing font application' );
 49+ ok( $inputElement.remove(), 'The input test element was removed from body' );
 50+ ok( $selectElement.remove(), 'The select test element was removed from body' );
 51+ ok( $textareaElement.remove(), 'The textarea test element was removed from body' );
3252 } );
3353
3454 test( '-- Dynamic font loading', function() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r109356Correct the testcases that were failing in r109334santhosh11:39, 18 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   10:48, 18 January 2012
Expected: 	
"\"Lohit Telugu\",Helvetica,Arial,sans-serif"
Result: 	
"'Lohit Telugu', Helvetica, Arial, sans-serif"

Status & tagging log