版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

75 строки
3.1 KiB

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var util_1 = require("util");
  4. var _1 = require(".");
  5. /**
  6. * Based on https://github.com/gouch/to-title-case/blob/master/test/tests.json.
  7. */
  8. var TEST_CASES = [
  9. ["", ""],
  10. ["2019", "2019"],
  11. ["test", "Test"],
  12. ["two words", "Two Words"],
  13. ["one. two.", "One. Two."],
  14. ["a small word starts", "A Small Word Starts"],
  15. ["small word ends on", "Small Word Ends On"],
  16. ["we keep NASA capitalized", "We Keep NASA Capitalized"],
  17. ["pass camelCase through", "Pass camelCase Through"],
  18. ["follow step-by-step instructions", "Follow Step-by-Step Instructions"],
  19. ["your hair[cut] looks (nice)", "Your Hair[cut] Looks (Nice)"],
  20. ["leave Q&A unscathed", "Leave Q&A Unscathed"],
  21. [
  22. "piña colada while you listen to ænima",
  23. "Piña Colada While You Listen to Ænima",
  24. ],
  25. ["start title – end title", "Start Title – End Title"],
  26. ["start title–end title", "Start Title–End Title"],
  27. ["start title — end title", "Start Title — End Title"],
  28. ["start title—end title", "Start Title—End Title"],
  29. ["start title - end title", "Start Title - End Title"],
  30. ["don't break", "Don't Break"],
  31. ['"double quotes"', '"Double Quotes"'],
  32. ['double quotes "inner" word', 'Double Quotes "Inner" Word'],
  33. ["fancy double quotes “inner” word", "Fancy Double Quotes “Inner” Word"],
  34. ["have you read “The Lottery”?", "Have You Read “The Lottery”?"],
  35. ["one: two", "One: Two"],
  36. ["one two: three four", "One Two: Three Four"],
  37. ['one two: "Three Four"', 'One Two: "Three Four"'],
  38. ["email email@example.com address", "Email email@example.com Address"],
  39. [
  40. "you have an https://example.com/ title",
  41. "You Have an https://example.com/ Title",
  42. ],
  43. ["_underscores around words_", "_Underscores Around Words_"],
  44. ["*asterisks around words*", "*Asterisks Around Words*"],
  45. ["this vs. that", "This vs. That"],
  46. ["this vs that", "This vs That"],
  47. ["this v. that", "This v. That"],
  48. ["this v that", "This v That"],
  49. [
  50. "Scott Moritz and TheStreet.com’s million iPhone la-la land",
  51. "Scott Moritz and TheStreet.com’s Million iPhone La-La Land",
  52. ],
  53. [
  54. "Notes and observations regarding Apple’s announcements from ‘The Beat Goes On’ special event",
  55. "Notes and Observations Regarding Apple’s Announcements From ‘The Beat Goes On’ Special Event",
  56. ],
  57. [
  58. "the quick brown fox jumps over the lazy dog",
  59. "The Quick Brown Fox Jumps over the Lazy Dog",
  60. ],
  61. ["newcastle upon tyne", "Newcastle upon Tyne"],
  62. ["newcastle *upon* tyne", "Newcastle *upon* Tyne"],
  63. ];
  64. describe("swap case", function () {
  65. var _loop_1 = function (input, result) {
  66. it(util_1.inspect(input) + " -> " + util_1.inspect(result), function () {
  67. expect(_1.titleCase(input)).toEqual(result);
  68. });
  69. };
  70. for (var _i = 0, TEST_CASES_1 = TEST_CASES; _i < TEST_CASES_1.length; _i++) {
  71. var _a = TEST_CASES_1[_i], input = _a[0], result = _a[1];
  72. _loop_1(input, result);
  73. }
  74. });
  75. //# sourceMappingURL=index.spec.js.map