4 <script src=
"../../resources/js-test.js"></script>
8 description('width and height attributes of HTMLInputElement.');
11 <p id=
"description"></p>
14 <input type=
"image" id=
"image1" src=
"resources/green.jpg" width=
"160" height=
"80px">
19 <input type=
"image" id=
"image2" src=
"resources/green.jpg">
24 <input type=
"image" id=
"image3" src=
"resources/green.jpg">
29 <input type=
"image" id=
"image4" src=
"resources/green.jpg">
34 <input type=
"text" id=
"text1">
39 <input type=
"file" id=
"file1">
44 <input type=
"date" id=
"date1">
49 <input type=
"button" id=
"button1">
54 var div
= document
.getElementById("div1");
55 var image1
= document
.getElementById("image1");
56 debug('Test case #1 : Image, HTML inline setting as \"160\", \"80\"');
57 shouldBeTrue("('width' in image1)");
58 shouldBeTrue("('height' in image1)");
59 shouldBe('image1.width,image1.height', '160,80');
61 div
= document
.getElementById("div2");
62 var image2
= document
.getElementById("image2");
63 debug('Test case #2 : Image, Setting by JavaScript API as \"260\", \"130\"');
64 shouldBeTrue("('width' in image1)");
65 shouldBeTrue("('height' in image1)");
68 shouldBe('image2.width,image2.height', '260,130');
70 div
= document
.getElementById("div3");
71 var image3
= document
.getElementById("image3");
72 debug('Test case #3 : Image, Setting by JavaScript API as \"120px\", \"60px\"');
73 shouldBeTrue("('width' in image1)");
74 shouldBeTrue("('height' in image1)");
75 image3
.width
= "120px";
76 image3
.height
= "60px";
77 shouldBe('image3.width,image3.height', '0,0');
79 div
= document
.getElementById("div4");
80 var image4
= document
.getElementById("image4");
81 debug('Test case #4 : Image, Setting by JavaScript API as \"120.99\", \"60.55\"');
82 shouldBeTrue("('width' in image1)");
83 shouldBeTrue("('height' in image1)");
84 image4
.width
= 120.99;
85 image4
.height
= 60.99;
86 shouldBe('image4.width,image4.height', '120,60');
88 div
= document
.getElementById("div5");
89 var text1
= document
.getElementById("text1");
90 debug('Test case #5 : Text, Setting by JavaScript API as \"100\", \"50\"');
91 shouldBeTrue("('width' in text1)");
92 shouldBeTrue("('height' in text1)");
95 shouldBe('text1.width,text1.height', '0,0');
98 text1
.src
= "resources/green.jpg";
99 shouldBe('text1.width,text1.height', '100,50');
102 shouldBe('text1.width,text1.height', '60,40');
104 div
= document
.getElementById("div6");
105 var file1
= document
.getElementById("file1");
106 debug('Test case #6 : File, Setting by JavaScript API as \"100\", \"50\"');
107 shouldBeTrue("('width' in file1)");
108 shouldBeTrue("('height' in file1)");
111 shouldBe('file1.width,file1.height', '0,0');
113 file1
.type
= 'image';
114 file1
.src
= "resources/green.jpg";
115 shouldBe('file1.width,file1.height', '100,50');
118 shouldBe('file1.width,file1.height', '60,40');
120 div
= document
.getElementById("div7");
121 var date1
= document
.getElementById("date1");
122 debug('Test case #7 : Date, Setting by JavaScript API as \"100\", \"50\"');
123 shouldBeTrue("('width' in date1)");
124 shouldBeTrue("('height' in date1)");
127 shouldBe('date1.width,date1.height', '0,0');
129 date1
.type
= 'image';
130 date1
.src
= "resources/green.jpg";
131 shouldBe('date1.width,date1.height', '100,50');
134 shouldBe('date1.width,date1.height', '60,40');
136 div
= document
.getElementById("div8");
137 var button1
= document
.getElementById("button1");
138 debug('Test case #8 : Button, Setting by JavaScript API as \"100\", \"50\"');
139 shouldBeTrue("('width' in button1)");
140 shouldBeTrue("('height' in button1)");
143 shouldBe('button1.width,button1.height', '0,0');
145 button1
.type
= 'image';
146 button1
.src
= "resources/green.jpg";
147 shouldBe('button1.width,button1.height', '100,50');
150 shouldBe('button1.width,button1.height', '60,40');
152 var successfullyParsed
= true;