tools.coffee 635 B

12345678910111213141516171819
  1. tools = require '../src/tools'
  2. describe "tools", ->
  3. describe "quote()", ->
  4. it "should convert html special strings to their entities", ->
  5. tools.quote(" abc<>\"\n")
  6. .should.equal '&sp;abc&lt;&gt;&quot;<br />'
  7. describe "stringToDom()", ->
  8. it "should work", ->
  9. tools.stringToDom('<a> text<a1>text</a1> text <a2>text</a2><a3>text</a3>text</a>text')
  10. describe "objectToDom()", ->
  11. it "should work", ->
  12. tools.objectToDom({a: 'text'})
  13. it "should have quoted text nodes", ->
  14. tools.objectToDom({a: '&<> "'}).should.have.deep
  15. .property '[0].children[0].data', '&amp;&lt;&gt;&sp;&quot;'