test_select_vertical.html (2775B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test for select popup in vertical writing mode</title> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <script src="/tests/SimpleTest/EventUtils.js"></script> 6 <script> 7 SimpleTest.waitForExplicitFinish(); 8 9 function test() { 10 SimpleTest.waitForFocus(function() { 11 var vlr = document.getElementById("vlr"); 12 var selWidth = vlr.offsetWidth; 13 var optWidth = vlr.children[0].offsetWidth; 14 15 // We should be able to choose options from the vertical-lr <select> 16 // at positions increasingly to the right of the element itself. 17 is(vlr.value, "1", "(vertical-lr) initial value should be 1"); 18 19 synthesizeMouse(vlr, 5, 5, { type : "mousedown", button: 0 }); 20 synthesizeMouse(vlr, selWidth + 1.5 * optWidth, 5, { type : "mouseup", button: 0 }); 21 22 is(vlr.value, "2", "(vertical-lr) new value should be 2"); 23 24 synthesizeMouse(vlr, 5, 5, { type : "mousedown", button: 0 }); 25 synthesizeMouse(vlr, selWidth + 2.5 * optWidth, 5, { type : "mouseup", button: 0 }); 26 27 is(vlr.value, "3", "(vertical-lr) new value should be 3"); 28 29 synthesizeMouse(vlr, 5, 5, { type : "mousedown", button: 0 }); 30 synthesizeMouse(vlr, selWidth + 0.5 * optWidth, 5, { type : "mouseup", button: 0 }); 31 32 is(vlr.value, "1", "(vertical-lr) value should be back to 1"); 33 34 var vrl = document.getElementById("vrl"); 35 36 // We should be able to choose options from the vertical-rl <select> 37 // at positions increasingly to the left of the element itself. 38 is(vrl.value, "1", "(vertical-rl) initial value should be 1"); 39 40 synthesizeMouse(vrl, 5, 5, { type : "mousedown", button: 0 }); 41 synthesizeMouse(vrl, -1.5 * optWidth, 5, { type : "mouseup", button: 0 }); 42 43 is(vrl.value, "2", "(vertical-rl) new value should be 2"); 44 45 synthesizeMouse(vrl, 5, 5, { type : "mousedown", button: 0 }); 46 synthesizeMouse(vrl, -2.5 * optWidth, 5, { type : "mouseup", button: 0 }); 47 48 is(vrl.value, "3", "(vertical-rl) new value should be 3"); 49 50 synthesizeMouse(vrl, 5, 5, { type : "mousedown", button: 0 }); 51 synthesizeMouse(vrl, -0.5 * optWidth, 5, { type : "mouseup", button: 0 }); 52 53 is(vrl.value, "1", "(vertical-rl) value should be back to 1"); 54 55 SimpleTest.finish(); 56 }); 57 } 58 </script> 59 60 <body onload="test();"> 61 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1113206">Mozilla Bug 1113206</a> 62 <div> 63 <select id="vlr" style="writing-mode: vertical-lr; margin: 80px;"> 64 <option value="1">one 65 <option value="2">two 66 <option value="3">three 67 <option value="4">four 68 </select> 69 <select id="vrl" style="writing-mode: vertical-rl; margin: 80px;"> 70 <option value="1">one 71 <option value="2">two 72 <option value="3">three 73 <option value="4">four 74 </select> 75 </div>