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

fix select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-04-07 15:57:43 -04:00
parent 4bf4089346
commit dc3dffc2fc
3 changed files with 8 additions and 4 deletions

View File

@ -122,7 +122,7 @@ describe("<Select />", () => {
const { container, rerender } = render(<Select const { container, rerender } = render(<Select
value={options[0]} value={options[0]}
onChange={onChange} onChange={onChange}
options={options} options={options}
/>); />);
const selectedValueContainer = container.querySelector(".Select__single-value"); const selectedValueContainer = container.querySelector(".Select__single-value");

View File

@ -14,7 +14,6 @@ import ReactSelect, { components } from "react-select";
import type { Props as ReactSelectProps, GroupBase } from "react-select"; import type { Props as ReactSelectProps, GroupBase } from "react-select";
import { ThemeStore } from "../../theme.store"; import { ThemeStore } from "../../theme.store";
import { autoBind, cssNames } from "../../utils"; import { autoBind, cssNames } from "../../utils";
import { merge } from "lodash";
const { Menu } = components; const { Menu } = components;
@ -65,6 +64,7 @@ export class Select<Option, IsMulti extends boolean = false, Group extends Group
menuClass, menuClass,
components = {}, components = {},
styles, styles,
value = null,
...props ...props
} = this.props; } = this.props;
const WrappedMenu = components.Menu ?? Menu; const WrappedMenu = components.Menu ?? Menu;
@ -72,12 +72,14 @@ export class Select<Option, IsMulti extends boolean = false, Group extends Group
return ( return (
<ReactSelect <ReactSelect
{...props} {...props}
styles={merge(styles, { styles={{
menuPortal: styles => ({ menuPortal: styles => ({
...styles, ...styles,
zIndex: "auto", zIndex: "auto",
}), }),
})} ...styles,
}}
value={value}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
className={cssNames("Select", this.themeClass, className)} className={cssNames("Select", this.themeClass, className)}
classNamePrefix="Select" classNamePrefix="Select"

View File

@ -34,6 +34,7 @@ import joinPathsInjectable from "../common/path/join-paths.injectable";
import { joinPathsFake } from "../common/test-utils/join-paths-fake"; import { joinPathsFake } from "../common/test-utils/join-paths-fake";
import hotbarStoreInjectable from "../common/hotbar-store.injectable"; import hotbarStoreInjectable from "../common/hotbar-store.injectable";
import terminalSpawningPoolInjectable from "./components/dock/terminal/terminal-spawning-pool.injectable"; import terminalSpawningPoolInjectable from "./components/dock/terminal/terminal-spawning-pool.injectable";
import hostedClusterIdInjectable from "../common/cluster-store/hosted-cluster-id.injectable";
export const getDiForUnitTesting = ( export const getDiForUnitTesting = (
{ doGeneralOverrides } = { doGeneralOverrides: false }, { doGeneralOverrides } = { doGeneralOverrides: false },
@ -59,6 +60,7 @@ export const getDiForUnitTesting = (
di.override(isLinuxInjectable, () => false); di.override(isLinuxInjectable, () => false);
di.override(terminalSpawningPoolInjectable, () => new HTMLElement()); di.override(terminalSpawningPoolInjectable, () => new HTMLElement());
di.override(hostedClusterIdInjectable, () => undefined);
di.override(getAbsolutePathInjectable, () => getAbsolutePathFake); di.override(getAbsolutePathInjectable, () => getAbsolutePathFake);
di.override(joinPathsInjectable, () => joinPathsFake); di.override(joinPathsInjectable, () => joinPathsFake);