From f6b5f5785ada995b9ad1e084f25bbd7f9de6bdcc Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 22 Aug 2011 16:21:57 -0400 Subject: [PATCH] Adding nested classes test and fixed specificity test runner --- test/specificity.test.js | 12 +++++------- test/specificity/nestedclasses.mss | 8 ++++++++ test/specificity/nestedclasses.result | 3 +++ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 test/specificity/nestedclasses.mss create mode 100644 test/specificity/nestedclasses.result diff --git a/test/specificity.test.js b/test/specificity.test.js index fa48e33..f690333 100644 --- a/test/specificity.test.js +++ b/test/specificity.test.js @@ -26,17 +26,15 @@ function cleanupItem(key, value) { helper.files('specificity', 'mss', function(file) { exports['test ' + file] = function(beforeExit) { helper.file(file, function(content) { - new carto.Parser({ + var tree = (new carto.Parser({ paths: [ path.dirname(file) ], filename: file - }).parse(content, function (err, tree) { - if (err) throw err; + })).parse(content); - var mss = tree.toList({}); - mss = helper.makePlain(mss, cleanupItem); + var mss = tree.toList({}); + mss = helper.makePlain(mss, cleanupItem); - helper.compareToFile(mss, file, helper.resultFile(file)); - }); + helper.compareToFile(mss, file, helper.resultFile(file)); }); } }); diff --git a/test/specificity/nestedclasses.mss b/test/specificity/nestedclasses.mss new file mode 100644 index 0000000..92925e8 --- /dev/null +++ b/test/specificity/nestedclasses.mss @@ -0,0 +1,8 @@ +.strikes { + marker-width:1; + .fill { marker-opacity:1; } + &.outline { marker-line-opacity:1; } + [ISO = "USA"] { + marker-line-opacity:0.4; + } +} diff --git a/test/specificity/nestedclasses.result b/test/specificity/nestedclasses.result new file mode 100644 index 0000000..80575ca --- /dev/null +++ b/test/specificity/nestedclasses.result @@ -0,0 +1,3 @@ +[ + {"elements":[".strikes"],"specificity":[0,1,0,13]} +]