1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Linter fixes

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2023-02-01 13:54:13 +03:00
parent 1489264953
commit 8c8701f8a6
3 changed files with 32 additions and 13 deletions

View File

@ -1,3 +1,7 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { AsyncFnMock } from "@async-fn/jest";
import asyncFn from "@async-fn/jest";
import type { DiContainer } from "@ogre-tools/injectable";
@ -35,11 +39,11 @@ function createNamespace(name: string, labels?: Record<string, string>, annotati
selfLink: `/api/v1/namespaces/${name}`,
uid: `${name}-1`,
labels: {
...labels
...labels,
},
annotations: {
...annotations
}
...annotations,
},
},
});
}
@ -232,7 +236,9 @@ describe("<NamespaceTreeView />", () => {
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
const minusButton = levelB.querySelector("[data-testid='minus-square']");
fireEvent.click(minusButton!);
if (minusButton) {
fireEvent.click(minusButton);
}
expect(result.baseElement).toMatchSnapshot();
});
@ -242,11 +248,15 @@ describe("<NamespaceTreeView />", () => {
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
const minusButton = levelB.querySelector("[data-testid='minus-square']");
fireEvent.click(minusButton!);
if (minusButton) {
fireEvent.click(minusButton);
}
const plusButton = levelB.querySelector("[data-testid='plus-square']");
fireEvent.click(plusButton!);
if (plusButton) {
fireEvent.click(plusButton);
}
expect(result.baseElement).toMatchSnapshot();
});

View File

@ -1,5 +1,10 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { SvgIcon, withStyles } from "@material-ui/core";
import { TreeItem, TreeItemProps, TreeView } from "@material-ui/lab";
import type { TreeItemProps } from "@material-ui/lab";
import { TreeItem, TreeView } from "@material-ui/lab";
import { withInjectables } from "@ogre-tools/injectable-react";
import React from "react";
import { Link } from "react-router-dom";
@ -32,7 +37,7 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
function renderChildren(parent: Namespace) {
const children = hierarchicalNamespaces.filter(ns =>
ns.getLabels().find(label => label === `${parent.getName()}.tree.hnc.x-k8s.io/depth=1`)
ns.getLabels().find(label => label === `${parent.getName()}.tree.hnc.x-k8s.io/depth=1`),
);
return children.map(child => (
@ -41,7 +46,7 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
nodeId={`namespace-${child.getId()}`}
data-testid={`namespace-${child.getId()}`}
onIconClick={(evt) =>{
toggleNode(`namespace-${child.getId()}`)
toggleNode(`namespace-${child.getId()}`);
evt.stopPropagation();
}}
label={(
@ -97,7 +102,7 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
</StyledTreeItem>
</TreeView>
</div>
)
);
}
function MinusSquare() {
@ -126,7 +131,7 @@ function CloseSquare() {
const StyledTreeItem = withStyles((theme) => ({
iconContainer: {
'& .close': {
"& .close": {
opacity: 0.3,
},
},

View File

@ -1,3 +1,7 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import styles from "./subnamespace-badge.module.scss";
import React from "react";