## Description - Creates a new IDE component for `BottomView` that can be either collapsed or closed. - Creates a different view for `EntityTabs` when it is collapsed - Start using the collapsed version for Entity Responses (Query / API / JS) Fixes #33333 Fixes #33336 Fixes #31402 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!CAUTION] > 🔴 🔴 🔴 Some tests have failed. > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9175565108> > Commit: 8f3b96eb0b7d18301fb902cddd13755abee38871 > Cypress dashboard: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9175565108&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a> > The following are new failures, please fix them before merging the PR: <ol> > <li>cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js > <li>cypress/e2e/Regression/ClientSide/Widgets/Others/IconButton_2_spec.ts </ol> > To know the list of identified flaky tests - <a href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master" target="_blank">Refer here</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [x] Yes - [ ] No
228 lines
6.0 KiB
TypeScript
228 lines
6.0 KiB
TypeScript
import React from "react";
|
|
import { act, fireEvent, render } from "@testing-library/react";
|
|
import BottomView from "./BottomView";
|
|
import { ViewHideBehaviour } from "../Interfaces/View";
|
|
import { noop } from "lodash";
|
|
import "@testing-library/jest-dom";
|
|
import "jest-styled-components";
|
|
|
|
describe("BottomView", () => {
|
|
describe("ViewHideBehaviour.COLLAPSE", () => {
|
|
// HIDDEN = FALSE
|
|
it("it is visible when hidden = false", () => {
|
|
const { getByText } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.COLLAPSE}
|
|
height={300}
|
|
hidden={false}
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(getByText("Hey test")).toBeTruthy();
|
|
});
|
|
it("it can be toggled when hidden = false", () => {
|
|
const onViewHideToggle = jest.fn();
|
|
const { getByRole } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.COLLAPSE}
|
|
height={300}
|
|
hidden={false}
|
|
onHideClick={onViewHideToggle}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
const viewHideToggle = getByRole("button");
|
|
act(() => {
|
|
fireEvent.click(viewHideToggle);
|
|
});
|
|
expect(onViewHideToggle).toBeCalled();
|
|
});
|
|
|
|
it("assert container height when hidden = false", () => {
|
|
const { container } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.COLLAPSE}
|
|
height={300}
|
|
hidden={false}
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(container.children[0]).toHaveAttribute("style", "height: 300px;");
|
|
});
|
|
|
|
// HIDDEN = TRUE
|
|
it("it is visible when hidden = true", () => {
|
|
const { getByText } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.COLLAPSE}
|
|
height={300}
|
|
hidden
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(getByText("Hey test")).toBeTruthy();
|
|
});
|
|
|
|
it("it can be toggled when hidden = true", () => {
|
|
const onViewHideToggle = jest.fn();
|
|
const { getByRole } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.COLLAPSE}
|
|
height={300}
|
|
hidden
|
|
onHideClick={onViewHideToggle}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
const viewHideToggle = getByRole("button");
|
|
act(() => {
|
|
fireEvent.click(viewHideToggle);
|
|
});
|
|
expect(onViewHideToggle).toBeCalled();
|
|
});
|
|
|
|
it("assert container height when hidden = true", () => {
|
|
const { container } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.COLLAPSE}
|
|
height={300}
|
|
hidden
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(container.children[0]).toHaveAttribute("style", "height: 38px;");
|
|
});
|
|
});
|
|
|
|
describe("ViewHideBehaviour.CLOSE", () => {
|
|
// HIDDEN = FALSE
|
|
it("it is visible when hidden = false", () => {
|
|
const { getByText } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.CLOSE}
|
|
height={300}
|
|
hidden={false}
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(getByText("Hey test")).toBeTruthy();
|
|
});
|
|
it("it can be toggled when hidden = false", () => {
|
|
const onViewHideToggle = jest.fn();
|
|
const { getByRole } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.CLOSE}
|
|
height={300}
|
|
hidden={false}
|
|
onHideClick={onViewHideToggle}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
const viewHideToggle = getByRole("button");
|
|
act(() => {
|
|
fireEvent.click(viewHideToggle);
|
|
});
|
|
expect(onViewHideToggle).toBeCalled();
|
|
});
|
|
|
|
it("assert container height when hidden = false", () => {
|
|
const { container } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.CLOSE}
|
|
height={300}
|
|
hidden={false}
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(container.children[0]).toHaveAttribute("style", "height: 300px;");
|
|
});
|
|
|
|
// HIDDEN = TRUE
|
|
it("it is visible when hidden = true", () => {
|
|
const { getByText } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.CLOSE}
|
|
height={300}
|
|
hidden
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(getByText("Hey test")).toBeTruthy();
|
|
});
|
|
|
|
it("it can be toggled when hidden = true", () => {
|
|
const onViewHideToggle = jest.fn();
|
|
const { getByRole } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.CLOSE}
|
|
height={300}
|
|
hidden
|
|
onHideClick={onViewHideToggle}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
const viewHideToggle = getByRole("button");
|
|
act(() => {
|
|
fireEvent.click(viewHideToggle);
|
|
});
|
|
expect(onViewHideToggle).toBeCalled();
|
|
});
|
|
|
|
it("assert container height when hidden = true", () => {
|
|
const { container } = render(
|
|
<BottomView
|
|
behaviour={ViewHideBehaviour.CLOSE}
|
|
height={300}
|
|
hidden
|
|
onHideClick={noop}
|
|
setHeight={noop}
|
|
>
|
|
<div id="bottomview">Hey test</div>
|
|
</BottomView>,
|
|
);
|
|
|
|
expect(container.children[0]).toHaveAttribute("style", "height: 0px;");
|
|
});
|
|
});
|
|
});
|