summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/output/base.js2
-rw-r--r--test/output-json.js15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/output/base.js b/lib/output/base.js
index d513d71..b60edb1 100644
--- a/lib/output/base.js
+++ b/lib/output/base.js
@@ -240,7 +240,7 @@ Output.prototype.getContext = function() {
output: this.getSelfContext()
},
this.book.getContext(),
- this.book.langs.getContext(),
+ (this.book.isLanguageBook()? this.book.parent: this.book).langs.getContext(),
this.book.summary.getContext(),
this.book.glossary.getContext(),
this.book.config.getContext(),
diff --git a/test/output-json.js b/test/output-json.js
index 1006dab..cb29119 100644
--- a/test/output-json.js
+++ b/test/output-json.js
@@ -41,8 +41,23 @@ describe('JSON Output', function() {
output.should.have.file('fr/README.json');
});
+ it('should correctly add languages list to all json', function() {
+ var jsonFR = require(output.resolve('fr/README.json'));
+ var jsonEN = require(output.resolve('en/README.json'));
+
+ jsonFR.should.have.property('languages')
+ .with.property('list').with.lengthOf(2);
+ jsonEN.should.have.property('languages')
+ .with.property('list').with.lengthOf(2);
+ });
+
it('should correctly generate a README.json for the whole book', function() {
output.should.have.file('README.json');
+
+ var json = require(output.resolve('README.json'));
+
+ json.should.have.property('languages')
+ .with.property('list').with.lengthOf(2);
});
});
});