liferay / clay

A web implementation of the Lexicon Experience Language
http://clayui.com
Other
208 stars 483 forks source link

LPD-33580 Add menu element attributes to the clay localized Input API #5854

Closed igor-franca closed 3 months ago

igor-franca commented 3 months ago

Hey team, my goal here is to be able to use menuElementAttrs thought the Clay Input Localized.

Related issue

My ultimate goal is to implement this new property in Frontend-infra's InputLocalized component to set the z-index to dropdown.

I was trying to implement a test like that:

it("renders with menu element attributes", () => {
const {container} = render(
    <ClayLocalizedInput
        id="locale1"
        locales={locales}
                menuElementAttrs={{className: 'custom-class'}}
        onSelectedLocaleChange={() => {}}
        onTranslationsChange={() => {}}
        selectedLocale={locales[0]!}
        spritemap="/path/to/svg"
        translations={{
            'en-US': 'Apple',
            'es-ES': 'Manzana',
        }}
    />
);

fireEvent.click(
    container.querySelector('.dropdown-toggle') as HTMLButtonElement,
    {}
);

const dropdownMenu = document.querySelector('.dropdown-menu') as HTMLButtonElement;

expect(dropdownMenu).toHaveClass('custom-class');

But I wasn't successful, my dropdownMenu got a null value and I unfortunately didn't have the necessary time to debug. But I hope everything is ok with the contribution.