16-ignore_whitespace.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. (function () {
  2. function RunningInNode () {
  3. return(
  4. (typeof require) == "function"
  5. &&
  6. (typeof exports) == "object"
  7. &&
  8. (typeof module) == "object"
  9. &&
  10. (typeof __filename) == "string"
  11. &&
  12. (typeof __dirname) == "string"
  13. );
  14. }
  15. if (!RunningInNode()) {
  16. if (!this.Tautologistics)
  17. this.Tautologistics = {};
  18. if (!this.Tautologistics.NodeHtmlParser)
  19. this.Tautologistics.NodeHtmlParser = {};
  20. if (!this.Tautologistics.NodeHtmlParser.Tests)
  21. this.Tautologistics.NodeHtmlParser.Tests = [];
  22. exports = {};
  23. this.Tautologistics.NodeHtmlParser.Tests.push(exports);
  24. }
  25. exports.name = "Options 'ignoreWhitespace' set to 'true'";
  26. exports.options = {
  27. handler: { ignoreWhitespace: true }
  28. , parser: {}
  29. };
  30. exports.html = "Line one\n<br> \t\n<br>\nline two<font>\n <br> x </font>";
  31. exports.expected =
  32. [ { raw: 'Line one\n'
  33. , data: 'Line one\n'
  34. , type: 'text'
  35. }
  36. , { raw: 'br'
  37. , data: 'br'
  38. , type: 'tag'
  39. , name: 'br'
  40. }
  41. , { raw: 'br'
  42. , data: 'br'
  43. , type: 'tag'
  44. , name: 'br'
  45. }
  46. , { raw: '\nline two'
  47. , data: '\nline two'
  48. , type: 'text'
  49. }
  50. , { raw: 'font'
  51. , data: 'font'
  52. , type: 'tag'
  53. , name: 'font'
  54. , children:
  55. [ { raw: 'br'
  56. , data: 'br'
  57. , type: 'tag'
  58. , name: 'br'
  59. }
  60. , { raw: ' x '
  61. , data: ' x '
  62. , type: 'text'
  63. }
  64. ]
  65. }
  66. ];
  67. })();