mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Add tests for context of filters
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
var should = require('should');
|
||||
|
||||
module.exports = {
|
||||
filters: {
|
||||
// Simple test
|
||||
hello: function(s) {
|
||||
return 'Hello ' + s + '!';
|
||||
},
|
||||
|
||||
// Test using the conetxt "this"
|
||||
testContext: function(s) {
|
||||
this.should.have.property('config');
|
||||
this.should.have.property('log');
|
||||
this.should.have.property('options');
|
||||
this.should.have.property('resolve').which.is.a.function;
|
||||
this.should.have.property('book').which.equal(this);
|
||||
|
||||
return 'Hello ' + s + '!';
|
||||
}
|
||||
}
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "gitbook-plugin-test-filters",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"gitbook": "*"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user