AnsiPainter.coffee 703 B

12345678910111213141516171819202122
  1. AnsiPainter = require '../src/AnsiPainter'
  2. paint = (t) ->
  3. AnsiPainter.paint(t)
  4. describe "AnsiPainter", ->
  5. describe "paint()", ->
  6. it "should handle basic coloring", ->
  7. t = "<bg-white><black>a</black></bg-white>"
  8. paint(t).should.equal '\u001b[30m\u001b[47ma\u001b[0m'
  9. it "should handle color in color", ->
  10. t = "<red>a<blue>b</blue></red>"
  11. paint(t).should.equal '\u001b[31ma\u001b[0m\u001b[34mb\u001b[0m'
  12. it "should skip empty tags", ->
  13. t = "<blue></blue>a"
  14. paint(t).should.equal 'a\u001b[0m'
  15. describe "_replaceSpecialStrings()", ->
  16. it "should work", ->
  17. AnsiPainter::_replaceSpecialStrings('&lt;&gt;&quot;&sp;&amp;').should.equal '<>" &'