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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/images/script-tests/border.js

Issue 2228333003: Use testharness.js in fast/images/ for border/cmyk tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use testharness.js in fast/images/ - [2]. Created 4 years, 4 months 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
1 description(
2 "This tests the HTMLImageElement border property."
3 );
4 1
5 function imageBorderWidth(borderValue, style) 2 function imageBorderWidth(borderValue, style)
6 { 3 {
Srirama 2016/08/10 14:18:03 nit: move the brace to previous line for consisten
sivag 2016/08/10 14:37:11 Done.
7 var image = document.createElement("img"); 4 var image = document.createElement("img");
8 if (borderValue !== undefined) 5 if (borderValue !== undefined)
9 image.setAttribute("border", borderValue); 6 image.setAttribute("border", borderValue);
10 image.setAttribute("style", style); 7 image.setAttribute("style", style);
11 image.setAttribute("width", "0"); 8 image.setAttribute("width", "0");
12 document.body.appendChild(image); 9 document.body.appendChild(image);
13 var borderBoxWidth = image.offsetWidth; 10 var borderBoxWidth = image.offsetWidth;
14 document.body.removeChild(image); 11 document.body.removeChild(image);
15 return borderBoxWidth / 2; 12 return borderBoxWidth / 2;
16 } 13 }
17 14
18 shouldBe("imageBorderWidth()", "0"); 15 test(function() {
19 shouldBe("imageBorderWidth(null)", "0"); 16 assert_equals(imageBorderWidth(), 0);
20 shouldBe("imageBorderWidth('')", "0"); 17 assert_equals(imageBorderWidth(null), 0);
21 shouldBe("imageBorderWidth(0)", "0"); 18 assert_equals(imageBorderWidth(''), 0);
22 shouldBe("imageBorderWidth('x')", "0"); 19 assert_equals(imageBorderWidth(0), 0);
23 shouldBe("imageBorderWidth(undefined, 'border-width: 20px')", "0"); 20 assert_equals(imageBorderWidth('x'), 0);
21 assert_equals(imageBorderWidth(undefined, 'border-width: 20px'), 0);
24 22
25 shouldBe("imageBorderWidth(null, 'border-width: 20px')", "20"); 23 assert_equals(imageBorderWidth(null, 'border-width: 20px'), 20);
26 shouldBe("imageBorderWidth('', 'border-width: 20px')", "20"); 24 assert_equals(imageBorderWidth('', 'border-width: 20px'), 20);
27 shouldBe("imageBorderWidth('x', 'border-width: 20px')", "20"); 25 assert_equals(imageBorderWidth('x', 'border-width: 20px'), 20);
28 shouldBe("imageBorderWidth(0, 'border-width: 20px')", "20"); 26 assert_equals(imageBorderWidth(0, 'border-width: 20px'), 20);
29 27
30 shouldBe("imageBorderWidth(10)", "10"); 28 assert_equals(imageBorderWidth(10), 10);
31 shouldBe("imageBorderWidth(' 10')", "10"); 29 assert_equals(imageBorderWidth(' 10'), 10);
32 shouldBe("imageBorderWidth('10 ')", "10"); 30 assert_equals(imageBorderWidth('10 '), 10);
33 shouldBe("imageBorderWidth(' 10 ')", "10"); 31 assert_equals(imageBorderWidth(' 10 '), 10);
34 shouldBe("imageBorderWidth('10q')", "10"); 32 assert_equals(imageBorderWidth('10q'), 10);
35 shouldBe("imageBorderWidth(' 10q')", "10"); 33 assert_equals(imageBorderWidth(' 10q'), 10);
36 shouldBe("imageBorderWidth('10q ')", "10"); 34 assert_equals(imageBorderWidth('10q '), 10);
37 shouldBe("imageBorderWidth(' 10q ')", "10"); 35 assert_equals(imageBorderWidth(' 10q '), 10);
36 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698