mutation-testing-elements
Advanced tools
Comparing version 1.7.6 to 1.7.7
@@ -6,2 +6,14 @@ # Change Log | ||
## [1.7.7](https://github.com/stryker-mutator/mutation-testing-elements/compare/v1.7.6...v1.7.7) (2021-12-09) | ||
### Performance Improvements | ||
* **mutation-test-report-app:** only recalculate metrics if report changed ([42b7bc0](https://github.com/stryker-mutator/mutation-testing-elements/commit/42b7bc0b6fad97180aa3775fbc57ff13f222cb32)) | ||
* **mutation-test-report-app:** only render once by setting props in earlier hooks ([210da55](https://github.com/stryker-mutator/mutation-testing-elements/commit/210da557d0aea4a3ac7748386413742435111b54)) | ||
## [1.7.6](https://github.com/stryker-mutator/mutation-testing-elements/compare/v1.7.5...v1.7.6) (2021-11-19) | ||
@@ -8,0 +20,0 @@ |
@@ -32,3 +32,5 @@ import { LitElement, PropertyValues } from 'lit'; | ||
private loadData; | ||
updated(changedProperties: PropertyValues): Promise<void>; | ||
willUpdate(changedProperties: PropertyValues): Promise<void>; | ||
updated(changedProperties: PropertyValues): void; | ||
private getTheme; | ||
private updateModel; | ||
@@ -35,0 +37,0 @@ private updateContext; |
@@ -45,19 +45,2 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
firstUpdated() { | ||
var _a; | ||
// Set the theme when no theme is selected (light vs dark) | ||
if (!this.theme) { | ||
// 1. check local storage | ||
const theme = isLocalStorageAvailable() && localStorage.getItem('mutation-testing-elements-theme'); | ||
if (theme) { | ||
this.theme = theme; | ||
// 2. check for user's OS preference | ||
} | ||
else if (window.matchMedia && ((_a = window.matchMedia('(prefers-color-scheme: dark)')) === null || _a === void 0 ? void 0 : _a.matches)) { | ||
this.theme = 'dark'; | ||
// 3. default is light | ||
} | ||
else { | ||
this.theme = 'light'; | ||
} | ||
} | ||
// Set the default view to "mutant" when no route is selected | ||
@@ -80,11 +63,21 @@ if (this.path.length === 0 || (this.path[0] !== View.mutant && this.path[0] !== View.test)) { | ||
} | ||
async updated(changedProperties) { | ||
if ((changedProperties.has('path') || changedProperties.has('report')) && this.report) { | ||
this.updateModel(this.report); | ||
this.updateContext(); | ||
this.updateTitle(); | ||
async willUpdate(changedProperties) { | ||
// Set the theme when no theme is selected (light vs dark) | ||
if (!this.theme) { | ||
this.theme = this.getTheme(); | ||
} | ||
if (this.report) { | ||
if (changedProperties.has('report')) { | ||
this.updateModel(this.report); | ||
} | ||
if (changedProperties.has('path') || changedProperties.has('report')) { | ||
this.updateContext(); | ||
this.updateTitle(); | ||
} | ||
} | ||
if (changedProperties.has('src')) { | ||
await this.loadData(); | ||
} | ||
} | ||
updated(changedProperties) { | ||
if (changedProperties.has('theme') && this.theme) { | ||
@@ -94,2 +87,18 @@ this.dispatchEvent(createCustomEvent('theme-changed', { theme: this.theme, themeBackgroundColor: this.themeBackgroundColor })); | ||
} | ||
getTheme() { | ||
var _a; | ||
// 1. check local storage | ||
const theme = isLocalStorageAvailable() && localStorage.getItem('mutation-testing-elements-theme'); | ||
if (theme) { | ||
return theme; | ||
// 2. check for user's OS preference | ||
} | ||
else if (window.matchMedia && ((_a = window.matchMedia('(prefers-color-scheme: dark)')) === null || _a === void 0 ? void 0 : _a.matches)) { | ||
return 'dark'; | ||
// 3. default is light | ||
} | ||
else { | ||
return 'light'; | ||
} | ||
} | ||
updateModel(report) { | ||
@@ -96,0 +105,0 @@ this.rootModel = calculateMutationTestMetrics(report); |
{ | ||
"name": "mutation-testing-elements", | ||
"version": "1.7.6", | ||
"version": "1.7.7", | ||
"description": "A suite of web components for a mutation testing report.", | ||
@@ -31,7 +31,7 @@ "unpkg": "dist/mutation-test-elements.js", | ||
"@types/prismjs": "^1.16.1", | ||
"mutation-testing-metrics": "1.7.6", | ||
"mutation-testing-metrics": "1.7.7", | ||
"mutation-testing-report-schema": "1.7.6", | ||
"prismjs": "^1.21.0" | ||
}, | ||
"gitHead": "33d09728720578bbdc1be8067d66910bc5079fed" | ||
"gitHead": "6a99f0445ed9415e57a3b9bfeff9017d052f2f26" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
409627
3250