Browse Source

Add a test for the SassyCSS plugin.

main
Elliott Sales de Andrade 12 years ago
committed by Lakshmi Vyasarajan
parent
commit
876febcf84
6 changed files with 97 additions and 0 deletions
  1. +19
    -0
      hyde/tests/ext/scss/expected-site.css
  2. +6
    -0
      hyde/tests/ext/scss/inc/mixin.scss
  3. +6
    -0
      hyde/tests/ext/scss/inc/reset.css
  4. +3
    -0
      hyde/tests/ext/scss/inc/vars.scss
  5. +20
    -0
      hyde/tests/ext/scss/site.scss
  6. +43
    -0
      hyde/tests/ext/test_scss.py

+ 19
- 0
hyde/tests/ext/scss/expected-site.css View File

@@ -0,0 +1,19 @@
* {
border: 0;
padding: 0;
margin: 0;
}
#header {
color: #333333;
border-left: 1px;
border-right: 2px;
}
#footer {
color: #333333;
}
#content {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}


+ 6
- 0
hyde/tests/ext/scss/inc/mixin.scss View File

@@ -0,0 +1,6 @@
@mixin rounded ($radius: 5px){
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
border-radius: $radius;
}


+ 6
- 0
hyde/tests/ext/scss/inc/reset.css View File

@@ -0,0 +1,6 @@
* {
border: 0;
padding: 0;
margin: 0;
}


+ 3
- 0
hyde/tests/ext/scss/inc/vars.scss View File

@@ -0,0 +1,3 @@
$the-border: 1px;
$base-color: #111;


+ 20
- 0
hyde/tests/ext/scss/site.scss View File

@@ -0,0 +1,20 @@
@option compress: no;

@import "inc/mixin";
@import "inc/vars";
@import "inc/reset.css";

#header {
color: $base-color * 3;
border-left: $the-border;
border-right: $the-border * 2;
}

#footer {
color: ($base-color + #111) * 1.5;
}

#content {
@include rounded(10px);
}


+ 43
- 0
hyde/tests/ext/test_scss.py View File

@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from hyde.fs import File, Folder
from hyde.model import Expando
from hyde.generator import Generator
from hyde.site import Site

SCSS_SOURCE = File(__file__).parent.child_folder('scss')
TEST_SITE = File(__file__).parent.parent.child_folder('_test')


class TestSassyCSS(object):

def setUp(self):
TEST_SITE.make()
TEST_SITE.parent.child_folder(
'sites/test_jinja').copy_contents_to(TEST_SITE)
SCSS_SOURCE.copy_contents_to(TEST_SITE.child('content/media/css'))
File(TEST_SITE.child('content/media/css/site.css')).delete()


def tearDown(self):
TEST_SITE.delete()

def test_scss(self):
s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.css.SassyCSSPlugin']
source = TEST_SITE.child('content/media/css/site.scss')
target = File(Folder(s.config.deploy_root_path).child('media/css/site.css'))
gen = Generator(s)
gen.generate_resource_at_path(source)

assert target.exists
text = target.read_all()
expected_text = File(SCSS_SOURCE.child('expected-site.css')).read_all()

assert text == expected_text
return


Loading…
Cancel
Save