From ba45dbc87499855e0eb72a2854dd00137313c6e6 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 23 Nov 2026 14:56:08 +0100 Subject: [PATCH] fix(admin): draw no divider under an addon whose sub-rows render nothing A switched-off booking mail import passed false as its only child, which Children.count counts, so an empty list with a top border showed under the row. --- .../src/components/Admin/AddonTile.test.tsx | 23 +++++++++++++++++++ client/src/components/Admin/AddonTile.tsx | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 client/src/components/Admin/AddonTile.test.tsx diff --git a/client/src/components/Admin/AddonTile.test.tsx b/client/src/components/Admin/AddonTile.test.tsx new file mode 100644 index 000000000..e137b24e2 --- /dev/null +++ b/client/src/components/Admin/AddonTile.test.tsx @@ -0,0 +1,23 @@ +// FE-ADMIN-ADDONTILE-001 +import { describe, expect, it } from 'vitest'; +import { render } from '../../../tests/helpers/render'; +import AddonTile from './AddonTile'; + +describe('AddonTile', () => { + it('FE-ADMIN-ADDONTILE-001: sub-rows that render nothing draw no list and no line', () => { + const off = false; + const { container, rerender } = render( + + {off &&
  • Set up
  • } +
    + ); + expect(container.querySelector('ul')).toBeNull(); + rerender( + + {null} +
  • Set up
  • +
    + ); + expect(container.querySelectorAll('ul > li')).toHaveLength(1); + }); +}); diff --git a/client/src/components/Admin/AddonTile.tsx b/client/src/components/Admin/AddonTile.tsx index 953fc3047..f51526a49 100644 --- a/client/src/components/Admin/AddonTile.tsx +++ b/client/src/components/Admin/AddonTile.tsx @@ -55,7 +55,7 @@ export default function AddonTile({ {/* An empty shelf (a tours addon without its options here) draws no line. */} - {Children.count(children) > 0 && } + {Children.toArray(children).length > 0 && } ) }