01-basic.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 = "Basic test";
  26. exports.html = "<html><title>The Title</title><body>Hello world</body></html>";
  27. exports.expected =
  28. [ { raw: 'html'
  29. , data: 'html'
  30. , type: 'tag'
  31. , name: 'html'
  32. , children:
  33. [ { raw: 'title'
  34. , data: 'title'
  35. , type: 'tag'
  36. , name: 'title'
  37. , children: [ { raw: 'The Title', data: 'The Title', type: 'text' } ]
  38. }
  39. , { raw: 'body'
  40. , data: 'body'
  41. , type: 'tag'
  42. , name: 'body'
  43. , children:
  44. [ { raw: 'Hello world'
  45. , data: 'Hello world'
  46. , type: 'text'
  47. }
  48. ]
  49. }
  50. ]
  51. }
  52. ];
  53. })();