Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/select-clientheight-large-size.html

Issue 1509853008: Move select/option/optgroup-related tests in fast/forms to fast/forms/select. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <div id="output"></div>
4 <script>
5 description("Tests that select elements cap their size to the size attribute and to 4 when no size is specified.");
6
7 function getElemById(elemId) {
8 return document.getElementById(elemId);
9 }
10
11 function clientHeight(elemId) {
12 return getElemById(elemId).clientHeight;
13 }
14
15 function multipleOfElement(elemId, multiple) {
16 return clientHeight(elemId) * multiple;
17 }
18
19 function addSelect(id, numOptions)
20 {
21 var select = document.createElement("select2");
22 var html = '<select multiple id="' + id + '">';
23 for (var i = 0; i <= numOptions; i++)
24 html += '<option value="' + i + '">' + i + '</option>';
25 getElemById('output').innerHTML += html + '</select>';
26 }
27
28 addSelect('select1', 10);
29 addSelect('select2', 16);
30
31 shouldBe("clientHeight('select2')", "clientHeight('select1')");
32 shouldBeTrue("getElemById('select2').setAttribute('size', '4'); clientHeight ('select2') == clientHeight('select1')");
33 shouldBeTrue("getElemById('select2').setAttribute('size', '5'); clientHeight ('select2') > clientHeight('select1')");
34 shouldBeCloseTo("getElemById('select2').setAttribute('size', '8'); clientHei ght('select2')", multipleOfElement('select1', 2), 1);
35 shouldBeCloseTo("getElemById('select2').setAttribute('size', '12'); clientHe ight('select2')", multipleOfElement('select1', 3), 1);
36 shouldBeCloseTo("getElemById('select2').setAttribute('size', '16'); clientHe ight('select2')", multipleOfElement('select1', 4), 1);
37 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698