diff options
author | GeoSot <geo.sotis@gmail.com> | 2022-01-30 15:30:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-30 15:30:04 +0300 |
commit | aa650f0f1e30279f0868433a4afab9c3efa93b2c (patch) | |
tree | 88cf537f2e7b6613bc2e53d4e38ca93798786d07 /js/tests/README.md | |
parent | d09281705988690b63a5364548447c603cb557fd (diff) |
tests: replace 'done' callback with 'Promise' to fix deprecation errors (#35659)
Reference:
https://jasmine.github.io/tutorials/async
'DEPRECATION: An asynchronous function called its 'done' callback more than once. This is a bug in the spec, beforeAll, beforeEach, afterAll, or afterEach function in question. This will be treated as an error in a future version. See<https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#deprecations-due-to-calling-done-multiple-times> for more information.
Diffstat (limited to 'js/tests/README.md')
-rw-r--r-- | js/tests/README.md | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/js/tests/README.md b/js/tests/README.md index ca99c0ede0..79d05d444f 100644 --- a/js/tests/README.md +++ b/js/tests/README.md @@ -50,22 +50,24 @@ describe('getInstance', () => { }) // Asynchronous test -it('should show a tooltip without the animation', done => { - fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>' +it('should show a tooltip without the animation', () => { + return new Promise(resolve => { + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>' - const tooltipEl = fixtureEl.querySelector('a') - const tooltip = new Tooltip(tooltipEl, { - animation: false - }) + const tooltipEl = fixtureEl.querySelector('a') + const tooltip = new Tooltip(tooltipEl, { + animation: false + }) - tooltipEl.addEventListener('shown.bs.tooltip', () => { - const tip = document.querySelector('.tooltip') + tooltipEl.addEventListener('shown.bs.tooltip', () => { + const tip = document.querySelector('.tooltip') - expect(tip).not.toBeNull() - expect(tip.classList.contains('fade')).toEqual(false) - done() - }) + expect(tip).not.toBeNull() + expect(tip.classList.contains('fade')).toEqual(false) + resolve() + }) - tooltip.show() + tooltip.show() + }) }) ``` |