项目原始demo,不改动
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

22 lines
703 B

  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 '<>" &'