Test documentation with markdown-doctest.

This commit is contained in:
Nick Johnstone
2016-04-29 19:27:51 +02:00
committed by John-David Dalton
parent 6c6e1c2be3
commit ef1024bb60
3 changed files with 62 additions and 7 deletions

View File

@@ -0,0 +1,53 @@
var _ = require(__dirname);
function jQuery () {
return {
on: function (ev, cb) {
cb()
}
}
}
jQuery.each = function (items, f) {
items.forEach(f)
}
module.exports = {
globals: {
'_': _,
asyncSave: _.noop,
addContactToList: _.noop,
calculateLayout: _.noop,
createApplication: _.noop,
updatePosition: _.noop,
sendMail: _.noop,
renewToken: _.noop,
batchLog: _.noop,
setImmediate: setImmediate,
Buffer: Buffer,
EventSource: function () {},
fs: {writeFileSync: _.noop},
path: {join: _.noop},
cwd: __dirname,
mainText: '',
data: {user: 'mock'},
document: {
body: {
childNodes: [],
nodeName: 'body'
}
},
jQuery: jQuery,
element: {},
window: {}
},
babel: false
}

View File

@@ -13908,12 +13908,6 @@
* compiled({ 'user': 'pebbles' });
* // => 'hello pebbles!'
*
* // Use custom template delimiters.
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ user }}!');
* compiled({ 'user': 'mustache' });
* // => 'hello mustache!'
*
* // Use backslashes to treat delimiters as plain text.
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
* compiled({ 'value': 'ignored' });
@@ -13939,6 +13933,12 @@
* // return __p;
* // }
*
* // Use custom template delimiters.
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ user }}!');
* compiled({ 'user': 'mustache' });
* // => 'hello mustache!'
*
* // Use the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and stack traces.
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\

View File

@@ -10,7 +10,7 @@
"build:fp-modules": "node lib/fp/build-modules.js",
"build:main": "node lib/main/build-dist.js",
"build:main-modules": "node lib/main/build-modules.js",
"doc": "node lib/main/build-doc github",
"doc": "node lib/main/build-doc github && npm run test:docs",
"doc:fp": "node lib/fp/build-doc",
"doc:site": "node lib/main/build-doc site",
"pretest": "npm run build",
@@ -22,6 +22,7 @@
"test": "npm run test:main && npm run test:fp",
"test:fp": "node test/test-fp",
"test:main": "node test/test",
"test:docs": "markdown-doctest",
"validate": "npm run style && npm run test"
},
"devDependencies": {
@@ -40,6 +41,7 @@
"jquery": "^2.2.3",
"jscs": "^3.0.1",
"lodash": "4.10.0",
"markdown-doctest": "^0.3.4",
"platform": "^1.3.1",
"qunit-extras": "^1.5.0",
"qunitjs": "~1.23.1",