-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
368 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
from dominate import document | ||
from dominate.tags import * | ||
|
||
def test_doc(): | ||
d = document() | ||
assert d.render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dominate</title> | ||
</head> | ||
<body></body> | ||
</html>''' | ||
|
||
|
||
def test_decorator(): | ||
@document() | ||
def foo(): | ||
p('Hello World') | ||
|
||
f = foo() | ||
assert f.render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dominate</title> | ||
</head> | ||
<body> | ||
<p>Hello World</p> | ||
</body> | ||
</html>''' | ||
|
||
|
||
def test_bare_decorator(): | ||
@document | ||
def foo(): | ||
p('Hello World') | ||
|
||
assert foo().render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dominate</title> | ||
</head> | ||
<body> | ||
<p>Hello World</p> | ||
</body> | ||
</html>''' | ||
|
||
|
||
def test_title(): | ||
d = document() | ||
assert d.title == 'Dominate' | ||
|
||
d = document(title='foobar') | ||
assert d.title == 'foobar' | ||
|
||
d.title = 'baz' | ||
assert d.title == 'baz' | ||
|
||
d.title = title('bar') | ||
assert d.title == 'bar' | ||
|
||
assert d.render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>bar</title> | ||
</head> | ||
<body></body> | ||
</html>''' | ||
|
||
|
||
if __name__ == '__main__': | ||
# test_doc() | ||
test_decorator() | ||
from dominate import document | ||
from dominate.tags import * | ||
|
||
def test_doc(): | ||
d = document() | ||
assert d.render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dominate</title> | ||
</head> | ||
<body></body> | ||
</html>''' | ||
|
||
|
||
def test_decorator(): | ||
@document() | ||
def foo(): | ||
p('Hello World') | ||
|
||
f = foo() | ||
assert f.render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dominate</title> | ||
</head> | ||
<body> | ||
<p>Hello World</p> | ||
</body> | ||
</html>''' | ||
|
||
|
||
def test_bare_decorator(): | ||
@document | ||
def foo(): | ||
p('Hello World') | ||
|
||
assert foo().render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dominate</title> | ||
</head> | ||
<body> | ||
<p>Hello World</p> | ||
</body> | ||
</html>''' | ||
|
||
|
||
def test_title(): | ||
d = document() | ||
assert d.title == 'Dominate' | ||
|
||
d = document(title='foobar') | ||
assert d.title == 'foobar' | ||
|
||
d.title = 'baz' | ||
assert d.title == 'baz' | ||
|
||
d.title = title('bar') | ||
assert d.title == 'bar' | ||
|
||
assert d.render() == \ | ||
'''<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>bar</title> | ||
</head> | ||
<body></body> | ||
</html>''' | ||
|
||
|
||
if __name__ == '__main__': | ||
# test_doc() | ||
test_decorator() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
from dominate.tags import * | ||
|
||
def test_dom(): | ||
container = div() | ||
with container.add(div(id='base')) as dom: | ||
s1 = span('Hello', id='span1') | ||
s2 = span('World', id='span2') | ||
|
||
s3 = span('foobar', id='span3') | ||
dom.appendChild(s3) | ||
|
||
assert container.getElementById('base') is dom | ||
assert container.getElementById('span1') is s1 | ||
assert container.getElementById('span3') is s3 | ||
assert container.getElementsByTagName('span') == [s1, s2, s3] | ||
assert container.getElementsByTagName('SPAN') == [s1, s2, s3] | ||
from dominate.tags import * | ||
|
||
def test_dom(): | ||
container = div() | ||
with container.add(div(id='base')) as dom: | ||
s1 = span('Hello', id='span1') | ||
s2 = span('World', id='span2') | ||
|
||
s3 = span('foobar', id='span3') | ||
dom.appendChild(s3) | ||
|
||
assert container.getElementById('base') is dom | ||
assert container.getElementById('span1') is s1 | ||
assert container.getElementById('span3') is s3 | ||
assert container.getElementsByTagName('span') == [s1, s2, s3] | ||
assert container.getElementsByTagName('SPAN') == [s1, s2, s3] |
Oops, something went wrong.