Skip to content

Commit

Permalink
Fix is_current throws error when no path is given.
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed May 20, 2015
1 parent 07942b5 commit fe41b43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/plugins/helper/is.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

function isCurrentHelper(path, strict){
/* jshint validthis: true */
path = path || '';

if (strict){
if (path[path.length - 1] === '/') path += 'index.html';

Expand Down
1 change: 1 addition & 0 deletions test/scripts/helpers/is.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('is', function(){
var is = require('../../../lib/plugins/helper/is');

it('is_current', function(){
is.current.call({path: 'index.html', config: hexo.config}).should.be.true;
is.current.call({path: 'foo/bar', config: hexo.config}, 'foo').should.be.true;
is.current.call({path: 'foo/bar', config: hexo.config}, 'foo/bar').should.be.true;
is.current.call({path: 'foo/bar', config: hexo.config}, 'foo/baz').should.be.false;
Expand Down

0 comments on commit fe41b43

Please sign in to comment.