Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

234
Visualizações
How and where can I add testid props to this code

How can i add the test-id props to enable testing for Name Row, cONTENT Aggregrate and Content Title.

I am using react. I want to add test-id attribute for all Nav links. How and where can I add this? I have tried adding it in the const Array


Array<NavLists> = [

 

{ id: 'nav__name-row, title: 'Name

Row', link: getNameUrl() },

  { id:

'nav__content-aggregate, title: 'Content Aggregrate, link: getDAggregrateUrl()

},

  { id:

'nav__content-title', title: 'Content Title', link: getTitleUrl() },

  { id: 'nav__content-index',

title: 'Content Index, link: getIndexUrl() }

]



Const HorizontalNav: React.FC<Props> = (props) => {



Const {location} = props

Const {pathname} = location

Const founditem = navLists.find(navItem) => pathname.include(navItem.link)) || navLists[0]



Return (

<div>

<Tabs selectedTabiD = {founditem.id)>

{navItems.map((navitem) => (

<Tab key = {navItem.id} id = {navitem.id}>

{navitem.id === founditem.id ? <span>{navItem.title}</span> : <Link to {navItem.link}>{navitem.title}</link>}

</tab> ```
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you need to attach a data-* attribute for testing then the syntax is likely data-testid.

Use data attributes

<Link
  data-testid={navItem.id}
  to={navItem.link}
>
  {navitem.title}
</link>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda