Skip to content

Add test attributes to selectable components #29

@ohmnoms

Description

@ohmnoms

Adding configurable data- attributes (e.g. data-aui or similar) to key selectable elements would greatly enhance testability and maintainability of automation scripts while avoiding any potential changes to class names or attributes.


Proposal

  • Target Areas:

    • Tree node containers
    • Expand/Collapse toggles
    • Selection checkboxes or clickable text
  • Implementation Idea:

    • Introduce inputs like testIdPrefix?: string and testIdAttr?: string on the component so users can specify a prefix or naming convention for test attributes.

Example Usage

<ngx-json-treeview
  [items]="items"
  [config]="config"
  [testIdPrefix]="'jsonTree'"
  [testIdAttr]="'data-aui'"
></ngx-json-treeview>

<div class="segment" data-aui="jsonTree-node-123">
  <div class="toggler" data-aui="jsonTree-toggle-123"></button>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions