-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3315 from weyusi/fix-meta
fix: compatibility with cheerio 1.0.0+ (#3313)
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
describe('Meta Generator', () => { | ||
const Hexo = require('../../../lib/hexo'); | ||
const hexo = new Hexo(); | ||
const metaGenerator = require('../../../lib/plugins/filter/meta_generator').bind(hexo); | ||
const cheerio = require('cheerio'); | ||
|
||
it('default', () => { | ||
const content = '<head><link></head>'; | ||
const result = metaGenerator(content); | ||
|
||
const $ = cheerio.load(result); | ||
$('meta[name="generator"]').length.should.eql(1); | ||
}); | ||
|
||
it('empty <head>', () => { | ||
const content = '<head></head>'; | ||
const result = metaGenerator(content); | ||
|
||
// meta generator should not be prepended if <head> tag is empty | ||
// see https://github.com/hexojs/hexo/pull/3315 | ||
const resultType = typeof result; | ||
resultType.should.eql('undefined'); | ||
}); | ||
}); |