Skip to content

Commit

Permalink
Improve tests (add demo page)
Browse files Browse the repository at this point in the history
  • Loading branch information
backflip committed Aug 4, 2015
1 parent 2dd3786 commit 7c29252
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions test/expected/fonts/Icons.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/expected/fonts/Icons.woff
Binary file not shown.
14 changes: 14 additions & 0 deletions test/expected/index.html
@@ -0,0 +1,14 @@
<DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
<link href="css/_icons.css" rel="stylesheet">
</head>
<body>
<ul>
<li class="icon icon-github">Github</li>
<li class="icon icon-twitter">Github</li>
</ul>
</body>
</html>
19 changes: 14 additions & 5 deletions test/main.js
Expand Up @@ -11,7 +11,7 @@ describe('gulp-iconfont-css', function() {
function testType(type, name) {
var resultsDir = __dirname + '/results_' + type;

it('should generate ' + name + ' file', function(done) {
it('should generate ' + name + ' file and fonts', function(done) {
gulp.src(__dirname + '/fixtures/icons/*.svg')
.pipe(iconfontCss({
fontName: fontName,
Expand All @@ -23,19 +23,28 @@ describe('gulp-iconfont-css', function() {
}))
.pipe(iconfont({
fontName: fontName,
formats: ['ttf', 'eot', 'woff', 'svg']
formats: ['woff', 'svg'],
timestamp: 1438703262
}))
.pipe(gulp.dest(resultsDir + '/fonts/'))
.pipe(es.wait(function() {
assert.equal(
fs.readFileSync(resultsDir + '/css/_icons.' + type, 'utf8'),
fs.readFileSync(__dirname + '/expected/_icons.' + type, 'utf8')
fs.readFileSync(__dirname + '/expected/css/_icons.' + type, 'utf8')
);

assert.equal(
fs.readFileSync(resultsDir + '/fonts/Icons.woff', 'utf8'),
fs.readFileSync(__dirname + '/expected/fonts/Icons.woff', 'utf8')
);

assert.equal(
fs.readFileSync(resultsDir + '/fonts/Icons.svg', 'utf8'),
fs.readFileSync(__dirname + '/expected/fonts/Icons.svg', 'utf8')
);

fs.unlinkSync(resultsDir + '/css/_icons.' + type);
fs.rmdirSync(resultsDir + '/css/');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.ttf');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.eot');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.woff');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.svg');
fs.rmdirSync(resultsDir + '/fonts/');
Expand Down

0 comments on commit 7c29252

Please sign in to comment.