Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
How do I dispatch multiple dispatch keypress events in javascript(jest testing)?

Expectations:

I want to dispatch multiple keypress events simutamusly. For example, I want my test to simulate a shift+tab event with

The code :

...
describe("ESC press", () => {

// How do i use this dispatch event to simulate a key press of shift+tab 

    document.dispatchEvent(escapeEvent)
    });
...
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use this technique twice to simulate multiple hold key events :

const shift = new KeyboardEvent('keydown', {'keyCode': 16});
document.dispatchEvent(event);

const tab = new KeyboardEvent('keydown', {'keyCode': 9});
document.dispatchEvent(event);

Cheers

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!