01-basic.js 1.3 KB

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