def test_render_div(): assert render_layout( ['div', {}, []]) == ['div', { 'div_char': u' ', 'top': 0, 'bottom': 0, }]
def test_text_tag(layout): el = render_layout(layout) assert el == [ 'text', { 'markup': 'hello world', 'align': 'left', 'wrap': 'space', } ]
def test_text_tag_with_self_ref(layout): layout[2] = '{ title }' el = render_layout(layout, {}, {'title': 'hello world'}) assert el == [ 'text', { 'markup': 'hello world', 'align': 'left', 'wrap': 'space', } ]
def test_padding_align_twenty_percentage(): el = render_layout([ 'text', { 'style': 'padding-align: 20%', }, u'text', ]) assert el assert el.render((10, )).text == [' text ']
def test_padding_align_center(): el = render_layout([ 'text', { 'style': 'padding-align: center', }, u'text', ]) assert el assert el.render((10, )).text == [' text ']
def test_padding_left(): el = render_layout([ 'text', { 'style': 'padding-left: 2', }, u'text', ]) assert el assert el.render((6, )).text == [' text']
def test_render_div_with_div_char(): el = render_layout(['div', { 'char': u'-', 'top': 1, 'bottom': 1 }, []]) == ['div', { 'div_char': u'-', 'top': 1, 'bottom': 1, }]
def test_render_div(): assert render_layout([ 'div', {}, [] ]) == [ 'div', { 'div_char': u' ', 'top': 0, 'bottom': 0, } ]
def test_text_tag_with_opts_ref(layout): opts = {'title': 'hello world'} layout[2] = '{ opts.title }' el = render_layout(layout, opts) assert el == [ 'text', { 'markup': 'hello world', 'align': 'left', 'wrap': 'space', } ]
def test_text_tag_with_attr_ref(layout): layout[1]['title'] = 'hello world' layout[2] = '{ opts.title }' el = render_layout(layout) assert el == [ 'text', { 'markup': 'hello world', 'align': 'left', 'wrap': 'space', } ]
def test_padding_width(): el = render_layout([ 'text', { 'style': 'padding-width: 2', }, u'text', ]) assert el assert el.render((3, )).text == [ 'te ', 'xt ', ]
def test_padding_width_relative(): el = render_layout([ 'text', { 'style': 'padding-width: 20%', }, u'abc', ]) assert el assert el.render((10, )).text == [ 'ab ', 'c ', ]
def test_padding_width_pack(): el = render_layout([ 'text', { 'style': 'padding-width: pack', }, u'text\nlatex', ]) assert el assert el.render((6, )).text == [ ' text', 'latex', ]
def test_render_div_with_div_char(): el = render_layout([ 'div', { 'char': u'-', 'top': 1, 'bottom': 1 }, [] ]) == [ 'div', { 'div_char': u'-', 'top': 1, 'bottom': 1, } ]
def test_render_div_with_opts(): assert render_layout([ 'div', { 'char': '{ opts.custom_char }', 'top': '{ opts.custom_top }', 'bottom': '{ opts.custom_bottom }', }, [] ], { 'custom_char': u'x', 'custom_top': '1', 'custom_bottom': '1', }) == ['div', { 'div_char': u'x', 'top': 1, 'bottom': 1, }]
def test_render_div_with_opts(): assert render_layout([ 'div', { 'char': '{ opts.custom_char }', 'top': '{ opts.custom_top }', 'bottom': '{ opts.custom_bottom }', }, [] ], { 'custom_char': u'x', 'custom_top': '1', 'custom_bottom': '1', }) == [ 'div', { 'div_char': u'x', 'top': 1, 'bottom': 1, } ]