RenderKid = require '../src/RenderKid'
{strip} = require '../src/AnsiPainter'
match = (input, expected, setStuff) ->
r = new RenderKid
r.style
span:
display: 'inline'
div:
display: 'block'
setStuff?(r)
strip(r.render(input)).trim().should.equal expected.trim()
describe "RenderKid", ->
describe "constructor()", ->
it "should work", ->
new RenderKid
describe "whitespace management - inline", ->
it "shouldn't put extra whitespaces", ->
input = """
abc
"""
expected = """
abc
"""
match input, expected
it "should allow 1 whitespace character on each side", ->
input = """
a b c
"""
expected = """
a b c
"""
match input, expected
it "should eliminate extra whitespaces inside text", ->
input = """
ab1 \n b2c
"""
expected = """
ab1 b2c
"""
match input, expected
it "should allow line breaks with
", ->
input = """
ab1
b2c
"""
expected = """
ab1\nb2c
"""
match input, expected
it "should allow line breaks with &nl;", ->
input = """
ab1&nl;b2c
"""
expected = """
ab1\nb2c
"""
match input, expected
it "should allow whitespaces with &sp;", ->
input = """
ab1&sp;b2c
"""
expected = """
ab1 b2c
"""
match input, expected
describe "whitespace management - block", ->
it "should add one linebreak between two blocks", ->
input = """