-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #191: Sort styleguide sections by reference number
- Loading branch information
Hannu Pelkonen
committed
Nov 17, 2014
1 parent
fe22333
commit 3d90162
Showing
4 changed files
with
77 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var chai = require('chai'), | ||
expect = chai.expect, | ||
multiline = require('multiline'), | ||
parseKSS = require('../lib/modules/kss').parseKSS; | ||
|
||
describe('KSS parser', function() { | ||
var files; | ||
beforeEach(function() { | ||
var str = multiline(function() { | ||
/* | ||
// Section | ||
// | ||
// Styleguide 1.2 | ||
// Section | ||
// | ||
// Styleguide 1.0 | ||
// Section | ||
// | ||
// Styleguide 2.0 | ||
*/ | ||
}), | ||
str2 = multiline(function() { | ||
/* | ||
// Section | ||
// | ||
// Styleguide 1.1 | ||
*/ | ||
}); | ||
files = {'file1.scss': str, 'file2.scss': str2}; | ||
}); | ||
|
||
it('should parse sections from all files', function(done) { | ||
parseKSS(files, {}).then(function(styleguide) { | ||
expect(styleguide.sections.length).to.eql(4); | ||
done(); | ||
}).catch(function(error) { | ||
done(error); | ||
}); | ||
}); | ||
|
||
it('should list sections in the correct order', function(done) { | ||
parseKSS(files, {}).then(function(styleguide) { | ||
expect(styleguide.sections[0].reference).to.eql('1'); | ||
expect(styleguide.sections[1].reference).to.eql('1.1'); | ||
expect(styleguide.sections[2].reference).to.eql('1.2'); | ||
expect(styleguide.sections[3].reference).to.eql('2'); | ||
done(); | ||
}).catch(function(error) { | ||
done(error); | ||
}); | ||
}); | ||
}); |