|
@@ -35,7 +35,7 @@ module.exports = function(exStore, exDir) {
|
|
|
return readFilesAsync(exampleDir, files);
|
|
return readFilesAsync(exampleDir, files);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function renderIndex(req, withRepo, withExample) {
|
|
|
|
|
|
|
+ function renderIndex(req, withRepo, withExample, testMode) {
|
|
|
|
|
|
|
|
// Extract repoSlug and exampleSlug from req.params
|
|
// Extract repoSlug and exampleSlug from req.params
|
|
|
const { locale, params: { repoSlug, exampleSlug } } = req;
|
|
const { locale, params: { repoSlug, exampleSlug } } = req;
|
|
@@ -46,6 +46,7 @@ module.exports = function(exStore, exDir) {
|
|
|
// Initialize view data
|
|
// Initialize view data
|
|
|
let data = {
|
|
let data = {
|
|
|
menuRepo: exStore.getRepoMenu(),
|
|
menuRepo: exStore.getRepoMenu(),
|
|
|
|
|
+ testMode,
|
|
|
_: translator.getAll(locale)
|
|
_: translator.getAll(locale)
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -118,6 +119,16 @@ module.exports = function(exStore, exDir) {
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Get bare index without repo or examples,
|
|
|
|
|
+ * for running tests with QUnit
|
|
|
|
|
+ */
|
|
|
|
|
+ getIndexTest: function(req, res) {
|
|
|
|
|
+ renderIndex(req, false, false, true)
|
|
|
|
|
+ .then(({ html, code }) => res.send(html));
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Get index with repo selected only
|
|
* Get index with repo selected only
|
|
|
*/
|
|
*/
|
|
|
getIndexRepo: function(req, res) {
|
|
getIndexRepo: function(req, res) {
|