Skip to content

Commit c5f0657

Browse files
nicojssimondelhugo-vrijswijkStryker Mutator NPA
authored
feat(diff): add new "diff" feature to mutant view (#1515)
Co-authored-by: Simon de Lang <simondelang@gmail.com> Co-authored-by: Hugo van Rijswijk <git@hugovr.nl> Co-authored-by: Stryker Mutator NPA <stryker-mutator@users.noreply.github.com>
1 parent d9c8a4c commit c5f0657

File tree

98 files changed

+5679
-1398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+5679
-1398
lines changed

packages/elements/.vscode/launch.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"webRoot": "${workspaceFolder}",
1313
"sourceMaps": true,
1414
"sourceMapPathOverrides": {
15-
"webpack://elements/*": "${webRoot}/*"
15+
"webpack://elements/*": "${webRoot}/*",
16+
"webpack://mutation-testing-elements/*": "${webRoot}/*"
1617
}
1718
},
1819
{
@@ -24,7 +25,8 @@
2425
"webRoot": "${workspaceFolder}",
2526
"sourceMaps": true,
2627
"sourceMapPathOverrides": {
27-
"webpack://elements/*": "${webRoot}/*"
28+
"webpack://elements/*": "${webRoot}/*",
29+
"webpack://mutation-testing-elements/*": "${webRoot}/*"
2830
},
2931
"timeout": 30000
3032
}

packages/elements/postcss.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
require('@fullhuman/postcss-purgecss')({
77
content: ['src/**/*.ts'],
88
// Don't purge dynamically added classes
9-
safelist: [/^(bg|text)-(success|caution|danger|warning|secondary|default)(-light)?$/, /^language-/, /^:host$/],
9+
safelist: [/^(bg|text|mutant)-(success|caution|danger|warning|secondary|default|info)(-light)?$/, /^language-/, /^:host$/, /^mte-.*/],
1010
}),
1111
],
1212
};

packages/elements/src/components/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import style from './app.scss';
99
import theme from './theme.scss';
1010
import { createCustomEvent } from '../../lib/custom-events';
1111
import { FileUnderTestModel, Metrics, MutationTestMetricsResult, TestFileModel, TestMetrics } from 'mutation-testing-metrics/src/model';
12-
import { toAbsoluteUrl } from '../../lib/htmlHelpers';
12+
import { toAbsoluteUrl } from '../../lib/html-helpers';
1313
import { isLocalStorageAvailable } from '../../lib/browser';
1414

1515
interface BaseContext {

packages/elements/src/components/app/theme.scss

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,45 @@
193193
}
194194

195195
// Mutation testing elements custom theming ================================
196+
197+
@function squiggly-svg-factory($stroke-color) {
198+
// Color to string
199+
$stroke-color: '#{$stroke-color}';
200+
201+
// Escape leading '#' (url encode %23)
202+
$index: str-index($stroke-color, '#');
203+
@if $index eq 1 {
204+
$stroke-color: '%23' + str-slice($stroke-color, 2);
205+
}
206+
@return url("data:image/svg+xml;charset=UTF8,<svg xmlns='http://www.w3.org/2000/svg' height='3' width='6'><g fill='#{$stroke-color}'><path d='m5.5 0-3 3H1.1l3-3z'/><path d='m4 0 2 2V.6L5.4 0zM0 2l1 1h1.4L0 .6z'/></g></svg>");
207+
}
196208
:host(:not([theme='dark'])) {
197209
--mut-octicon-icon-color: #498ba7;
210+
--mut-line-number: #6e7781;
211+
--mut-diff-add-bg: #e6ffec;
212+
--mut-diff-add-bg-line-number: #ccffd8;
213+
--mut-diff-add-line-number: #24292f;
214+
--mut-diff-del-bg: #ffebe9;
215+
--mut-diff-del-bg-line-number: #ffd7d5;
216+
--mut-diff-del-line-number: var(--mut-diff-add-line-number);
217+
--mut-badge-info-bg: #54c6ec;
218+
--mut-badge-info: #212529;
219+
--mut-code-lense: #919191;
220+
--mut-squiggly-danger: #{squiggly-svg-factory($danger)};
221+
--mut-squiggly-caution: #{squiggly-svg-factory($orange)};
198222
}
199223
:host([theme='dark']) {
200224
--mut-octicon-icon-color: #519aba;
225+
--mut-line-number: #484f58;
226+
--mut-diff-add-bg: rgba(46, 160, 67, 0.15);
227+
--mut-diff-add-bg-line-number: rgba(63, 185, 80, 0.3);
228+
--mut-diff-add-line-number: #c9d1d9;
229+
--mut-diff-del-bg: rgba(248, 81, 73, 0.15);
230+
--mut-diff-del-bg-line-number: rgba(248, 81, 73, 0.3);
231+
--mut-diff-del-line-number: #c9d1d9;
232+
--mut-badge-info-bg: #17a3b8;
233+
--mut-badge-info: #fff;
234+
--mut-code-lense: #999;
235+
--mut-squiggly-danger: #{squiggly-svg-factory($darkly-danger)};
236+
--mut-squiggly-caution: #{squiggly-svg-factory($darkly-orange)};
201237
}

packages/elements/src/components/breadcrumb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { LitElement, html } from 'lit';
22
import { customElement, property } from 'lit/decorators.js';
33
import { bootstrap } from '../style';
4-
import { toAbsoluteUrl } from '../lib/htmlHelpers';
4+
import { toAbsoluteUrl } from '../lib/html-helpers';
55
import { View } from '../lib/router';
66

77
@customElement('mte-breadcrumb')

packages/elements/src/components/drawer-mutant/drawer-mutant.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { html, LitElement, unsafeCSS } from 'lit';
22
import { customElement, property } from 'lit/decorators.js';
33
import { MutantModel, TestModel } from 'mutation-testing-metrics';
44
import { MutantStatus } from 'mutation-testing-report-schema/api';
5-
import { describeLocation, getEmojiForStatus, plural, renderIf, renderIfPresent } from '../../lib/htmlHelpers';
5+
import { describeLocation, getEmojiForStatus, plural, renderIf, renderIfPresent } from '../../lib/html-helpers';
66
import { bootstrap } from '../../style';
77
import { DrawerMode } from '../drawer/drawer.component';
88
import style from './drawer-mutant.scss';

packages/elements/src/components/drawer-test/drawer-test.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { html, LitElement, unsafeCSS } from 'lit';
22
import { customElement, property } from 'lit/decorators.js';
33
import { MutantModel, TestModel, TestStatus } from 'mutation-testing-metrics';
4-
import { renderIfPresent, getEmojiForTestStatus, renderIf, plural, describeLocation } from '../../lib/htmlHelpers';
4+
import { renderIfPresent, getEmojiForTestStatus, renderIf, plural, describeLocation } from '../../lib/html-helpers';
55
import { bootstrap } from '../../style';
66
import { DrawerMode } from '../drawer/drawer.component';
77
import style from './drawer-test.scss';

packages/elements/src/components/drawer/drawer.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { html, LitElement, unsafeCSS } from 'lit';
22
import { customElement, property } from 'lit/decorators.js';
3-
import { renderIf } from '../../lib/htmlHelpers';
3+
import { renderIf } from '../../lib/html-helpers';
44
import { bootstrap } from '../../style';
55
import style from './drawer.component.scss';
66

77
export type DrawerMode = 'open' | 'half' | 'closed';
8+
export const DRAWER_HALF_OPEN_SIZE = 120;
89

910
@customElement('mte-drawer')
1011
export class MutationTestReportDrawer extends LitElement {

0 commit comments

Comments
 (0)