element-vir - v26.14.0
    Preparing search index...

    Variable testIdConst

    testId: (this: void, attributeValue: string) => DirectiveResult<typeof __class> = attributeDirective

    Assigns the given id as a test id attribute to the attached element.

    Type Declaration

      • (this: void, attributeValue: string): DirectiveResult<typeof __class>
      • Instantiates the attribute directive. This must be used on an element inside of an HTML template.

        Parameters

        • this: void
        • attributeValue: string

        Returns DirectiveResult<typeof __class>

    import {html, defineElement, testId} from 'element-vir';

    const MyElement = defineElement()({
    tagName: 'my-element',
    render() {
    return html`
    <div ${testId('my-test')}>Some div</div>
    `;
    },
    });