mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-20 19:02:33 +00:00
Improve test coverage
This commit is contained in:
parent
54b32d7f4b
commit
eb59f7f694
3
.github/workflows/linter.yml
vendored
3
.github/workflows/linter.yml
vendored
@ -12,9 +12,8 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
- run: npm run eslint
|
- run: npm run eslint
|
||||||
- run: npm test
|
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
run: npm run test-cov
|
run: npx nyc --reporter=lcovonly npm test
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
- name: Coveralls
|
- name: Coveralls
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
{%- if theme.footer.powered %}
|
{%- if theme.footer.powered %}
|
||||||
<div class="powered-by">
|
<div class="powered-by">
|
||||||
{%- set next_site = 'https://theme-next.js.org' if theme.scheme === 'Gemini' else 'https://theme-next.js.org/' + theme.scheme | lower + '/' %}
|
{%- set next_site = 'https://theme-next.js.org' if theme.scheme === 'Gemini' else 'https://theme-next.js.org/' + theme.scheme | lower + '/' %}
|
||||||
{{- __('footer.powered', next_url('https://hexo.io', 'Hexo', {class: 'theme-link'}) + ' & ' + next_url(next_site, 'NexT.' + theme.scheme, {class: 'theme-link'})) }}
|
{{- __('footer.powered', next_url('https://hexo.io', 'Hexo') + ' & ' + next_url(next_site, 'NexT.' + theme.scheme)) }}
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
"prepare": "node .githooks/install.js",
|
"prepare": "node .githooks/install.js",
|
||||||
"stylint": "stylint source/css/",
|
"stylint": "stylint source/css/",
|
||||||
"test": "mocha test/index.js",
|
"test": "mocha test/index.js",
|
||||||
"test-cov": "nyc --reporter=lcovonly npm run test"
|
"test-cov": "nyc npm test"
|
||||||
},
|
},
|
||||||
"repository": "next-theme/hexo-theme-next",
|
"repository": "next-theme/hexo-theme-next",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@ -36,10 +36,6 @@ module.exports = function(path, text, options = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrs.class && Array.isArray(attrs.class)) {
|
|
||||||
attrs.class = attrs.class.join(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it's external link, rewrite attributes.
|
// If it's external link, rewrite attributes.
|
||||||
if (data.protocol && data.hostname !== siteHost) {
|
if (data.protocol && data.hostname !== siteHost) {
|
||||||
attrs.external = null;
|
attrs.external = null;
|
||||||
|
|||||||
@ -37,4 +37,10 @@ describe('next-url', () => {
|
|||||||
const encoded = btoa('https://theme-next.js.org');
|
const encoded = btoa('https://theme-next.js.org');
|
||||||
nextUrl('https://theme-next.js.org', 'Text').should.eql(`<span class="exturl" data-url="${encoded}">Text</span>`);
|
nextUrl('https://theme-next.js.org', 'Text').should.eql(`<span class="exturl" data-url="${encoded}">Text</span>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('class with exturl enabled', () => {
|
||||||
|
hexo.theme.exturl = true;
|
||||||
|
const encoded = btoa('https://theme-next.js.org');
|
||||||
|
nextUrl('https://theme-next.js.org', 'Text', { class: 'theme-link' }).should.eql(`<span class="exturl theme-link" data-url="${encoded}">Text</span>`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user