Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

449
Vistas
Jest testing : Get Actual height/width of element which are responsive

I have a requirement where I have created HTML bootstrap modal as responsive based on screen resolution and for that, I have used percentage as a unit while setting height/width like below:

<div id="main-popup" class="modal" style="width:500px;height:450px;'>
  <div class="modal-dialog">
    <div class="modal-header" style="width:100%;height:5%"></div>
    <div class="modal-body" style="width:100%;height:90%">
        <div class="left" style="width:25%"></div>
        <div class="right" style="width:75%">
          <table table-hgight="430">
            ....
          </table>
        </div>
    </div>
    <div class="modal-footer" style="width:100%;height:5%"></div>
  </div>
</div>

To make this above popup responsive, I have added the below code in javascript:

$("#main-popup).css('width', '80%');
$("#main-popup).css('height', '75%');
$("#main-popup table").attr("table-height", $("#main-popup).height() * 0.9);

This works perfectly in the application, but in jest testing when I tried to get the actual height/width of those modal elements it's always returning 0. Not sure what I'm missing here.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda