gitbook-html
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -100,2 +100,7 @@ var _ = require('lodash'); | ||
// Last part might be empty | ||
if (previousPart !== null) { | ||
parts.push(previousPart); | ||
} | ||
return parts; | ||
@@ -102,0 +107,0 @@ } |
{ | ||
"name": "gitbook-html", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"homepage": "https://www.gitbook.com", | ||
@@ -5,0 +5,0 @@ "description": "Parse HTML content for gitbook", |
@@ -9,2 +9,3 @@ var fs = require('fs'); | ||
var LEXED, PART; | ||
var LEXED_EMPTY; | ||
@@ -17,2 +18,5 @@ before(function() { | ||
var CONTENT_EMPTY = fs.readFileSync( | ||
path.join(__dirname, './fixtures/SUMMARY-EMPTY.html'), 'utf8'); | ||
LEXED_EMPTY = summary(CONTENT_EMPTY); | ||
}); | ||
@@ -32,8 +36,18 @@ | ||
it('should detect empty parts', function() { | ||
var CONTENT_EMPTY = fs.readFileSync( | ||
path.join(__dirname, './fixtures/SUMMARY-EMPTY.html'), 'utf8'); | ||
var LEXED_EMPTY = summary(CONTENT_EMPTY); | ||
assert.equal(LEXED_EMPTY.parts.length, 4); | ||
assert.equal(LEXED_EMPTY.parts[2].title, 'Empty part'); | ||
var partTitles = LEXED_EMPTY.parts.map(function (part) { | ||
return part.title; | ||
}); | ||
var expectedTitles = [ | ||
'First empty part', | ||
'Part 1', | ||
'', | ||
'Empty part', | ||
'Part 2', | ||
'Penultimate empty part', | ||
'Last empty part' | ||
]; | ||
assert.equal(LEXED_EMPTY.parts.length, 7); | ||
expectedTitles.forEach(function (title, index) { | ||
assert.equal(partTitles[index], title); | ||
}); | ||
}); | ||
@@ -40,0 +54,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21888
568