|
Lines 157-203
Link Here
|
| 157 |
testUtil.clearTimerOnceLog(); |
157 |
testUtil.clearTimerOnceLog(); |
| 158 |
}, |
158 |
}, |
| 159 |
|
159 |
|
| 160 |
testTextAreaMaxLength : function() { |
160 |
testTextAreaMaxLength : qx.core.Variant.select("qx.client", { |
| 161 |
var testUtil = org.eclipse.rwt.test.fixture.TestUtil; |
161 |
"mshtml" : function() { |
| 162 |
testUtil.prepareTimerUse(); |
162 |
// NOTE: This test would fail in IE because it has a bug that sometimes |
| 163 |
var text = new org.eclipse.rwt.widgets.Text( true ); |
163 |
// prevents a textFields value from being overwritten and read in the |
| 164 |
org.eclipse.swt.TextUtil.initialize( text ); |
164 |
// same call |
| 165 |
var changeLog = []; |
165 |
}, |
| 166 |
text.addEventListener( "input", function(){ |
166 |
"default" : function() { |
| 167 |
changeLog.push( true ); |
167 |
var testUtil = org.eclipse.rwt.test.fixture.TestUtil; |
| 168 |
} ); |
168 |
testUtil.prepareTimerUse(); |
| 169 |
text.setValue( "0123456789" ); |
169 |
var text = new org.eclipse.rwt.widgets.Text( true ); |
| 170 |
text.addToDocument(); |
170 |
org.eclipse.swt.TextUtil.initialize( text ); |
| 171 |
testUtil.flush(); |
171 |
var changeLog = []; |
| 172 |
assertEquals( "0123456789", text.getValue() ); |
172 |
text.addEventListener( "input", function(){ |
| 173 |
assertEquals( "0123456789", text.getComputedValue() ); |
173 |
changeLog.push( true ); |
| 174 |
text.setMaxLength( 5 ); |
174 |
} ); |
| 175 |
assertEquals( "0123456789", text.getValue() ); |
175 |
text.setValue( "0123456789" ); |
| 176 |
assertEquals( "0123456789", text.getComputedValue() ); |
176 |
text.addToDocument(); |
| 177 |
assertEquals( 0, changeLog.length ); |
177 |
testUtil.flush(); |
| 178 |
text._inputElement.value = "012345678"; |
178 |
assertEquals( "0123456789", text.getValue() ); |
| 179 |
text.__oninput( {} ); |
179 |
assertEquals( "0123456789", text.getComputedValue() ); |
| 180 |
assertEquals( "012345678", text.getValue() ); |
180 |
text.setMaxLength( 5 ); |
| 181 |
assertEquals( "012345678", text.getComputedValue() ); |
181 |
assertEquals( "0123456789", text.getValue() ); |
| 182 |
assertEquals( 1, changeLog.length ); |
182 |
assertEquals( "0123456789", text.getComputedValue() ); |
| 183 |
text._inputElement.value = "01234567x8"; |
183 |
assertEquals( 0, changeLog.length ); |
| 184 |
text.setSelectionStart( 9 ); |
184 |
text._inputElement.value = "012345678"; |
| 185 |
text.__oninput( {} ); |
185 |
text.__oninput( {} ); |
| 186 |
assertEquals( "012345678", text.getValue() ); |
186 |
assertEquals( "012345678", text.getValue() ); |
| 187 |
assertEquals( "012345678", text.getComputedValue() ); |
187 |
assertEquals( "012345678", text.getComputedValue() ); |
| 188 |
assertEquals( 1, changeLog.length ); |
188 |
assertEquals( 1, changeLog.length ); |
| 189 |
assertEquals( 8, text.getSelectionStart() ); |
189 |
text._inputElement.value = "01234567x8"; |
| 190 |
text._inputElement.value = "abcdefghiklmnopq"; |
190 |
text.setSelectionStart( 9 ); |
| 191 |
text.__oninput( {} ); |
191 |
text.__oninput( {} ); |
| 192 |
assertEquals( "abcde", text.getValue() ); |
192 |
assertEquals( "012345678", text.getValue() ); |
| 193 |
assertEquals( "abcde", text.getComputedValue() ); |
193 |
assertEquals( "012345678", text.getComputedValue() ); |
| 194 |
assertEquals( 2, changeLog.length ); |
194 |
assertEquals( 1, changeLog.length ); |
| 195 |
assertEquals( 5, text.getSelectionStart() ); |
195 |
assertEquals( 8, text.getSelectionStart() ); |
| 196 |
text.setParent( null ); |
196 |
text._inputElement.value = "abcdefghiklmnopq"; |
| 197 |
text.destroy(); |
197 |
text.__oninput( {} ); |
| 198 |
testUtil.flush(); |
198 |
assertEquals( "abcde", text.getValue() ); |
| 199 |
testUtil.clearTimerOnceLog(); |
199 |
assertEquals( "abcde", text.getComputedValue() ); |
| 200 |
}, |
200 |
assertEquals( 2, changeLog.length ); |
|
|
201 |
assertEquals( 5, text.getSelectionStart() ); |
| 202 |
text.setParent( null ); |
| 203 |
text.destroy(); |
| 204 |
testUtil.flush(); |
| 205 |
testUtil.clearTimerOnceLog(); |
| 206 |
} |
| 207 |
} ) |
| 201 |
|
208 |
|
| 202 |
} |
209 |
} |
| 203 |
|
210 |
|