data attribute not working in kendo-tabstrip-tab

1 Answer 110 Views
TabStrip
Akash
Top achievements
Rank 1
Akash asked on 02 Aug 2023, 06:30 PM

Adding different way but not able to see in browser.

Let me know If I miss anything. 

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin
Telerik team
answered on 07 Aug 2023, 01:31 PM

Hi Akash,

Thank you for the provided details.

The <kendo-tabstrip-tab> component isn't rendered in the DOM. Instead, the tabs are transpired as an unordered list (ul) with <li> tags inside, and only the supported properties are taken into consideration.

Please could you provide some more details about the desired end goal, and how the attribute is going to be used so to that we can think of a way to provide an alternative solution. Thank you in advance.

Regards,
Martin
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Akash
Top achievements
Rank 1
commented on 16 Aug 2023, 05:30 AM

Thanks Martin 

My goal is to add unique id inside <kendo-tabstrip-tab> so QA can use it that unique id in Automation testing. I am thinking to add data attribute inside the <kendo-tabstrip-tab>

Example:

Martin
Telerik team
commented on 18 Aug 2023, 10:52 AM

Hi Akash,

Thank you for providing additional context about this case.

A possible approach to distinguish the tabs is by using specific CSS selectors such as:

- kendo-tabstrip li:nth-of-type(1) -  select tab by index

- kendo-tabstrip li[.="Paris"] -> select tab by rendered text inside

Alternatively, you can set a specific id to the <li> elements by using custom JavaScript code:

const items = Array.from(
      document.querySelectorAll(
        '.k-tabstrip .k-tabstrip-items-wrapper .k-tabstrip-items > li'
      )
    );
    items.forEach((el, index) => {
      el.setAttribute('id', `my-index-${index}`);
    });

Here is an example

https://stackblitz.com/edit/angular-cvn2t9?file=src%2Fapp%2Fapp.component.ts

I hope this sheds some light on the case.

Regards,

Martin

 

Akash
Top achievements
Rank 1
commented on 31 Aug 2023, 06:26 AM

It is helpful. 

Thanks Martin.

 

 

Tags
TabStrip
Asked by
Akash
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or