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

feat: tweak label tips #7

Merged
merged 1 commit into from
Dec 2, 2021
Merged
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
15 changes: 10 additions & 5 deletions lib/report/templates/head.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
.enable-incremental .disabled {
opacity: 0.2;
}
.enable-incremental .summary-line.origin{
.enable-incremental .summary-line.origin {
display: none;
}
.enable-origin .summary-line.incremental{
.enable-origin .summary-line.incremental {
display: none;
}
</style>
Expand All @@ -35,7 +35,7 @@
</h1>
<div>
<input id="incremental-btn" type="checkbox" />
<label for="incremental-btn">show incremental</label>
<label for="incremental-btn"></label>
</div>
<div class='clearfix origin'>
{{#with metrics.lines}}
Expand Down Expand Up @@ -113,6 +113,11 @@
<div class='status-line {{reportClass}}'></div>
<script>
function showIncremental() {
if (window.navigator.language.includes('en')) {
document.querySelector('[for="incremental-btn"]').innerText = 'show incremental';
} else {
document.querySelector('[for="incremental-btn"]').innerText = '查看增量覆盖率';
}
document.querySelector('.incremental').style.display = 'block';
document.querySelector('.origin').style.display = 'none';
document.body.className = 'enable-incremental';
Expand All @@ -130,11 +135,11 @@
localStorage && localStorage.setItem('enable-incremental', true);
} else {
showOrigin();
localStorage && localStorage.setItem('enable-incremental', '')
localStorage && localStorage.setItem('enable-incremental', '');
}
}, false);

if(localStorage && localStorage.getItem('enable-incremental')){
if (localStorage && localStorage.getItem('enable-incremental')) {
showIncremental();
document.querySelector('#incremental-btn').setAttribute('checked', 'checked');
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-istanbul",
"version": "1.0.20",
"version": "1.0.21",
"description": "Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale",
"keywords": [
"coverage",
Expand Down