HTMLHelpers.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. WScript.Echo("foo".anchor());
  6. WScript.Echo("foo".big());
  7. WScript.Echo("foo".blink());
  8. WScript.Echo("foo".bold());
  9. WScript.Echo("foo".fixed());
  10. WScript.Echo("foo".fontcolor("#FF00FF"));
  11. WScript.Echo("foo".fontsize(12));
  12. WScript.Echo("foo".italics());
  13. WScript.Echo("foo".small());
  14. WScript.Echo("foo".strike());
  15. WScript.Echo("foo".sub());
  16. WScript.Echo("foo".sup());
  17. WScript.Echo("foo".anchor('"')); // Should be escaped to "
  18. WScript.Echo("foo".anchor('<')); // Should not be escaped.
  19. WScript.Echo("foo".anchor('aaa"bbbccc')); // Test memcpy shortcut.
  20. WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js", "self");
  21. var wrappers = ["anchor", "big", "blink", "bold", "fixed", "fontcolor",
  22. "fontsize", "italics", "small", "strike", "sub", "sup"];
  23. var tests = {
  24. test01: {
  25. name: "Check that String.prototype.x.call throws a TypeError on null or undefined ",
  26. body: function () {
  27. for (var i in wrappers) {
  28. helpers.writeln("trying: ", wrappers[i], ": String.prototype." + wrappers[i] + ".call");
  29. assert.throws(function () { eval("String.prototype." + wrappers[i] + ".call(null);") }, TypeError);
  30. assert.throws(function () { eval("String.prototype." + wrappers[i] + ".call(undefined);") }, TypeError);
  31. }
  32. }
  33. }
  34. }
  35. testRunner.runTests(tests);