1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-14 09:34:36 +02:00

tests: revisit all tests using Promise.reject instead of throwing an error (#35765)

This commit is contained in:
GeoSot
2022-02-19 16:08:16 +02:00
committed by GitHub
parent ae12d645ef
commit 4b17868fb4
10 changed files with 72 additions and 72 deletions

View File

@@ -211,7 +211,7 @@ describe('Tooltip', () => {
describe('disable', () => {
it('should disable tooltip', () => {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
const tooltipEl = fixtureEl.querySelector('a')
@@ -220,7 +220,7 @@ describe('Tooltip', () => {
tooltip.disable()
tooltipEl.addEventListener('show.bs.tooltip', () => {
throw new Error('should not show a disabled tooltip')
reject(new Error('should not show a disabled tooltip'))
})
tooltip.show()
@@ -250,7 +250,7 @@ describe('Tooltip', () => {
describe('toggle', () => {
it('should do nothing if disabled', () => {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
const tooltipEl = fixtureEl.querySelector('a')
@@ -259,7 +259,7 @@ describe('Tooltip', () => {
tooltip.disable()
tooltipEl.addEventListener('show.bs.tooltip', () => {
throw new Error('should not show a disabled tooltip')
reject(new Error('should not show a disabled tooltip'))
})
tooltip.toggle()
@@ -652,7 +652,7 @@ describe('Tooltip', () => {
})
it('should not show a tooltip if show.bs.tooltip is prevented', () => {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
const tooltipEl = fixtureEl.querySelector('a')
@@ -671,7 +671,7 @@ describe('Tooltip', () => {
})
tooltipEl.addEventListener('shown.bs.tooltip', () => {
throw new Error('Tooltip should not be shown')
reject(new Error('Tooltip should not be shown'))
})
tooltip.show()
@@ -1001,7 +1001,7 @@ describe('Tooltip', () => {
})
it('should not hide a tooltip if hide event is prevented', () => {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
const assertDone = () => {
@@ -1022,7 +1022,7 @@ describe('Tooltip', () => {
assertDone()
})
tooltipEl.addEventListener('hidden.bs.tooltip', () => {
throw new Error('should not trigger hidden event')
reject(new Error('should not trigger hidden event'))
})
tooltip.show()