Skip to content

Commit

Permalink
Merge pull request #1238 from naokiy/implove_filter_coverage
Browse files Browse the repository at this point in the history
Add test for plugins/filter to improve coverage.
  • Loading branch information
tommy351 committed Apr 28, 2015
2 parents c966378 + 95480f1 commit f2514cb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/scripts/filters/backtick_code_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ describe('Backtick code block', function(){
data.content.should.eql(content);
});

it('with no config (disabled)', function(){
var content = [
'``` js',
code,
'```'
].join('\n');

var data = {content: content};

var oldConfig = hexo.config.highlight;
delete hexo.config.highlight;

codeBlock(data);
data.content.should.eql(content);

hexo.config.highlight = oldConfig;
});

it('default', function(){
var data = {
content: [
Expand Down
19 changes: 19 additions & 0 deletions test/scripts/filters/i18n_locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,23 @@ describe('i18n locals', function(){
locals.page.canonical_path.should.eql('index.html');
locals.__('Home').should.eql('Home');
});

it('use config by default - with multiple languages, first language should be used', function(){
var oldConfig = hexo.config.language;
hexo.config.language = ['zh-tw', 'en'];

var locals = {
config: hexo.config,
page: {},
path: 'index.html'
};

i18nFilter(locals);

locals.page.lang.should.eql('zh-tw');
locals.page.canonical_path.should.eql('index.html');
locals.__('Home').should.eql('首頁');

hexo.config.language = oldConfig;
});
});

0 comments on commit f2514cb

Please sign in to comment.