Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ac5362a
feat: implement searchable multi-select filtering for java instrument…
hussainjamal760 May 8, 2026
55a689e
Fix:Updated test cases for filters and fixed lint and format errors
hussainjamal760 May 8, 2026
50ac311
fix: resolved all copilot suggestions
hussainjamal760 May 9, 2026
3fa1894
fix: Removed tracing and metrics
hussainjamal760 May 9, 2026
4d19142
progressive disclosure for badges
hussainjamal760 May 9, 2026
0973491
fix: Radix implemented instead of custom build dropdown
hussainjamal760 May 9, 2026
57baea0
Merge branch 'main' into feat/instrumentation-filters
hussainjamal760 May 9, 2026
94a8a96
fix: address review feedback for filtering UI and tests
hussainjamal760 May 9, 2026
db40589
Merge branch 'feat/instrumentation-filters' of https://github.com/hus…
hussainjamal760 May 9, 2026
1aedcc2
Failed test Fixed
hussainjamal760 May 9, 2026
17a7dc2
Merge branch 'main' into feat/instrumentation-filters
hussainjamal760 May 9, 2026
ae24c76
refactor: improve badge hierarchy and reuse formatting utilities
hussainjamal760 May 9, 2026
915b2df
Merge branch 'main' into feat/instrumentation-filters
hussainjamal760 May 9, 2026
99edb28
Fix: build fixed
hussainjamal760 May 9, 2026
878f99b
Merge branch 'feat/instrumentation-filters' of https://github.com/hus…
hussainjamal760 May 9, 2026
5e3c0e7
Potential fix for pull request finding
hussainjamal760 May 9, 2026
7088dc1
Fix: node type added
hussainjamal760 May 9, 2026
aa4aff9
Fix: removing the unused parameter
hussainjamal760 May 9, 2026
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
28 changes: 28 additions & 0 deletions ecosystem-explorer/bun.lock

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

2 changes: 2 additions & 0 deletions ecosystem-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"@grafana/faro-react": "^2.4.0",
"@grafana/faro-web-tracing": "^2.4.0",
"@radix-ui/react-hover-card": "^1.1.15",
"@radix-ui/react-popover": "^1.1.15",
"@radix-ui/react-tabs": "^1.1.13",
"@radix-ui/react-tooltip": "^1.2.8",
"cmdk": "^1.1.1",
"idb": "^8.0.3",
"js-yaml": "^4.1.1",
"lucide-react": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { SearchableMultiSelect, SelectedChips } from "./searchable-multi-select";

describe("SearchableMultiSelect", () => {
const options = ["Apple", "Banana", "Cherry", "Date", "Elderberry"];
const defaultProps = {
label: "Fruits",
placeholder: "Select fruits...",
options,
selected: [],
onChange: vi.fn(),
};

it("renders correctly with placeholder", () => {
render(<SearchableMultiSelect {...defaultProps} />);
expect(screen.getByText("Fruits")).toBeInTheDocument();
expect(screen.getByText("Select fruits...")).toBeInTheDocument();
});

it("shows number of selected items when selection exists", () => {
render(<SearchableMultiSelect {...defaultProps} selected={["Apple", "Banana"]} />);
expect(screen.getByText("2 selected")).toBeInTheDocument();
});

it("opens popover on click and displays options", async () => {
const user = userEvent.setup();
render(<SearchableMultiSelect {...defaultProps} />);

const trigger = screen.getByRole("button", { name: "Fruits" });
await user.click(trigger);

expect(screen.getByRole("dialog")).toBeInTheDocument();

for (const option of options) {
expect(screen.getByRole("option", { name: option })).toBeInTheDocument();
}
});

it("filters options when typing in search input", async () => {
const user = userEvent.setup();
render(<SearchableMultiSelect {...defaultProps} />);

await user.click(screen.getByRole("button", { name: "Fruits" }));

const searchInput = screen.getByPlaceholderText("Search...");
await user.type(searchInput, "ba");

expect(screen.getByRole("option", { name: "Banana" })).toBeInTheDocument();
expect(screen.queryByRole("option", { name: "Apple" })).not.toBeInTheDocument();
});

it("calls onChange when an option is toggled", async () => {
const user = userEvent.setup();
const onChange = vi.fn();
render(<SearchableMultiSelect {...defaultProps} onChange={onChange} />);

await user.click(screen.getByRole("button", { name: "Fruits" }));
await user.click(screen.getByRole("option", { name: "Banana" }));

expect(onChange).toHaveBeenCalledWith(["Banana"]);
});

it("removes option if already selected", async () => {
const user = userEvent.setup();
const onChange = vi.fn();
render(
<SearchableMultiSelect {...defaultProps} selected={["Apple", "Banana"]} onChange={onChange} />
);

await user.click(screen.getByRole("button", { name: "Fruits" }));
await user.click(screen.getByRole("option", { name: "Banana" }));

expect(onChange).toHaveBeenCalledWith(["Apple"]);
});
});

describe("SelectedChips", () => {
it("renders nothing if selected is empty", () => {
const { container } = render(<SelectedChips selected={[]} onRemove={vi.fn()} />);
expect(container.firstChild).toBeNull();
});

it("renders chips for selected items", () => {
render(<SelectedChips selected={["Apple", "Banana"]} onRemove={vi.fn()} />);
expect(screen.getByText("Apple")).toBeInTheDocument();
expect(screen.getByText("Banana")).toBeInTheDocument();
});

it("calls onRemove when a chip's remove button is clicked", async () => {
const user = userEvent.setup();
const onRemove = vi.fn();
render(<SelectedChips selected={["Apple", "Banana"]} onRemove={onRemove} />);

const removeAppleButton = screen.getByRole("button", { name: "Remove Apple" });
await user.click(removeAppleButton);

expect(onRemove).toHaveBeenCalledWith("Apple");
});
});
Loading
Loading