Skip to content
Snippets Groups Projects
Unverified Commit c1862eea authored by Romeo Van Snick's avatar Romeo Van Snick Committed by GitHub
Browse files

Fixed width filters (#49464)

* Fix dirty yarn.lock

* Use fix width popover for filter pickers

* Add e2e test to reproduce #49321

* Do not rely on implementation width for test
parent 060baf0c
No related branches found
No related tags found
No related merge requests found
......@@ -1513,3 +1513,36 @@ describe("Issue 48851", () => {
popover().button("Add filter").should("be.visible");
});
});
describe("issue 49321", () => {
beforeEach(() => {
restore();
cy.signInAsNormalUser();
});
it("should not require multiple clicks to apply a filter (metabase#49321)", () => {
openProductsTable({ mode: "notebook" });
filter({ mode: "notebook" });
popover().within(() => {
cy.findByText("Title").click();
cy.findByText("Is").click();
});
popover().last().findByText("Contains").click();
popover().then($popover => {
const { width } = $popover[0].getBoundingClientRect();
cy.wrap(width).as("initialWidth");
});
popover()
.findByPlaceholderText("Enter some text")
.type("aaaaaaaaaa, bbbbbbbbbbb,");
cy.get("@initialWidth").then(initialWidth => {
popover().should($popover => {
const { width } = $popover[0].getBoundingClientRect();
expect(width).to.eq(initialWidth);
});
});
});
});
......@@ -14,7 +14,7 @@ import { NumberFilterValuePicker } from "../../FilterValuePicker";
import { FilterOperatorPicker } from "../FilterOperatorPicker";
import { FilterPickerFooter } from "../FilterPickerFooter";
import { FilterPickerHeader } from "../FilterPickerHeader";
import { MAX_WIDTH, MIN_WIDTH } from "../constants";
import { WIDTH } from "../constants";
import type { FilterPickerWidgetProps } from "../types";
import { CoordinateColumnPicker } from "./CoordinateColumnPicker";
......@@ -74,8 +74,7 @@ export function CoordinateFilterPicker({
return (
<Box
component="form"
miw={MIN_WIDTH}
maw={MAX_WIDTH}
w={WIDTH}
data-testid="coordinate-filter-picker"
onSubmit={handleSubmit}
>
......
......@@ -2,10 +2,9 @@ import styled from "@emotion/styled";
import AccordionList from "metabase/core/components/AccordionList";
import { MAX_WIDTH, MIN_WIDTH } from "../constants";
import { WIDTH } from "../constants";
export const StyledAccordionList = styled(AccordionList)`
color: var(--mb-color-filter);
min-width: ${MIN_WIDTH}px;
max-width: ${MAX_WIDTH}px;
width: ${WIDTH}px;
`;
......@@ -14,7 +14,7 @@ import { NumberFilterValuePicker } from "../../FilterValuePicker";
import { FilterOperatorPicker } from "../FilterOperatorPicker";
import { FilterPickerFooter } from "../FilterPickerFooter";
import { FilterPickerHeader } from "../FilterPickerHeader";
import { MAX_WIDTH, MIN_WIDTH } from "../constants";
import { WIDTH } from "../constants";
import type { FilterPickerWidgetProps } from "../types";
export function NumberFilterPicker({
......@@ -66,8 +66,7 @@ export function NumberFilterPicker({
return (
<Box
component="form"
miw={MIN_WIDTH}
maw={MAX_WIDTH}
w={WIDTH}
data-testid="number-filter-picker"
onSubmit={handleSubmit}
>
......
......@@ -13,7 +13,7 @@ import { StringFilterValuePicker } from "../../FilterValuePicker";
import { FilterOperatorPicker } from "../FilterOperatorPicker";
import { FilterPickerFooter } from "../FilterPickerFooter";
import { FilterPickerHeader } from "../FilterPickerHeader";
import { MAX_WIDTH, MIN_WIDTH } from "../constants";
import { WIDTH } from "../constants";
import type { FilterPickerWidgetProps } from "../types";
export function StringFilterPicker({
......@@ -66,8 +66,7 @@ export function StringFilterPicker({
return (
<Box
component="form"
miw={MIN_WIDTH}
maw={MAX_WIDTH}
w={WIDTH}
data-testid="string-filter-picker"
onSubmit={handleSubmit}
>
......
......@@ -12,7 +12,7 @@ import * as Lib from "metabase-lib";
import { FilterOperatorPicker } from "../FilterOperatorPicker";
import { FilterPickerFooter } from "../FilterPickerFooter";
import { FilterPickerHeader } from "../FilterPickerHeader";
import { MAX_WIDTH, MIN_WIDTH } from "../constants";
import { WIDTH } from "../constants";
import type { FilterPickerWidgetProps } from "../types";
export function TimeFilterPicker({
......@@ -62,8 +62,7 @@ export function TimeFilterPicker({
return (
<Box
component="form"
miw={MIN_WIDTH}
maw={MAX_WIDTH}
w={WIDTH}
data-testid="time-filter-picker"
onSubmit={handleSubmit}
>
......
export const MIN_WIDTH = 300;
export const MAX_WIDTH = 410;
export const MIN_WIDTH = 380;
export const MAX_WIDTH = 380;
export const WIDTH = 380;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment