mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-02-03 17:14:37 +00:00
added search icon and updated the text
This commit is contained in:
@@ -125,6 +125,7 @@ export const SearchableDropdown = <T,>({
|
||||
value={filterText}
|
||||
onChange={(_, newValue) => setFilterText(newValue || "")}
|
||||
styles={customSearchBoxStyles}
|
||||
showIcon={true}
|
||||
/>
|
||||
<Stack styles={listContainerStyles}>
|
||||
{filteredItems && filteredItems.length > 0 ? (
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
jest.mock("../../../hooks/useSubscriptions");
|
||||
jest.mock("../../../hooks/useDatabaseAccounts");
|
||||
import React from "react";
|
||||
import { render, fireEvent, screen } from "@testing-library/react";
|
||||
import "@testing-library/jest-dom";
|
||||
import { AccountSwitcher } from "./AccountSwitcher";
|
||||
import { useSubscriptions } from "../../../hooks/useSubscriptions";
|
||||
import { useDatabaseAccounts } from "../../../hooks/useDatabaseAccounts";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { DatabaseAccount, Subscription } from "../../../Contracts/DataModels";
|
||||
import { useDatabaseAccounts } from "../../../hooks/useDatabaseAccounts";
|
||||
import { useSubscriptions } from "../../../hooks/useSubscriptions";
|
||||
import { AccountSwitcher } from "./AccountSwitcher";
|
||||
|
||||
it("calls setAccount from parent component", () => {
|
||||
const armToken = "fakeToken";
|
||||
@@ -25,7 +25,7 @@ it("calls setAccount from parent component", () => {
|
||||
expect(screen.getByLabelText("Subscription")).toHaveTextContent("Select a Subscription");
|
||||
fireEvent.click(screen.getByText("Select a Subscription"));
|
||||
fireEvent.click(screen.getByText(subscriptions[0].displayName));
|
||||
expect(screen.getByLabelText("Cosmos DB Account Name")).toHaveTextContent("Select an Account");
|
||||
expect(screen.getByLabelText("Cosmos DB Account")).toHaveTextContent("Select an Account");
|
||||
fireEvent.click(screen.getByText("Select an Account"));
|
||||
fireEvent.click(screen.getByText(accounts[0].name));
|
||||
expect(setDatabaseAccount).toHaveBeenCalledWith(accounts[0]);
|
||||
|
||||
@@ -18,14 +18,14 @@ export const SwitchAccount: FunctionComponent<Props> = ({
|
||||
}: Props) => {
|
||||
return (
|
||||
<SearchableDropdown<DatabaseAccount>
|
||||
label="Cosmos DB Account Name"
|
||||
label="Cosmos DB Account"
|
||||
items={accounts}
|
||||
selectedItem={selectedAccount}
|
||||
onSelect={(account) => setSelectedAccountName(account.name)}
|
||||
getKey={(account) => account.name}
|
||||
getDisplayText={(account) => account.name}
|
||||
placeholder="Select an Account"
|
||||
filterPlaceholder="Filter accounts"
|
||||
filterPlaceholder="Search by Account name"
|
||||
className="accountSwitchAccountDropdown"
|
||||
disabled={!accounts || accounts.length === 0}
|
||||
onDismiss={dismissMenu}
|
||||
|
||||
@@ -23,7 +23,7 @@ export const SwitchSubscription: FunctionComponent<Props> = ({
|
||||
getKey={(sub) => sub.subscriptionId}
|
||||
getDisplayText={(sub) => sub.displayName}
|
||||
placeholder="Select a Subscription"
|
||||
filterPlaceholder="Filter subscriptions"
|
||||
filterPlaceholder="Search by Subscription name"
|
||||
className="accountSwitchSubscriptionDropdown"
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user