Skip to content
Browse files

add test case for media queries

  • Loading branch information...
1 parent dd22836 commit 8d060c9816c43a0da1cc09c850846b9901320d6a @revolunet committed Jan 3, 2012
Showing with 38 additions and 0 deletions.
  1. +38 −0 premailer/test_premailer.py
View
38 premailer/test_premailer.py
@@ -630,3 +630,41 @@ def test_last_child_exclude_pseudo():
result_html = whitespace_between_tags.sub('><', result_html).strip()
eq_(expect_html, result_html)
+
+
+def test_mediaquery():
+ html = """<html>
+ <head>
+ <style type="text/css">
+ div {
+ text-align: right;
+ }
+ @media print{
+ div {
+ text-align: center;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <div>First div</div>
+ </body>
+ </html>"""
+
+ expect_html = """<html>
+ <head>
+ </head>
+ <body>
+ <div style="text-align:right" align="right">First div</div>
+ </body>
+ </html>"""
+
+ p = Premailer(html)
+ result_html = p.transform()
+
+ whitespace_between_tags = re.compile('>\s*<',)
+
+ expect_html = whitespace_between_tags.sub('><', expect_html).strip()
+ result_html = whitespace_between_tags.sub('><', result_html).strip()
+
+ eq_(expect_html, result_html)

0 comments on commit 8d060c9

Please sign in to comment.
Something went wrong with that request. Please try again.