Index: trunk/extensions/Narayam/tests/qunit/ext.narayam.rules.tests.js |
— | — | @@ -13,13 +13,15 @@ |
14 | 14 | $.narayam.setup(); |
15 | 15 | $.narayam.enable(); |
16 | 16 | } |
| 17 | + |
17 | 18 | function teardown() { |
18 | 19 | // we need to disable narayam, otherwise many typing simulation based test eg: jquery.byteLimitTest will fail. |
19 | 20 | $.narayam.disable(); |
20 | 21 | } |
| 22 | + |
21 | 23 | test( "-- Initial check", function() { |
22 | 24 | expect( 1 ); |
23 | | - ok( $.narayam, "$.narayam is defined" ); |
| 25 | + ok( $.narayam, '$.narayam is defined' ); |
24 | 26 | } ); |
25 | 27 | |
26 | 28 | // Basic sendkey-implementation |
— | — | @@ -43,82 +45,79 @@ |
44 | 46 | $input: null, |
45 | 47 | tests: [], |
46 | 48 | scheme: '' // The input method name. |
47 | | - }, options); |
| 49 | + }, options ); |
48 | 50 | |
49 | 51 | test( opt.description, function() { |
50 | | - expect( opt.tests.length); |
51 | | - $.narayam.enable( ); |
| 52 | + expect( opt.tests.length ); |
| 53 | + $.narayam.enable(); |
52 | 54 | stop(); |
53 | | - $.narayam.setScheme( opt.scheme, function(){ |
| 55 | + $.narayam.setScheme( opt.scheme, function () { |
54 | 56 | opt.$input.appendTo( '#qunit-fixture' ); |
55 | | - $.narayam.addInputs (opt.$input); |
| 57 | + $.narayam.addInputs( opt.$input ); |
56 | 58 | $.narayam.setScheme( opt.scheme ); |
57 | 59 | for ( var i= 0 ; i < opt.tests.length; i++ ) { |
58 | 60 | // Simulate pressing keys for each of the sample characters |
59 | 61 | typeChars( opt.$input, opt.tests[i].input ); |
60 | | - equals( opt.$input.val(), opt.tests[i].output, opt.tests[i].description ); |
61 | | - opt.$input.val(''); |
| 62 | + equals( opt.$input.val(), opt.tests[i].output, opt.tests[i].description ); |
| 63 | + opt.$input.val( '' ); |
62 | 64 | } |
63 | 65 | $.narayam.disable(); |
64 | 66 | start(); |
65 | | - }); |
| 67 | + } ); |
66 | 68 | } ); |
67 | 69 | }; |
68 | 70 | |
69 | | -narayamTest ( { |
| 71 | +narayamTest( { |
70 | 72 | description: 'Malayalam Transliteration test', |
71 | 73 | tests: [ |
72 | | - { input : 'ra', output : 'ര', description : 'Malayalam ra'}, |
73 | | - { input : 'nta', output : 'ന്റ', description : 'Malayalam nta'} |
| 74 | + { input: 'ra', output: 'ര', description: 'Malayalam ra' }, |
| 75 | + { input: 'nta', output: 'ന്റ', description: 'Malayalam nta' } |
74 | 76 | ], |
75 | | - scheme : 'ml', |
76 | | - $input: $( '<input >' ).attr( { 'id':"ml", 'type' :'text' } ) |
| 77 | + scheme: 'ml', |
| 78 | + $input: $( '<input>' ).attr( { id: 'ml', type: 'text' } ) |
77 | 79 | } ); |
78 | 80 | |
79 | | -narayamTest ( { |
| 81 | +narayamTest( { |
80 | 82 | description: 'Oriya Inscript test', |
81 | | - tests : [ |
82 | | - { input : 'ka', output : 'କୋ' } |
83 | | - ], |
84 | | - scheme : 'or-inscript', |
85 | | - $input: $( '<input >' ).attr( { 'id':"or", 'type' :'text' } ) |
| 83 | + tests: [{ input: 'ka', output: 'କୋ' }], |
| 84 | + scheme: 'or-inscript', |
| 85 | + $input: $( '<input>' ).attr( { id: 'or', type: 'text' } ) |
86 | 86 | } ); |
87 | 87 | |
88 | | -narayamTest ( { |
| 88 | +narayamTest( { |
89 | 89 | description: 'Malayalam Inscript test', |
90 | | - tests : [ |
91 | | - { input : 'ka', output : 'കോ' } |
92 | | - ], |
93 | | - scheme : 'ml-inscript', |
94 | | - $input: $( '<input >' ).attr( { 'id':"ml-inscript", 'type' :'text' } ) |
| 90 | + tests: [{ input: 'ka', output: 'കോ' }], |
| 91 | + scheme: 'ml-inscript', |
| 92 | + $input: $( '<input>' ).attr( { id: 'ml-inscript', type: 'text' } ) |
95 | 93 | } ); |
96 | 94 | |
97 | | -narayamTest ( { |
| 95 | +narayamTest( { |
98 | 96 | description: 'Tamil Inscript test', |
99 | | - tests : [ |
100 | | - { input : 'ka', output : 'கோ', description : 'Tamil Inscript கோ' } |
| 97 | + tests: [ |
| 98 | + { input: 'ka', output: 'கோ', description: 'Tamil Inscript கோ' } |
101 | 99 | ], |
102 | | - scheme : 'ta-inscript', |
103 | | - $input: $( '<input >' ).attr( { 'id':"ta-inscript", 'type' :'text' } ) |
| 100 | + scheme: 'ta-inscript', |
| 101 | + $input: $( '<input>' ).attr( { id: 'ta-inscript', type: 'text' } ) |
104 | 102 | } ); |
105 | 103 | |
106 | 104 | narayamTest ( { |
107 | 105 | description: 'Amharic Transliteration test', |
108 | | - tests : [ |
109 | | - { input : 'ka', output : 'ካ', description : 'Amharic ka->ካ' } |
| 106 | + tests: [ |
| 107 | + { input: 'ka', output: 'ካ', description: 'Amharic ka->ካ' } |
110 | 108 | ], |
111 | | - scheme : 'am', |
112 | | - $input: $( '<input >' ).attr( { 'id':"am", 'type' :'text' } ) |
| 109 | + scheme: 'am', |
| 110 | + $input: $( '<input>' ).attr( { id: 'am', type: 'text' } ) |
113 | 111 | } ); |
114 | 112 | |
115 | 113 | narayamTest ( { |
116 | 114 | description: 'Marathi Transliteration test', |
117 | | - tests : [ |
118 | | - { input : 'dny', output : 'ज्ञ्', description : 'dny for ज्ञ् in Marathi transliteration' } |
| 115 | + tests: [ |
| 116 | + { input: 'dny', output: 'ज्ञ्', description: 'dny for ज्ञ् in Marathi transliteration' } |
119 | 117 | ], |
120 | | - scheme : 'mr', |
121 | | - $input: $( '<input >' ).attr( { 'id':"mr", 'type' :'text' } ) |
| 118 | + scheme: 'mr', |
| 119 | + $input: $( '<input>' ).attr( { id: "mr", type: 'text' } ) |
122 | 120 | } ); |
123 | 121 | |
124 | 122 | teardown( ); |
125 | | -} ( ) ); |
| 123 | + |
| 124 | +}() ); |