Skip to content
Snippets Groups Projects
Unverified Commit 619202e3 authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

Adds export description when unformatted option is selected (#48869)

* hide formatted export description when unformatted

* add unformatted copy
parent ab604f29
No related branches found
No related tags found
No related merge requests found
......@@ -53,10 +53,16 @@ export const ExportSettingsWidget = ({
<Radio value="false" label={t`Unformatted`} />
</Group>
</Radio.Group>
<Text
data-testid="formatting-description"
size="sm"
color="text-medium"
>{t`E.g. September 6, 2024 or $187.50, like in ${applicationName}`}</Text>
>
{isFormattingEnabled
? t`E.g. September 6, 2024 or $187.50, like in ${applicationName}`
: t`E.g. 2024-09-06 or 187.50, like in the database`}
</Text>
</Stack>
) : null}
{canConfigurePivoting ? (
......
......@@ -96,7 +96,10 @@ describe("QueryDownloadPopover", () => {
const { onDownload } = setup();
await userEvent.click(screen.getByLabelText(`.${format}`));
await userEvent.click(screen.getByLabelText(`Unformatted`));
await userEvent.click(screen.getByLabelText("Unformatted"));
expect(screen.queryByTestId("formatting-description")).toHaveTextContent(
`E.g. 2024-09-06 or 187.50, like in the database`,
);
expect(
screen.queryByLabelText("Keep data pivoted"),
).not.toBeInTheDocument();
......@@ -112,6 +115,31 @@ describe("QueryDownloadPopover", () => {
},
);
it.each(["csv", "json", "xlsx"])(
"should trigger formatted download for %s format",
async format => {
const { onDownload } = setup();
await userEvent.click(screen.getByLabelText(`.${format}`));
await userEvent.click(screen.getByLabelText("Formatted"));
expect(screen.queryByTestId("formatting-description")).toHaveTextContent(
`E.g. September 6, 2024 or $187.50, like in Metabase`,
);
expect(
screen.queryByLabelText("Keep data pivoted"),
).not.toBeInTheDocument();
await userEvent.click(
await screen.findByTestId("download-results-button"),
);
expect(onDownload).toHaveBeenCalledWith({
type: format,
enableFormatting: true,
enablePivot: false,
});
},
);
it("should not trigger unformatted download for png format", async () => {
const format = "png";
const { onDownload } = setup({ card: { ...TEST_CARD, display: "line" } });
......
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