| <?xml version="1.0"?> |
| <!DOCTYPE html PUBLIC "-//WAPFORUM/DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> |
| |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| |
| <style type="text/css"> |
| .star_upA {-wap-input-format: "*A" ; } /* upper letter, symbol, punctuation, NO number */ |
| .star_lowa {-wap-input-format: "*a" ; } /* lower letter, symbol, punctuation, NO number */ |
| .star_upN {-wap-input-format: "*N" ; } /* number only */ |
| .star_lown {-wap-input-format: "*n" ; } /* number , symbol, punctuation, no letter */ |
| .star_upX {-wap-input-format: "*X" ; } /* upper letter, number, symbol, punctuation, no lower letter */ |
| .star_lowx {-wap-input-format: "*x" ; } /* lower letter, number, symbol, punctuation, no upper letter */ |
| .star_upM {-wap-input-format: "*M" ; } /* anything, with upper as the default input */ |
| .star_lowm {-wap-input-format: "*m" ; } /* anything, with lower as the default input */ |
| .three_N {-wap-input-format: "3N" ; } /* up to 3 digit number */ |
| |
| </style> |
| |
| <script src="../js/resources/js-test-pre.js"></script> |
| |
| </head> |
| |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <input type="text" id="star_upA" class="star_upA" /> |
| <input type="text" id="star_lowa" class="star_lowa" /> |
| <input type="text" id="star_upN" class="star_upN" /> |
| <input type="text" id="star_lown" class="star_lown" /> |
| <input type="text" id="star_upX" class="star_upX" /> |
| <input type="text" id="star_lowx" class="star_lowx" /> |
| <input type="text" id="star_upM" class="star_upM" /> |
| <input type="text" id="star_lowm" class="star_lowm" /> |
| <input type="text" id="three_N" class="three_N" /> |
| |
| <script type="text/javascript"> |
| |
| function domValueOf(id) { |
| return document.getElementById(id).value; |
| } |
| function visibleValueOf(id) { |
| var el = document.getElementById(id); |
| el.focus(); |
| document.execCommand('SelectAll'); |
| return document.getSelection().toString(); |
| } |
| |
| function inputKeys(str) { |
| if(!window.eventSender) |
| return; |
| for(i = 0; i != str.length; i++) { |
| eventSender.keyDown(str.charAt(i)); |
| } |
| } |
| |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| } |
| |
| var str = "AaBbCcDdEeFfGg123456!@#$%^,.;"; |
| |
| debug("Assume the user input the following \"" + str + "\" to each of the input elements<br/><br/>"); |
| |
| debug('<br/>{-wap-input-format:"*A";} only takes upper letters, symbols, punctuations<br/>'); |
| |
| document.getElementById("star_upA").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_upA")','"ABCDEFG!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_upA")','"ABCDEFG!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"*a";} only takes lower letters, symbols, punctuations<br /><br />'); |
| document.getElementById("star_lowa").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_lowa")', '"abcdefg!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_lowa")', '"abcdefg!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"*N";} only takes numbers <br />'); |
| document.getElementById("star_upN").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_upN")', '"123456"'); |
| shouldBe('visibleValueOf("star_upN")', '"123456"'); |
| |
| debug('<br/>{-wap-input-format:"*n";} only takes numbers , symbals and punctuations <br />'); |
| document.getElementById("star_lown").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_lown")', '"123456!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_lown")', '"123456!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"*X";} takes upper letters,numbers,symbals and punctuations <br />'); |
| document.getElementById("star_upX").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_upX")', '"ABCDEFG123456!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_upX")', '"ABCDEFG123456!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"*x";} takes lower letters,numbers,symbals and punctuations <br />'); |
| document.getElementById("star_lowx").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_lowx")', '"abcdefg123456!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_lowx")', '"abcdefg123456!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"*M";} takes any character <br />'); |
| document.getElementById("star_upM").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_upM")', '"AaBbCcDdEeFfGg123456!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_upM")', '"AaBbCcDdEeFfGg123456!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"*m";} takes any character <br />'); |
| document.getElementById("star_lowm").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("star_lowm")', '"AaBbCcDdEeFfGg123456!@#$%^,.;"'); |
| shouldBe('visibleValueOf("star_lowm")', '"AaBbCcDdEeFfGg123456!@#$%^,.;"'); |
| |
| debug('<br/>{-wap-input-format:"3N";} takes 3 numbers <br />'); |
| document.getElementById("three_N").focus(); |
| inputKeys(str); |
| shouldBe('domValueOf("three_N")', '"123"'); |
| shouldBe('visibleValueOf("three_N")', '"123"'); |
| |
| |
| </script> |
| |
| |
| </body> |
| </html> |