Localisation updates from http://translatewiki.net.
[mediawiki.git] / tests / qunit / suites / resources / jquery / jquery.byteLength.test.js
blob15fac69119ace89b4d0a58b14572ab7d0f2733ad
1 module( 'jquery.byteLength', QUnit.newMwEnvironment() );
3 test( '-- Initial check', function() {
4         expect(1);
5         ok( $.byteLength, 'jQuery.byteLength defined' );
6 } );
8 test( 'Simple text', function() {
9         expect(5);
11         var     azLc = 'abcdefghijklmnopqrstuvwxyz',
12                 azUc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
13                 num = '0123456789',
14                 x = '*',
15                 space = '   ';
17         equal( $.byteLength( azLc ), 26, 'Lowercase a-z' );
18         equal( $.byteLength( azUc ), 26, 'Uppercase A-Z' );
19         equal( $.byteLength( num ), 10, 'Numbers 0-9' );
20         equal( $.byteLength( x ), 1, 'An asterisk' );
21         equal( $.byteLength( space ), 3, '3 spaces' );
23 } );
25 test( 'Special text', window.foo = function() {
26         expect(5);
28         // http://en.wikipedia.org/wiki/UTF-8
29         var     U_0024 = '\u0024',
30                 U_00A2 = '\u00A2',
31                 U_20AC = '\u20AC',
32                 U_024B62 = '\u024B62',
33                 // The normal one doesn't display properly, try the below which is the same
34                 // according to http://www.fileformat.info/info/unicode/char/24B62/index.htm
35                 U_024B62_alt = '\uD852\uDF62';
37         strictEqual( $.byteLength( U_0024 ), 1, 'U+0024: 1 byte. \u0024 (dollar sign)' );
38         strictEqual( $.byteLength( U_00A2 ), 2, 'U+00A2: 2 bytes. \u00A2 (cent sign)' );
39         strictEqual( $.byteLength( U_20AC ), 3, 'U+20AC: 3 bytes. \u20AC (euro sign)' );
40         strictEqual( $.byteLength( U_024B62 ), 4, 'U+024B62: 4 bytes. \uD852\uDF62 (a Han character)' );
41         strictEqual( $.byteLength( U_024B62_alt ), 4, 'U+024B62: 4 bytes. \uD852\uDF62 (a Han character) - alternative method' );
42 } );