Skip to content

fix: remove event listener on disconnect and unused vars #39

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

Merged
merged 2 commits into from
Aug 10, 2025
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
1 change: 0 additions & 1 deletion web/src/tab-summary.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LitElement, html, css } from 'lit';
import { map } from 'lit/directives/map.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { customElement, property } from 'lit/decorators.js';
import { TabSummaryInfo } from './testgrid-dashboard-summary.js';
Expand Down
2 changes: 1 addition & 1 deletion web/src/testgrid-dashboard-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function convertResponse(ts: TabSummary) {
tsi.failuresSummary!.failureStats = failureStats

tsi.failuresSummary!.topFailingTests = [];
ts.failuresSummary?.topFailingTests.forEach( (test, i) => {
ts.failuresSummary?.topFailingTests.forEach( (test) => {
const failingTest: FailingTestInfo = {
displayName: test.displayName,
failCount: test.failCount,
Expand Down
23 changes: 17 additions & 6 deletions web/src/testgrid-data-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,30 @@ export class TestgridDataContent extends LitElement {
navigateTab(this.dashboardName, this.tabName);
}

private handleTabChanged = (evt: Event) => {
this.tabName = (<CustomEvent>evt).detail.tabName;
this.showTab = !this.showTab;
this.highlightIndex(this.tabName);
navigateTab(this.dashboardName, this.tabName!);
};

/**
* Lit-element lifecycle method.
* Invoked when a component is added to the document's DOM.
*/
connectedCallback() {
super.connectedCallback();
this.fetchTabNames();
window.addEventListener('tab-changed', (evt: Event) => {
this.tabName = (<CustomEvent>evt).detail.tabName;
this.showTab = !this.showTab;
this.highlightIndex(this.tabName);
navigateTab(this.dashboardName, this.tabName!);
});
window.addEventListener('tab-changed', this.handleTabChanged);
}

/**
* Lit-element lifecycle method.
* Invoked when a component is removed from the document's DOM.
*/
disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener('tab-changed', this.handleTabChanged);
}

/**
Expand Down
1 change: 0 additions & 1 deletion web/src/testgrid-grid-column-header.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LitElement, html, css } from 'lit';
import { styleMap } from 'lit/directives/style-map.js';
import { customElement, property } from 'lit/decorators.js';

@customElement('testgrid-grid-column-header')
Expand Down
2 changes: 0 additions & 2 deletions web/test/testgrid-dashboard-summary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import {
unsafeStatic,
expect,
waitUntil,
aTimeout,
} from '@open-wc/testing';

import { TestgridDashboardSummary } from '../src/testgrid-dashboard-summary.js';
import { TestgridFailuresSummary } from '../src/testgrid-failures-summary.js';
import { TabSummary } from '../src/tab-summary.js';

describe('Testgrid Dashboard Summary page', () => {
Expand Down