From 2c4a4c4d858346997c3d5e76c1bafb3e41593d06 Mon Sep 17 00:00:00 2001 From: Tomi Virkki Date: Wed, 13 Dec 2023 14:37:12 +0200 Subject: [PATCH] fix: map falsy boolean properties as undefined --- src/utils/createComponent.ts | 18 ++++++++++++++++-- test/Select.spec.tsx | 27 ++++++++++++++++++++++++++- test/SideNav.spec.tsx | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 test/SideNav.spec.tsx diff --git a/src/utils/createComponent.ts b/src/utils/createComponent.ts index 3a86a5a6..f21f3409 100644 --- a/src/utils/createComponent.ts +++ b/src/utils/createComponent.ts @@ -4,7 +4,7 @@ import { type WebComponentProps as _WebComponentProps, } from '@lit-labs/react'; import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js'; -import type React from 'react'; +import React from 'react'; import type { RefAttributes } from 'react'; import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js'; @@ -81,7 +81,7 @@ export function createComponent(options: Options): any { const { elementClass } = options; - return _createComponent( + const component = _createComponent( '_properties' in elementClass ? { ...options, @@ -98,4 +98,18 @@ export function createComponent[0]>((props, ref) => { + // Map falsy boolean properties as `undefined` to avoid them from rendering with the + // value "false" in the attribute, for example `