Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: allow empty attribute #3648

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/scripts/tags/asset_img.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ describe('asset_img', () => {
}));

it('default', () => {
assetImg('bar').should.eql('<img src="/foo/bar">');
assetImg('bar').should.eql('<img src="/foo/bar" class="">');
});

it('default', () => {
assetImg('bar title').should.eql('<img src="/foo/bar" title="title">');
assetImg('bar title').should.eql('<img src="/foo/bar" class="" title="title">');
});

it('with space', () => {
// {% asset_img "spaced asset" "spaced title" %}
assetImgTag.call(post, ['spaced asset', 'spaced title'])
.should.eql('<img src="/foo/spaced%20asset" title="spaced title">');
.should.eql('<img src="/foo/spaced%20asset" class="" title="spaced title">');
});

it('with alt and title', () => {
assetImgTag.call(post, ['bar', '"title"', '"alt"'])
.should.eql('<img src="/foo/bar" title="title" alt="alt">');
.should.eql('<img src="/foo/bar" class="" title="title" alt="alt">');
});

it('with width height alt and title', () => {
assetImgTag.call(post, ['bar', '100', '200', '"title"', '"alt"'])
.should.eql('<img src="/foo/bar" width="100" height="200" title="title" alt="alt">');
.should.eql('<img src="/foo/bar" class="" width="100" height="200" title="title" alt="alt">');
});

it('no slug', () => {
Expand All @@ -70,6 +70,6 @@ describe('asset_img', () => {

it('with root path', () => {
hexo.config.root = '/root/';
assetImg('bar').should.eql('<img src="/root/foo/bar">');
assetImg('bar').should.eql('<img src="/root/foo/bar" class="">');
});
});
5 changes: 3 additions & 2 deletions test/scripts/tags/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('link', () => {

$('a').attr('href').should.eql('https://google.com');
$('a').html().should.eql('Click here to Google');
should.not.exist($('a').attr('target'));
$('a').attr('title').should.eql('');
$('a').attr('target').should.eql('');
});

it('text + url + title', () => {
Expand All @@ -46,7 +47,7 @@ describe('link', () => {

$('a').attr('href').should.eql('https://google.com');
$('a').html().should.eql('Click here to Google');
should.not.exist($('a').attr('target'));
$('a').attr('target').should.eql('');
$('a').attr('title').should.eql('Google link');
});
});