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

Unified Diff: test/webkit/fast/js/string-fontsize.js

Issue 21070002: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/webkit/fast/js/string-fontcolor-expected.txt ('k') | test/webkit/fast/js/string-fontsize-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/fast/js/string-fontsize.js
diff --git a/test/webkit/fast/js/object-prototype-constructor.js b/test/webkit/fast/js/string-fontsize.js
similarity index 55%
copy from test/webkit/fast/js/object-prototype-constructor.js
copy to test/webkit/fast/js/string-fontsize.js
index d3031ae106a4b27823bf9f22572bd0d4dbbb3c20..e103e5e6bc2c9eb74ef6c32ea2bfb86eca90fe73 100644
--- a/test/webkit/fast/js/object-prototype-constructor.js
+++ b/test/webkit/fast/js/string-fontsize.js
@@ -22,21 +22,35 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-'This is a test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=3537">bug 3537</a>.'
+'This is a test case for String.prototype.fontsize(size).'
);
-var Foo = { Bar: function () {}};
-var f = new Foo.Bar();
-shouldBe("f.constructor", "Foo.Bar");
-shouldBe("typeof f.constructor", '"function"');
-
-function F() {};
-var Foo2 = { Bar: F};
-var f2 = new Foo2.Bar();
-shouldBe("f2.constructor", "Foo2.Bar");
-shouldBe("typeof f2.constructor", '"function"');
-
-var Foo3 = { Bar: new Function("")};
-var f3 = new Foo3.Bar();
-shouldBe("f3.constructor", "Foo3.Bar");
-shouldBe("typeof f3.constructor", '"function"');
+// This test is based on http://mathias.html5.org/tests/javascript/string/.
+
+// Check that the quotation mark is correctly escaped.
+shouldBe("'_'.fontsize('\"')", '"<font size=\\"&quot;\\">_</font>"');
+
+// Simple case.
+shouldBe("'_'.fontsize('b')", '"<font size=\\"b\\">_</font>"');
+
+// Does not escape special characters in `this` value.
+shouldBe("'<'.fontsize('b')", '"<font size=\\"b\\"><</font>"');
+
+// First argument gets ToString()ed.
+shouldBe("'_'.fontsize(0x2A)", '"<font size=\\"42\\">_</font>"');
+
+// Check that the quotation mark is correctly escaped.
+shouldBe("'_'.fontsize('\"')", '"<font size=\\"&quot;\\">_</font>"');
+shouldBe("'_'.fontsize('\" color=\"b')", '"<font size=\\"&quot; color=&quot;b\\">_</font>"');
+
+// Generic use on Number object.
+shouldBe("String.prototype.fontsize.call(0x2A, 0x2A)", '"<font size=\\"42\\">42</font>"');
+
+// Generic use on non-coercible object `undefined`.
+shouldThrow("String.prototype.fontsize.call(undefined)", '"TypeError: Type error"');
+
+// Generic use on non-coercible object `null`.
+shouldThrow("String.prototype.fontsize.call(null)", '"TypeError: Type error"');
+
+// Check fontsize.length.
+shouldBe("String.prototype.fontsize.length", "1");
« no previous file with comments | « test/webkit/fast/js/string-fontcolor-expected.txt ('k') | test/webkit/fast/js/string-fontsize-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698