Skip to content

Commit

Permalink
feat(file-picker): add fuzzy search to file picker
Browse files Browse the repository at this point in the history
Also restyles the file picker list slightly
  • Loading branch information
hugo-vrijswijk committed Nov 21, 2024
1 parent 8310717 commit 051ad98
Show file tree
Hide file tree
Showing 19 changed files with 264 additions and 195 deletions.
3 changes: 1 addition & 2 deletions libs/eslint-plugin-mte/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ export default [
reportUnusedDisableDirectives: 'error',
},
rules: {
eqeqeq: 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
// Not useful for a lot of stuff, but mainly `.shadowRoot`
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions packages/elements/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}",
"sourceMaps": true
},
{
"type": "node",
"request": "launch",
"name": "Run unit tests",
"program": "${workspaceFolder:parent}/node_modules/vitest/vitest.mjs",
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"args": ["--inspect-brk", "--browser", "--no-file-parallelism"]
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to unit test browser",
"skipFiles": ["<node_internals>/**"],
"port": 9229
}
],
"compounds": [
{
"name": "Debug unit tests",
"configurations": ["Attach to unit test browser", "Run unit tests"],
"stopAll": true
}
]
}
1 change: 1 addition & 0 deletions packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"esbuild": "0.24.0",
"eslint-config-mte": "*",
"express": "4.21.1",
"fuzzysort": "3.1.0",
"lit": "3.2.1",
"mutation-testing-metrics": "3.3.0",
"mutation-testing-real-time": "3.3.0",
Expand Down
17 changes: 9 additions & 8 deletions packages/elements/src/components/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
import type { PropertyValues } from 'lit';
import { html, nothing, unsafeCSS, isServer } from 'lit';
import { html, isServer, nothing, unsafeCSS } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { createRef, ref } from 'lit/directives/ref.js';
import type {
FileUnderTestModel,
Metrics,
Expand All @@ -24,10 +26,9 @@ import { mutantChanges } from '../../lib/mutant-changes.js';
import { locationChange$, View } from '../../lib/router.js';
import type { Theme } from '../../lib/theme.js';
import { globals, tailwind } from '../../style/index.js';
import { type MutationTestReportFilePickerComponent } from '../file-picker/file-picker.component.js';
import { RealTimeElement } from '../real-time-element.js';
import theme from './theme.scss?inline';
import { type MutationTestReportFilePickerComponent } from '../file-picker/file-picker.component.js';
import { createRef, ref } from 'lit/directives/ref.js';

interface BaseContext {
path: string[];
Expand Down Expand Up @@ -360,11 +361,11 @@ export class MutationTestReportAppComponent extends RealTimeElement {
.path="${this.context.path}"
></mte-breadcrumb>
<mte-result-status-bar
.detected="${this.rootModel?.systemUnderTestMetrics.metrics.totalDetected}"
.noCoverage="${this.rootModel?.systemUnderTestMetrics.metrics.noCoverage}"
.pending="${this.rootModel?.systemUnderTestMetrics.metrics.pending}"
.survived="${this.rootModel?.systemUnderTestMetrics.metrics.survived}"
.total="${this.rootModel?.systemUnderTestMetrics.metrics.totalValid}"
detected="${ifDefined(this.rootModel?.systemUnderTestMetrics.metrics.totalDetected)}"
noCoverage="${ifDefined(this.rootModel?.systemUnderTestMetrics.metrics.noCoverage)}"
pending="${ifDefined(this.rootModel?.systemUnderTestMetrics.metrics.pending)}"
survived="${ifDefined(this.rootModel?.systemUnderTestMetrics.metrics.survived)}"
total="${ifDefined(this.rootModel?.systemUnderTestMetrics.metrics.totalValid)}"
></mte-result-status-bar>
${this.context.view === 'mutant' && this.context.result
? html`<mte-mutant-view
Expand Down
4 changes: 3 additions & 1 deletion packages/elements/src/components/breadcrumb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class MutationTestReportBreadcrumbComponent extends LitElement {
}

#renderSearchIcon() {
return html` <button @click="${() => this.#dispatchFilePickerOpenEvent()}" class="ml-auto" title="open file picker">${searchIcon}</button> `;
return html`
<button @click="${() => this.#dispatchFilePickerOpenEvent()}" class="ml-auto" title="Open file picker (Ctrl-K)">${searchIcon}</button>
`;
}

#dispatchFilePickerOpenEvent() {
Expand Down
Loading

0 comments on commit 051ad98

Please sign in to comment.