0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Fix for broken filters where this context was lost.

fixes #2157
- Change tests to only check for existance
- Properly bind helpers/filters to their instance
This commit is contained in:
Fabian Becker 2014-02-10 00:17:28 +01:00
parent 3c5b931432
commit 3950c8b30a
2 changed files with 10 additions and 10 deletions

View file

@ -6,12 +6,12 @@ var _ = require('lodash'),
var proxy = {
filters: {
register: filters.registerFilter,
unregister: filters.unregisterFilter
register: filters.registerFilter.bind(filters),
unregister: filters.unregisterFilter.bind(filters)
},
helpers: {
register: helpers.registerThemeHelper,
registerAsync: helpers.registerAsyncThemeHelper
register: helpers.registerThemeHelper.bind(helpers),
registerAsync: helpers.registerAsyncThemeHelper.bind(helpers)
},
api: {
posts: _.pick(api.posts, 'browse', 'read'),
@ -21,4 +21,4 @@ var proxy = {
}
};
module.exports = proxy;
module.exports = proxy;

View file

@ -56,12 +56,12 @@ describe('Apps', function () {
describe('Proxy', function () {
it('creates a ghost proxy', function () {
should.exist(appProxy.filters);
appProxy.filters.register.should.equal(filters.registerFilter);
appProxy.filters.unregister.should.equal(filters.unregisterFilter);
should.exist(appProxy.filters.register);
should.exist(appProxy.filters.unregister);
should.exist(appProxy.helpers);
appProxy.helpers.register.should.equal(helpers.registerThemeHelper);
appProxy.helpers.registerAsync.should.equal(helpers.registerAsyncThemeHelper);
should.exist(appProxy.helpers.register);
should.exist(appProxy.helpers.registerAsync);
should.exist(appProxy.api);
@ -189,4 +189,4 @@ describe('Apps', function () {
});
});
});
});
});