case.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // default to uppercase
  2. require(__dirname).test
  3. ( { xml :
  4. "<span class=\"test\" hello=\"world\"></span>"
  5. , expect :
  6. [ [ "attribute", { name: "CLASS", value: "test" } ]
  7. , [ "attribute", { name: "HELLO", value: "world" } ]
  8. , [ "opentag", { name: "SPAN",
  9. attributes: { CLASS: "test", HELLO: "world" },
  10. isSelfClosing: false } ]
  11. , [ "closetag", "SPAN" ]
  12. ]
  13. , strict : false
  14. , opt : {}
  15. }
  16. )
  17. // lowercase option : lowercase tag/attribute names
  18. require(__dirname).test
  19. ( { xml :
  20. "<span class=\"test\" hello=\"world\"></span>"
  21. , expect :
  22. [ [ "attribute", { name: "class", value: "test" } ]
  23. , [ "attribute", { name: "hello", value: "world" } ]
  24. , [ "opentag", { name: "span",
  25. attributes: { class: "test", hello: "world" },
  26. isSelfClosing: false } ]
  27. , [ "closetag", "span" ]
  28. ]
  29. , strict : false
  30. , opt : {lowercase:true}
  31. }
  32. )
  33. // backward compatibility with old lowercasetags opt
  34. require(__dirname).test
  35. ( { xml :
  36. "<span class=\"test\" hello=\"world\"></span>"
  37. , expect :
  38. [ [ "attribute", { name: "class", value: "test" } ]
  39. , [ "attribute", { name: "hello", value: "world" } ]
  40. , [ "opentag", { name: "span",
  41. attributes: { class: "test", hello: "world" },
  42. isSelfClosing: false } ]
  43. , [ "closetag", "span" ]
  44. ]
  45. , strict : false
  46. , opt : {lowercasetags:true}
  47. }
  48. )