1
# -*- coding: iso-8859-1 -*-
3
MoinMoin - MoinMoin.widget.html Tests
5
@copyright: 2003-2004 by Juergen Hermann <jh@web.de>
6
@license: GNU GPL, see COPYING for details.
11
from MoinMoin.widget import html
13
class TestHTMLWidgets:
14
"""widget.html: testing html widgets"""
17
"""widget.html: creating html widgets
19
TO DO: add tests for all elements by HTML 4 spec.
22
# description, call, expected
23
('Create text', html.Text('<br> &'), '<br> &'),
24
('Create raw html', html.Raw('<br> &'), '<br> &'),
25
('Create br', html.BR(), '<br>'),
26
('Create hr', html.HR(), '<hr>'),
27
('Create p', html.P(), '<p></p>'),
30
for description, obj, expected in tests:
32
assert result == expected
34
def testInvalidAttributes(self):
35
"""widget.html: invalid attributes raises exception
37
TO DO: add tests for all elements by HTML 4 spec.
39
py.test.raises(AttributeError, html.BR, name='foo')
42
def testCompositeElements(self):
43
"""widget.html: append to and extend composite element"""
48
# action, data, expected
51
'<p>Text & </p>'),
53
html.Text('more text. '),
54
'<p>Text & more text. </p>'),
56
(html.Text('And then '), html.Text('some.')),
57
'<p>Text & more text. And then some.</p>'),
60
for action, data, expected in actions:
62
result = unicode(element)
63
assert result == expected
65
coverage_modules = ['MoinMoin.widget.html']