var assert = require('assert');
var StyleStats = require('../lib/stylestats.js');

describe('StyleStats!', function() {
    var stats = new StyleStats('test/fixture/test.css');
    var statsResult;
    before(function() {
        stats.parse(function(result) {
            statsResult = result;
        });
    });
    it('should returns stylesheets', function() {
        assert.equal(statsResult.stylesheets, 1);
    });
    it('should returns file size', function() {
        assert.equal(statsResult.size, 753);
    });
    it('should returns data URI size', function() {
        assert.equal(statsResult.dataUriSize, 82);
    });
    it('should returns raito of data URI size', function() {
        assert.equal(statsResult.raitoOfDataUriSize, 0.10889774236387782);
    });
    it('should returns css rules', function() {
        assert.equal(statsResult.rules, 10);
    });
    it('should returns css selectors', function() {
        assert.equal(statsResult.selectors, 15);
    });
    it('should returns simplicity', function() {
        assert.equal(statsResult.simplicity, 0.6666666666666666);
    });
    it('should returns most identifers', function() {
        assert.equal(statsResult.mostIdentifers, 5);
    });
    it('should returns most identifers selector', function() {
        assert.equal(statsResult.mostIdentifersSelector, '.foo  .bar > .baz + .qux ~ .quux:before');
    });
    it('should returns lowest cohesion', function() {
        assert.equal(statsResult.lowestCohesion, 8);
    });
    it('should returns lowest cohesion selector', function() {
        assert.equal(statsResult.lowestCohesionSelector, 'hr');
    });
    it('should returns total unique font sizes', function() {
        assert.equal(statsResult.totalUniqueFontSizes, 5);
    });
    it('should returns total unique colors', function() {
        assert.equal(statsResult.totalUniqueColors, 2);
    });
    it('should returns id selectors', function() {
        assert.equal(statsResult.idSelectors, 1);
    });
    it('should returns universal selectors', function() {
        assert.equal(statsResult.universalSelectors, 1);
    });
    it('should returns unqualified attribute selectors', function() {
        assert.equal(statsResult.unqualifiedAttributeSelectors, 1);
    });
    it('should returns JavaScript specific selectors', function() {
        assert.equal(statsResult.javascriptSpecificSelectors, 1);
    });
    it('should returns important keywords', function() {
        assert.equal(statsResult.importantKeywords, 1);
    });
    it('should returns float properties', function() {
        assert.equal(statsResult.floatProperties, 1);
    });
    it('should returns media queries"', function() {
        assert.equal(statsResult.mediaQueries, 1);
    });
});

describe('Custom StyleStats!', function() {
    it('should returns gzipped size', function() {
        var customStats = new StyleStats('test/fixture/test.css', 'test/fixture/.stylestatsrc');
        customStats.parse(function(customResult) {
            assert.equal(customResult.gzippedSize, 217);
        });
    });
});

describe('Custom Object StyleStats!', function() {
    it('should returns gzipped size', function() {
        var configObj = {
            gzippedSize: true
        };
        var customObjectStats = new StyleStats('test/fixture/test.css', configObj);
        customObjectStats.parse(function(customObjectResult) {
            assert.equal(customObjectResult.gzippedSize, 217);
        });
    });
});


describe('Remote Pattern StyleStats!', function() {
    it('should returns file size', function() {
        var requestStats = new StyleStats('http://t32k.me/static/blog/skelton.css?query');
        requestStats.parse(function(requestResult) {
            assert.equal(requestResult.size, 15419);
        });
    });
});

describe('Directory Pattern StyleStats!', function() {
    it('should returns file size', function() {
        var dirStats = new StyleStats('test/fixture/');
        dirStats.parse(function(dirResult) {
            assert.equal(dirResult.size, 20462);
        });
    });
});

describe('Glob Pattern StyleStats!', function() {
    it('should returns file size', function() {
        var globStats = new StyleStats('test/**/*.css');
        globStats.parse(function(globResult) {
            assert.equal(globResult.size, 39931);
        });
    });
});

describe('Multiple Files StyleStats!', function() {
    it('should returns file size', function() {
        var multipleStats = new StyleStats(['test/fixture/test.css', 'test/fixture/app.css']);
        multipleStats.parse(function(multipleResult) {
            assert.equal(multipleResult.stylesheets, 2);
        });
    });
});
@@ -329,17 +329,16 @@
 d return
-s
  stylesh
@@ -349,32 +349,32 @@
 ', function() %7B%0A
+
         assert.e
@@ -428,33 +428,32 @@
 t('should return
-s
  file size', fun
@@ -536,17 +536,16 @@
 d return
-s
  data UR
@@ -646,17 +646,16 @@
 d return
-s
  raito o
@@ -785,25 +785,24 @@
 hould return
-s
  css rules',
@@ -889,17 +889,16 @@
 d return
-s
  css sel
@@ -997,17 +997,16 @@
 d return
-s
  simplic
@@ -1111,33 +1111,32 @@
 t('should return
-s
  most identifers
@@ -1233,17 +1233,16 @@
 d return
-s
  most id
@@ -1396,33 +1396,32 @@
 t('should return
-s
  lowest cohesion
@@ -1518,17 +1518,16 @@
 d return
-s
  lowest 
@@ -1644,33 +1644,32 @@
 t('should return
-s
  total unique fo
@@ -1780,17 +1780,16 @@
 d return
-s
  total u
@@ -1901,17 +1901,16 @@
 d return
-s
  id sele
@@ -2009,17 +2009,16 @@
 d return
-s
  univers
@@ -2131,17 +2131,16 @@
 d return
-s
  unquali
@@ -2276,17 +2276,16 @@
 d return
-s
  JavaScr
@@ -2417,17 +2417,16 @@
 d return
-s
  importa
@@ -2537,17 +2537,16 @@
 d return
-s
  float p
@@ -2653,17 +2653,16 @@
 d return
-s
  media q
@@ -2805,33 +2805,32 @@
 t('should return
-s
  gzipped size', 
@@ -3144,17 +3144,16 @@
 d return
-s
  gzipped
@@ -3541,33 +3541,32 @@
 t('should return
-s
  file size', fun
@@ -3865,33 +3865,32 @@
 t('should return
-s
  file size', fun
@@ -4137,33 +4137,32 @@
 t('should return
-s
  file size', fun
@@ -4394,32 +4394,32 @@
 ', function() %7B%0A
+
     it('should r
@@ -4423,17 +4423,16 @@
 d return
-s
  file si

fix description