Skip to content

Commit

Permalink
remove setTimeouts from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyjhol authored and XhmikosR committed Mar 23, 2021
1 parent 451fd61 commit 2330101
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/tests/unit/dropdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,13 +1020,13 @@ describe('Dropdown', () => {
showEventTriggered = true
})

btnDropdown.addEventListener('shown.bs.dropdown', e => setTimeout(() => {
btnDropdown.addEventListener('shown.bs.dropdown', e => {
expect(btnDropdown.classList.contains('show')).toEqual(true)
expect(btnDropdown.getAttribute('aria-expanded')).toEqual('true')
expect(showEventTriggered).toEqual(true)
expect(e.relatedTarget).toEqual(btnDropdown)
document.body.click()
}))
})

btnDropdown.addEventListener('hide.bs.dropdown', () => {
hideEventTriggered = true
Expand Down Expand Up @@ -1822,11 +1822,11 @@ describe('Dropdown', () => {
const btnDropdown = fixtureEl.querySelector('[data-bs-toggle="dropdown"]')
const childElement = fixtureEl.querySelector('#childElement')

btnDropdown.addEventListener('shown.bs.dropdown', () => setTimeout(() => {
btnDropdown.addEventListener('shown.bs.dropdown', () => {
expect(btnDropdown.classList.contains('show')).toEqual(true)
expect(btnDropdown.getAttribute('aria-expanded')).toEqual('true')
done()
}))
})

childElement.click()
})
Expand Down

0 comments on commit 2330101

Please sign in to comment.