| OLD | NEW |
| (Empty) |
| 1 import unittest | |
| 2 | |
| 3 from scss.parser import Stylesheet | |
| 4 | |
| 5 | |
| 6 class TestSCSS( unittest.TestCase ): | |
| 7 | |
| 8 def setUp(self): | |
| 9 self.parser = Stylesheet() | |
| 10 | |
| 11 def test_default(self): | |
| 12 src = """ | |
| 13 @option compress:false; | |
| 14 // SCSS comment | |
| 15 /* CSS Comment */ | |
| 16 #navbar { | |
| 17 height: 100px; | |
| 18 color: #ff0033; | |
| 19 border: 2px solid magenta; | |
| 20 @warn "Test"; | |
| 21 | |
| 22 li { | |
| 23 background-color: red - #333; | |
| 24 float: left; | |
| 25 font: 8px/10px verdana; | |
| 26 margin: 3px + 5.5px auto; | |
| 27 height: 5px + (4px * 2); | |
| 28 } | |
| 29 } | |
| 30 """ | |
| 31 test = "/* CSS Comment */\n#navbar {\n\theight: 100px;\n\tborder: 2px so
lid #f0f;\n\tcolor: #f03;}\n\n#navbar li {\n\tfloat: left;\n\tmargin: 8.5px auto
;\n\theight: 13px;\n\tbackground-color: #c00;\n\tfont: 8px / 10px verdana;}\n\n" | |
| 32 out = self.parser.loads(src) | |
| 33 self.assertEqual(test, out) | |
| 34 | |
| 35 def test_compress(self): | |
| 36 src = """ | |
| 37 @option compress:true; | |
| 38 // SCSS comment | |
| 39 /* CSS Comment */ | |
| 40 #navbar, p { | |
| 41 height: 100px; | |
| 42 color: #ff0033; | |
| 43 border: 2px solid magenta; | |
| 44 | |
| 45 li { | |
| 46 background-color: red - #333; | |
| 47 float: left; | |
| 48 font: 8px/10px verdana; | |
| 49 margin: 3px + 5.5px auto; | |
| 50 height: 5px + (4px * 2); | |
| 51 } | |
| 52 } | |
| 53 """ | |
| 54 test = "#navbar, p{height:100px;border:2px solid #f0f;color:#f03}#navbar
li, p li{float:left;margin:8.5px auto;height:13px;background-color:#c00;font:8p
x / 10px verdana}" | |
| 55 out = self.parser.loads(src) | |
| 56 self.assertEqual(test, out) | |
| 57 | |
| 58 def test_comments(self): | |
| 59 src = """ | |
| 60 @option comments:false, compress: false; | |
| 61 // SCSS comment | |
| 62 /* CSS Comment */ | |
| 63 #navbar, p { | |
| 64 height: 100px; | |
| 65 color: #ff0033; | |
| 66 border: 2px solid magenta; | |
| 67 | |
| 68 li { | |
| 69 background-color: red - #333; | |
| 70 float: left; | |
| 71 font: 8px/10px verdana; | |
| 72 margin: 3px + 5.5px auto; | |
| 73 height: 5px + (4px * 2); | |
| 74 } | |
| 75 } | |
| 76 """ | |
| 77 test = "#navbar, p {\n\theight: 100px;\n\tborder: 2px solid #f0f;\n\tcol
or: #f03;}\n\n#navbar li, p li {\n\tfloat: left;\n\tmargin: 8.5px auto;\n\theigh
t: 13px;\n\tbackground-color: #c00;\n\tfont: 8px / 10px verdana;}\n\n" | |
| 78 out = self.parser.loads(src) | |
| 79 self.assertEqual(test, out) | |
| 80 | |
| 81 def test_sortings(self): | |
| 82 src = """ | |
| 83 @option comments:true, compress: false, sort: false; | |
| 84 // SCSS comment | |
| 85 /* CSS Comment */ | |
| 86 #navbar, p { | |
| 87 height: 100px; | |
| 88 color: #ff0033; | |
| 89 border: 2px solid magenta; | |
| 90 | |
| 91 li { | |
| 92 background-color: red - #333; | |
| 93 float: left; | |
| 94 font: 8px/10px verdana; | |
| 95 margin: 3px + 5.5px auto; | |
| 96 height: 5px + (4px * 2); | |
| 97 } | |
| 98 } | |
| 99 """ | |
| 100 test = "/* CSS Comment */\n#navbar, p {\n\theight: 100px;\n\tcolor: #f03
;\n\tborder: 2px solid #f0f;}\n\n#navbar li, p li {\n\tbackground-color: #c00;\n
\tfloat: left;\n\tfont: 8px / 10px verdana;\n\tmargin: 8.5px auto;\n\theight: 13
px;}\n\n" | |
| 101 out = self.parser.loads(src) | |
| 102 self.assertEqual(test, out) | |
| OLD | NEW |