Skip to content

[WC-2902] Move caption error to warning #1545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/datagrid-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We changed the severity for missing column captions from error to warning

## [2.30.3] - 2025-03-20

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/datagrid-web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mendix/datagrid-web",
"widgetName": "Datagrid",
"version": "2.30.3",
"version": "2.30.4",
"description": "",
"copyright": "© Mendix Technology BV 2025. All rights reserved.",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
(refs.reference?.current as HTMLElement)?.focus();
}, 10);
}
}, [show]);

Check warning on line 58 in packages/pluggableWidgets/datagrid-web/src/components/ColumnSelector.tsx

View workflow job for this annotation

GitHub Actions / Run code quality check

React Hook useLayoutEffect has missing dependencies: 'refs.floating' and 'refs.reference'. Either include them or remove the dependency array

const optionsComponent = (
<ul
Expand Down Expand Up @@ -112,7 +112,7 @@
onChange={onChangeStub}
/>
<label htmlFor={`${props.id}_checkbox_toggle_${index}`} style={{ pointerEvents: "none" }}>
{column.header}
{column.header.trim() || "<...>"}
</label>
</li>
) : null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createElement } from "react";
import { render, screen } from "@testing-library/react";
import { act, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import "@testing-library/jest-dom";
import { ColumnSelector, ColumnSelectorProps } from "../ColumnSelector";
Expand All @@ -20,7 +20,9 @@ describe("Column Selector", () => {
expect(document.body).toHaveFocus();

const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
await user.click(screen.getByRole("button"));
await act(async () => {
await user.click(screen.getByRole("button"));
});

const element = document.querySelector(".column-selectors");
expect(element?.classList.contains("overflow")).toBe(false);
Expand All @@ -31,9 +33,11 @@ describe("Column Selector", () => {
expect(document.body).toHaveFocus();

const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
await user.click(screen.getByRole("button"));
await act(async () => {
await user.click(screen.getByRole("button"));
});

jest.runOnlyPendingTimers();
jest.advanceTimersByTime(100);

const items = screen.getAllByRole("menuitem");
expect(items[0]).toHaveFocus();
Expand All @@ -44,16 +48,20 @@ describe("Column Selector", () => {
expect(document.body).toHaveFocus();

const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
await user.click(screen.getByRole("button"));
await act(async () => {
await user.click(screen.getByRole("button"));
});

jest.runOnlyPendingTimers();
jest.advanceTimersByTime(100);

const items = screen.getAllByRole("menuitem");
expect(items[0]).toHaveFocus();

await user.tab({ shift: true });
await act(async () => {
await user.tab({ shift: true });
});

jest.runOnlyPendingTimers();
jest.advanceTimersByTime(100);

expect(screen.getByRole("button")).toHaveFocus();
});
Expand Down Expand Up @@ -81,17 +89,24 @@ describe("Column Selector", () => {
expect(document.body).toHaveFocus();

const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
await user.click(screen.getByRole("button"));

jest.runOnlyPendingTimers();
await act(async () => {
await user.click(screen.getByRole("button"));
});
jest.advanceTimersByTime(100);

const items = screen.getAllByRole("menuitem");
expect(items[0]).toHaveFocus();
await user.tab();
expect(items[1]).toHaveFocus();
await user.tab();

jest.runOnlyPendingTimers();
await act(async () => {
await user.tab();
});
jest.advanceTimersByTime(100);

expect(items[1]).toHaveFocus();
await act(async () => {
await user.tab();
});
jest.advanceTimersByTime(100);

expect(screen.getByRole("button")).toHaveFocus();
});
Expand Down Expand Up @@ -130,19 +145,26 @@ describe("Column Selector", () => {
expect(document.body).toHaveFocus();

const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
await user.click(screen.getByRole("button"));

jest.runOnlyPendingTimers();
await act(async () => {
await user.click(screen.getByRole("button"));
});
jest.advanceTimersByTime(100);

const items = screen.getAllByRole("menuitem");
expect(items).toHaveLength(3);
expect(items[0]).toHaveFocus();

await user.tab();
expect(items[1]).toHaveFocus();
await user.keyboard("{Escape}");
await act(async () => {
await user.tab();
});
jest.advanceTimersByTime(100);

jest.runOnlyPendingTimers();
expect(items[1]).toHaveFocus();
await act(async () => {
await user.keyboard("{Escape}");
});
jest.advanceTimersByTime(100);

expect(screen.getByRole("button")).toHaveFocus();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const checkHidableSettings = (
if (values.columnsHidable && column.hidable !== "no" && !column.header) {
return {
property: columnPropPath("hidable", index),
severity: "warning",
message:
"A caption is required if 'Can hide' is Yes or Yes, hidden by default. This can be configured under 'Column capabilities' in the column item properties"
};
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/datagrid-web/src/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="Datagrid" version="2.30.3" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="Datagrid" version="2.30.4" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="Datagrid.xml" />
</widgetFiles>
Expand Down
Loading