Index: trunk/extensions/WebFonts/tests/qunit/ext.webfonts.tests.js |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | assertTrue( mw.webfonts.addFont( 'Lohit Devanagari' ) , 'Add the Lohit Devanagari font again' ); |
18 | 18 | assertTrue( loadedFontsSize === mw.webfonts.fonts.length , 'Already loaded fonts not loaded again.' ); |
19 | 19 | assertFalse( mw.webfonts.addFont( 'Some Non existing font' ), 'addFont should return false if font not found' ); |
20 | | - assertTrue( cssRulesLength + 1 === document.styleSheets.length, 'No new css rules added at this stage' ); |
| 20 | + assertTrue( cssRulesLength + 1 === document.styleSheets.length, 'No new css rules added at this stage' ); |
21 | 21 | } ); |
22 | 22 | |
23 | 23 | test( '-- Dynamic font loading based on lang attribute', function() { |
— | — | @@ -24,14 +24,14 @@ |
25 | 25 | |
26 | 26 | ok( $( 'body' ).append( "<p class='webfonts-testing-lang-attr'>Some Content</p>") ); |
27 | 27 | $testElement = $( 'p.webfonts-testing-lang-attr' ) |
28 | | - assertTrue( $testElement !== undefined, 'Test element added' ) ; |
| 28 | + assertTrue( $testElement !== [], 'Test element added' ) ; |
29 | 29 | |
30 | 30 | ok( mw.webfonts.loadFontsForLangAttr() ); |
31 | 31 | assertFalse( $testElement.hasClass( 'webfonts-lang-attr' ), 'The element has no webfonts-lang-attr class since there is no lang attribute' ) ; |
32 | 32 | |
33 | 33 | ok( $testElement.attr( 'lang' , 'en' ) , 'Set lang attribute as english' ); |
34 | 34 | ok( mw.webfonts.loadFontsForLangAttr() ); |
35 | | - assertFalse( $testElement.hasClass( 'webfonts-lang-attr' ), 'The element has no webfonts-lang-attr class since there is en lang has no fonts available' ) ; |
| 35 | + assertFalse( $testElement.hasClass( 'webfonts-lang-attr' ), 'The element has no webfonts-lang-attr class since en lang has no fonts available' ) ; |
36 | 36 | |
37 | 37 | ok( $testElement.attr( 'lang' , 'ta' ) , 'Set lang attribute as Tamil' ); |
38 | 38 | var cssRulesLength = document.styleSheets.length; |
— | — | @@ -49,24 +49,24 @@ |
50 | 50 | test( '-- Dynamic font loading based on font-family style attribute', function() { |
51 | 51 | expect( 14 ) |
52 | 52 | |
53 | | - ok( $( 'body' ).append( "<p class='webfonts-testing-font-family-style'>Some Content</p>") ); |
| 53 | + ok( $( 'body' ).append( "<p class='webfonts-testing-font-family-style'>Some Content</p>" ) ); |
54 | 54 | var $testElement = $( 'p.webfonts-testing-font-family-style' ); |
55 | | - assertTrue( $testElement !== undefined, 'Test element added' ) ; |
| 55 | + assertTrue( $testElement !== [], 'Test element added' ) ; |
56 | 56 | |
57 | | - $testElement.css( 'font-family', 'RufScript, Arial, Helvetica, sans'); |
| 57 | + $testElement.attr( 'style','font-family: RufScript, Arial, Helvetica, sans' ); |
58 | 58 | var cssRulesLength = document.styleSheets.length; |
59 | 59 | assertTrue( $.inArray( 'RufScript', mw.webfonts.fonts ) === -1 , 'RufScript Font not loaded yet' ); |
60 | 60 | ok( mw.webfonts.loadFontsForFontFamilyStyle() ); |
61 | 61 | assertTrue( $.inArray( 'RufScript', mw.webfonts.fonts ) >= 0 , 'Font loaded' ); |
62 | 62 | assertTrue( cssRulesLength +1 === document.styleSheets.length, 'New css rule added to the document' ); |
63 | 63 | |
64 | | - $testElement.css( 'font-family', 'NonExistingFont, Arial, Helvetica, sans' ); |
| 64 | + $testElement.attr( 'style','font-family: NonExistingFont, Arial, Helvetica, sans' ); |
65 | 65 | cssRulesLength = document.styleSheets.length; |
66 | 66 | ok( mw.webfonts.loadFontsForFontFamilyStyle() ); |
67 | 67 | assertTrue( $.inArray( 'NonExistingFont', mw.webfonts.fonts ) === -1 , 'Font not loaded since it is not existing, including fallback fonts' ); |
68 | 68 | assertTrue( cssRulesLength === document.styleSheets.length, 'No new css rule added to the document' ); |
69 | 69 | |
70 | | - $testElement.css( 'font-family', 'NonExistingFont, AnjaliOldLipi, Arial, Helvetica, sans'); |
| 70 | + $testElement.attr( 'style','font-family: NonExistingFont, AnjaliOldLipi, Arial, Helvetica, sans' ); |
71 | 71 | cssRulesLength = document.styleSheets.length; |
72 | 72 | assertTrue( $.inArray( 'AnjaliOldLipi', mw.webfonts.fonts ) === -1 , 'Fallback font AnjaliOldLipi not loaded yet' ); |
73 | 73 | ok( mw.webfonts.loadFontsForFontFamilyStyle() ); |