Example #1
0
 def test_integrates_with_compass_font_url(self):
     self.mkfile(
         'static/css/font_url.scss',
         '@font-face { src: font-url("fonts/font.ttf"); }')
     self.mkfile(
         'static/css/only_path.scss',
         '@font-face { src: url(font-url("fonts/font.ttf", true)); }')
     assert_equal(
         filter('css/font_url.css'),
         b'@font-face {\n  src: url("/static/fonts/font.ttf"); }')
     assert_equal(
         filter('css/only_path.css'),
         b'@font-face {\n  src: url("/static/fonts/font.ttf"); }')
Example #2
0
 def test_integrates_static_url_with_sass(self):
     self.mkfile(
         'static/css/with_url.scss',
         'body { background: static-url("img/bg.jpg"); }')
     assert_equal(
         filter('css/with_url.css'),
         b'body {\n  background: url("/static/img/bg.jpg"); }')
Example #3
0
 def test_processes_scss_files_with_app_deps(self):
     self.mkfile('app-1/static/css/folder/_dep.scss', '$c: white;')
     self.mkfile(
         'static/css/with_app_deps.scss',
         '@import "folder/dep"; body { color: $c; }')
     assert_equal(
         filter('css/with_app_deps.css'),
         b'body {\n  color: white; }')
Example #4
0
 def test_integrates_with_compass_image_url(self):
     self.mkfile(
         'static/css/image_url.scss',
         'body { background: image-url("img/bg.jpg"); }')
     self.mkfile(
         'static/css/only_path.scss',
         'body { background: url(image-url("img/bg.jpg", true)); }')
     self.mkfile(
         'static/css/cache_buster.scss',
         'body { background: image-url("img/bg.jpg", false, true); }')
     assert_equal(
         filter('css/image_url.css'),
         b'body {\n  background: url("/static/img/bg.jpg"); }')
     assert_equal(
         filter('css/only_path.css'),
         b'body {\n  background: url("/static/img/bg.jpg"); }')
     assert_equal(
         filter('css/cache_buster.css'),
         b'body {\n  background: url("/static/img/bg.jpg"); }')
Example #5
0
 def test_uses_sass_options(self):
     settings.SASS_OPTIONS = {
         'load_paths': [os.path.join(self.root, 'additional/load/path')],
         'style': 'compressed'
     }
     self.mkfile('additional/load/path/folder/_dep.scss', '$c: white;')
     self.mkfile(
         'static/css/with_load_path_deps.scss',
         '@import "folder/dep"; body { color: $c; }')
     assert_equal(
         filter('css/with_load_path_deps.css'),
         b'body{color:#fff}')
Example #6
0
 def test_integrates_with_compass(self):
     self.mkfile(
         'static/css/with_compass.scss',
         '@import "compass"; .btn { @include border-radius(5px); }')
     assert_in(b'border-radius: 5px;', filter('css/with_compass.css'))
Example #7
0
 def test_processes_app_scss_files(self):
     self.mkfile(
         'app-1/static/css/app.scss',
         '$c: yellow; body { color: $c; }')
     assert_equal(filter('css/app.css'), b'body {\n  color: yellow; }')
Example #8
0
 def test_processes_scss_files(self):
     self.mkfile(
         'static/css/simple.scss',
         '$c: red; body { color: $c; }')
     assert_equal(filter('css/simple.css'), b'body {\n  color: red; }')
Example #9
0
 def test_raises_syntax_error(self):
     with assert_raises(SassFilterError):
         self.mkfile('static/css/syntax_error.scss', '\n\n\n\nbody {')
         filter('css/syntax_error.css')
Example #10
0
 def test_raises_syntax_error(self):
     with assert_raises(CoffeeScriptFilterError):
         self.mkfile('static/js/simple.coffee', '\n\n\n\na = foo: "1#{2}3')
         filter('js/simple.js')
Example #11
0
 def test_uses_coffee_script_options(self):
     settings.COFFEE_SCRIPT_OPTIONS = {'bare': True}
     self.mkfile('static/js/simple.coffee', 'a = foo: "1#{2}3"')
     assert_not_in(b'(function() {', filter('js/simple.js'))
Example #12
0
 def test_processes_coffee_files(self):
     self.mkfile('static/js/simple.coffee', 'a = foo: "1#{2}3"')
     assert_in(b'foo: "1" + 2 + "3"', filter('js/simple.js'))