diff options
author | Ben Lertlumprasertkul <benlertlumprasertkul@gmail.com> | 2021-05-11 08:45:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 08:45:57 +0300 |
commit | 052def456845c2147e4e6c99d17bba12fcbee34c (patch) | |
tree | 9f23d9f09941c43fd519bde2498da808a8764635 | |
parent | 9c3ab6557ec89ae11cc27da1b4680b3e69381edf (diff) |
Remove potential false positive assertions (#33288)
* Remove potential false positive assertions
querySelector() returns null but
expect(document.querySelector('...')).toBeDefined()
tests that the value is not undefined
* Migrated assertions from .toBeDefined() to .not.toBeNull() for .getInstance() calls in tests
* Migrate offcanvas assertions from .toBeDefined() to .not.toBeNull() for .getInstance() call
* convert more cases to not.toBeNull assertions
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
-rw-r--r-- | js/tests/README.md | 2 | ||||
-rw-r--r-- | js/tests/unit/alert.spec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/button.spec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/carousel.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/collapse.spec.js | 2 | ||||
-rw-r--r-- | js/tests/unit/dropdown.spec.js | 14 | ||||
-rw-r--r-- | js/tests/unit/modal.spec.js | 38 | ||||
-rw-r--r-- | js/tests/unit/offcanvas.spec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/popover.spec.js | 12 | ||||
-rw-r--r-- | js/tests/unit/scrollspy.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/tab.spec.js | 2 | ||||
-rw-r--r-- | js/tests/unit/toast.spec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/tooltip.spec.js | 32 |
13 files changed, 67 insertions, 67 deletions
diff --git a/js/tests/README.md b/js/tests/README.md index f614499b49..1e96a6b5da 100644 --- a/js/tests/README.md +++ b/js/tests/README.md @@ -61,7 +61,7 @@ it('should show a tooltip without the animation', done => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tip = document.querySelector('.tooltip') - expect(tip).toBeDefined() + expect(tip).not.toBeNull() expect(tip.classList.contains('fade')).toEqual(false) done() }) diff --git a/js/tests/unit/alert.spec.js b/js/tests/unit/alert.spec.js index 194da420e9..29b99d7921 100644 --- a/js/tests/unit/alert.spec.js +++ b/js/tests/unit/alert.spec.js @@ -134,7 +134,7 @@ describe('Alert', () => { const alertEl = document.querySelector('.alert') const alert = new Alert(alertEl) - expect(Alert.getInstance(alertEl)).toBeDefined() + expect(Alert.getInstance(alertEl)).not.toBeNull() alert.dispose() @@ -169,7 +169,7 @@ describe('Alert', () => { jQueryMock.fn.alert.call(jQueryMock, 'close') - expect(Alert.getInstance(alertEl)).toBeDefined() + expect(Alert.getInstance(alertEl)).not.toBeNull() expect(fixtureEl.querySelector('.alert')).toBeNull() }) @@ -183,7 +183,7 @@ describe('Alert', () => { jQueryMock.fn.alert.call(jQueryMock) - expect(Alert.getInstance(alertEl)).toBeDefined() + expect(Alert.getInstance(alertEl)).not.toBeNull() expect(fixtureEl.querySelector('.alert')).not.toBeNull() }) }) diff --git a/js/tests/unit/button.spec.js b/js/tests/unit/button.spec.js index e7d92cb6d2..90cf766144 100644 --- a/js/tests/unit/button.spec.js +++ b/js/tests/unit/button.spec.js @@ -91,7 +91,7 @@ describe('Button', () => { const btnEl = fixtureEl.querySelector('.btn') const button = new Button(btnEl) - expect(Button.getInstance(btnEl)).toBeDefined() + expect(Button.getInstance(btnEl)).not.toBeNull() button.dispose() @@ -126,7 +126,7 @@ describe('Button', () => { jQueryMock.fn.button.call(jQueryMock, 'toggle') - expect(Button.getInstance(btnEl)).toBeDefined() + expect(Button.getInstance(btnEl)).not.toBeNull() expect(btnEl.classList.contains('active')).toEqual(true) }) @@ -140,7 +140,7 @@ describe('Button', () => { jQueryMock.fn.button.call(jQueryMock) - expect(Button.getInstance(btnEl)).toBeDefined() + expect(Button.getInstance(btnEl)).not.toBeNull() expect(btnEl.classList.contains('active')).toEqual(false) }) }) diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js index 75c3bbd6d8..324ff19a70 100644 --- a/js/tests/unit/carousel.spec.js +++ b/js/tests/unit/carousel.spec.js @@ -1213,7 +1213,7 @@ describe('Carousel', () => { jQueryMock.fn.carousel.call(jQueryMock) - expect(Carousel.getInstance(div)).toBeDefined() + expect(Carousel.getInstance(div)).not.toBeNull() }) it('should not re create a carousel', () => { @@ -1271,7 +1271,7 @@ describe('Carousel', () => { window.dispatchEvent(loadEvent) - expect(Carousel.getInstance(carouselEl)).toBeDefined() + expect(Carousel.getInstance(carouselEl)).not.toBeNull() }) it('should create carousel and go to the next slide on click (with real button controls)', done => { diff --git a/js/tests/unit/collapse.spec.js b/js/tests/unit/collapse.spec.js index bc7c157714..590b5795c7 100644 --- a/js/tests/unit/collapse.spec.js +++ b/js/tests/unit/collapse.spec.js @@ -810,7 +810,7 @@ describe('Collapse', () => { jQueryMock.fn.collapse.call(jQueryMock) - expect(Collapse.getInstance(div)).toBeDefined() + expect(Collapse.getInstance(div)).not.toBeNull() }) it('should not re create a collapse', () => { diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js index b0f225140e..57989059d1 100644 --- a/js/tests/unit/dropdown.spec.js +++ b/js/tests/unit/dropdown.spec.js @@ -948,8 +948,8 @@ describe('Dropdown', () => { const dropdown = new Dropdown(btnDropdown) expect(dropdown._popper).toBeNull() - expect(dropdown._menu).toBeDefined() - expect(dropdown._element).toBeDefined() + expect(dropdown._menu).not.toBeNull() + expect(dropdown._element).not.toBeNull() expect(btnDropdown.addEventListener).toHaveBeenCalledWith('click', jasmine.any(Function), jasmine.any(Boolean)) dropdown.dispose() @@ -974,9 +974,9 @@ describe('Dropdown', () => { dropdown.toggle() - expect(dropdown._popper).toBeDefined() - expect(dropdown._menu).toBeDefined() - expect(dropdown._element).toBeDefined() + expect(dropdown._popper).not.toBeNull() + expect(dropdown._menu).not.toBeNull() + expect(dropdown._element).not.toBeNull() dropdown.dispose() @@ -1002,7 +1002,7 @@ describe('Dropdown', () => { dropdown.toggle() - expect(dropdown._popper).toBeDefined() + expect(dropdown._popper).not.toBeNull() spyOn(dropdown._popper, 'update') spyOn(dropdown, '_detectNavbar') @@ -1886,7 +1886,7 @@ describe('Dropdown', () => { jQueryMock.fn.dropdown.call(jQueryMock) - expect(Dropdown.getInstance(div)).toBeDefined() + expect(Dropdown.getInstance(div)).not.toBeNull() }) it('should not re create a dropdown', () => { diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index a09711b349..79f3c4845b 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -247,9 +247,9 @@ describe('Modal', () => { modalEl.addEventListener('shown.bs.modal', () => { expect(modalEl.getAttribute('aria-modal')).toEqual('true') expect(modalEl.getAttribute('role')).toEqual('dialog') - expect(modalEl.getAttribute('aria-hidden')).toEqual(null) + expect(modalEl.getAttribute('aria-hidden')).toBeNull() expect(modalEl.style.display).toEqual('block') - expect(document.querySelector('.modal-backdrop')).toBeDefined() + expect(document.querySelector('.modal-backdrop')).not.toBeNull() done() }) @@ -271,7 +271,7 @@ describe('Modal', () => { modalEl.addEventListener('shown.bs.modal', () => { expect(modalEl.getAttribute('aria-modal')).toEqual('true') expect(modalEl.getAttribute('role')).toEqual('dialog') - expect(modalEl.getAttribute('aria-hidden')).toEqual(null) + expect(modalEl.getAttribute('aria-hidden')).toBeNull() expect(modalEl.style.display).toEqual('block') expect(document.querySelector('.modal-backdrop')).toBeNull() done() @@ -292,7 +292,7 @@ describe('Modal', () => { modalEl.addEventListener('shown.bs.modal', () => { const dynamicModal = document.getElementById(id) - expect(dynamicModal).toBeDefined() + expect(dynamicModal).not.toBeNull() dynamicModal.parentNode.removeChild(dynamicModal) done() }) @@ -763,8 +763,8 @@ describe('Modal', () => { }) modalEl.addEventListener('hidden.bs.modal', () => { - expect(modalEl.getAttribute('aria-modal')).toEqual(null) - expect(modalEl.getAttribute('role')).toEqual(null) + expect(modalEl.getAttribute('aria-modal')).toBeNull() + expect(modalEl.getAttribute('role')).toBeNull() expect(modalEl.getAttribute('aria-hidden')).toEqual('true') expect(modalEl.style.display).toEqual('none') expect(document.querySelector('.modal-backdrop')).toBeNull() @@ -785,8 +785,8 @@ describe('Modal', () => { }) modalEl.addEventListener('hidden.bs.modal', () => { - expect(modalEl.getAttribute('aria-modal')).toEqual(null) - expect(modalEl.getAttribute('role')).toEqual(null) + expect(modalEl.getAttribute('aria-modal')).toBeNull() + expect(modalEl.getAttribute('role')).toBeNull() expect(modalEl.getAttribute('aria-hidden')).toEqual('true') expect(modalEl.style.display).toEqual('none') expect(document.querySelector('.modal-backdrop')).toBeNull() @@ -862,7 +862,7 @@ describe('Modal', () => { modal.dispose() - expect(Modal.getInstance(modalEl)).toEqual(null) + expect(Modal.getInstance(modalEl)).toBeNull() expect(EventHandler.off).toHaveBeenCalledTimes(4) }) }) @@ -895,18 +895,18 @@ describe('Modal', () => { modalEl.addEventListener('shown.bs.modal', () => { expect(modalEl.getAttribute('aria-modal')).toEqual('true') expect(modalEl.getAttribute('role')).toEqual('dialog') - expect(modalEl.getAttribute('aria-hidden')).toEqual(null) + expect(modalEl.getAttribute('aria-hidden')).toBeNull() expect(modalEl.style.display).toEqual('block') - expect(document.querySelector('.modal-backdrop')).toBeDefined() + expect(document.querySelector('.modal-backdrop')).not.toBeNull() setTimeout(() => trigger.click(), 10) }) modalEl.addEventListener('hidden.bs.modal', () => { - expect(modalEl.getAttribute('aria-modal')).toEqual(null) - expect(modalEl.getAttribute('role')).toEqual(null) + expect(modalEl.getAttribute('aria-modal')).toBeNull() + expect(modalEl.getAttribute('role')).toBeNull() expect(modalEl.getAttribute('aria-hidden')).toEqual('true') expect(modalEl.style.display).toEqual('none') - expect(document.querySelector('.modal-backdrop')).toEqual(null) + expect(document.querySelector('.modal-backdrop')).toBeNull() done() }) @@ -947,9 +947,9 @@ describe('Modal', () => { modalEl.addEventListener('shown.bs.modal', () => { expect(modalEl.getAttribute('aria-modal')).toEqual('true') expect(modalEl.getAttribute('role')).toEqual('dialog') - expect(modalEl.getAttribute('aria-hidden')).toEqual(null) + expect(modalEl.getAttribute('aria-hidden')).toBeNull() expect(modalEl.style.display).toEqual('block') - expect(document.querySelector('.modal-backdrop')).toBeDefined() + expect(document.querySelector('.modal-backdrop')).not.toBeNull() expect(Event.prototype.preventDefault).toHaveBeenCalled() done() }) @@ -1057,7 +1057,7 @@ describe('Modal', () => { jQueryMock.fn.modal.call(jQueryMock) - expect(Modal.getInstance(div)).toBeDefined() + expect(Modal.getInstance(div)).not.toBeNull() }) it('should create a modal with given config', () => { @@ -1073,7 +1073,7 @@ describe('Modal', () => { expect(Modal.prototype.constructor).not.toHaveBeenCalledWith(div, { keyboard: false }) const modal = Modal.getInstance(div) - expect(modal).toBeDefined() + expect(modal).not.toBeNull() expect(modal._config.keyboard).toBe(false) }) @@ -1153,7 +1153,7 @@ describe('Modal', () => { const div = fixtureEl.querySelector('div') - expect(Modal.getInstance(div)).toEqual(null) + expect(Modal.getInstance(div)).toBeNull() }) }) }) diff --git a/js/tests/unit/offcanvas.spec.js b/js/tests/unit/offcanvas.spec.js index 30edc2913b..64c565318e 100644 --- a/js/tests/unit/offcanvas.spec.js +++ b/js/tests/unit/offcanvas.spec.js @@ -560,7 +560,7 @@ describe('Offcanvas', () => { jQueryMock.fn.offcanvas.call(jQueryMock) - expect(Offcanvas.getInstance(div)).toBeDefined() + expect(Offcanvas.getInstance(div)).not.toBeNull() }) it('should not re create an offcanvas', () => { @@ -678,7 +678,7 @@ describe('Offcanvas', () => { expect(Offcanvas.prototype.constructor).not.toHaveBeenCalledWith(div, { scroll: true }) const offcanvas = Offcanvas.getInstance(div) - expect(offcanvas).toBeDefined() + expect(offcanvas).not.toBeNull() expect(offcanvas._config.scroll).toBe(true) }) }) @@ -699,7 +699,7 @@ describe('Offcanvas', () => { const div = fixtureEl.querySelector('div') - expect(Offcanvas.getInstance(div)).toEqual(null) + expect(Offcanvas.getInstance(div)).toBeNull() }) }) }) diff --git a/js/tests/unit/popover.spec.js b/js/tests/unit/popover.spec.js index e5c235e2a9..dc1c4afc13 100644 --- a/js/tests/unit/popover.spec.js +++ b/js/tests/unit/popover.spec.js @@ -70,7 +70,7 @@ describe('Popover', () => { const popover = new Popover(popoverEl) popoverEl.addEventListener('shown.bs.popover', () => { - expect(document.querySelector('.popover')).toBeDefined() + expect(document.querySelector('.popover')).not.toBeNull() done() }) @@ -89,7 +89,7 @@ describe('Popover', () => { popoverEl.addEventListener('shown.bs.popover', () => { const popoverDisplayed = document.querySelector('.popover') - expect(popoverDisplayed).toBeDefined() + expect(popoverDisplayed).not.toBeNull() expect(popoverDisplayed.querySelector('.popover-header').textContent).toEqual('Bootstrap') expect(popoverDisplayed.querySelector('.popover-body').textContent).toEqual('loves writing tests (╯°□°)╯︵ ┻━┻') done() @@ -109,7 +109,7 @@ describe('Popover', () => { popoverEl.addEventListener('shown.bs.popover', () => { const popoverDisplayed = document.querySelector('.popover') - expect(popoverDisplayed).toBeDefined() + expect(popoverDisplayed).not.toBeNull() expect(popoverDisplayed.querySelector('.popover-body').textContent).toEqual('Popover content') done() }) @@ -125,7 +125,7 @@ describe('Popover', () => { popoverEl.addEventListener('shown.bs.popover', () => { const tip = document.querySelector('.popover') - expect(tip).toBeDefined() + expect(tip).not.toBeNull() expect(tip.classList.contains('custom-class')).toBeTrue() done() }) @@ -165,7 +165,7 @@ describe('Popover', () => { jQueryMock.fn.popover.call(jQueryMock) - expect(Popover.getInstance(popoverEl)).toBeDefined() + expect(Popover.getInstance(popoverEl)).not.toBeNull() }) it('should create a popover with a config object', () => { @@ -180,7 +180,7 @@ describe('Popover', () => { content: 'Popover content' }) - expect(Popover.getInstance(popoverEl)).toBeDefined() + expect(Popover.getInstance(popoverEl)).not.toBeNull() }) it('should not re create a popover', () => { diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js index c4130a1aa7..6b2a134302 100644 --- a/js/tests/unit/scrollspy.spec.js +++ b/js/tests/unit/scrollspy.spec.js @@ -602,7 +602,7 @@ describe('ScrollSpy', () => { jQueryMock.fn.scrollspy.call(jQueryMock) - expect(ScrollSpy.getInstance(div)).toBeDefined() + expect(ScrollSpy.getInstance(div)).not.toBeNull() }) it('should create a scrollspy with given config', () => { @@ -618,7 +618,7 @@ describe('ScrollSpy', () => { expect(ScrollSpy.prototype.constructor).not.toHaveBeenCalledWith(div, { offset: 15 }) const scrollspy = ScrollSpy.getInstance(div) - expect(scrollspy).toBeDefined() + expect(scrollspy).not.toBeNull() expect(scrollspy._config.offset).toBe(15) }) diff --git a/js/tests/unit/tab.spec.js b/js/tests/unit/tab.spec.js index c8e1475adb..76d4765258 100644 --- a/js/tests/unit/tab.spec.js +++ b/js/tests/unit/tab.spec.js @@ -368,7 +368,7 @@ describe('Tab', () => { jQueryMock.fn.tab.call(jQueryMock) - expect(Tab.getInstance(div)).toBeDefined() + expect(Tab.getInstance(div)).not.toBeNull() }) it('should not re create a tab', () => { diff --git a/js/tests/unit/toast.spec.js b/js/tests/unit/toast.spec.js index ea71e2cdb5..62cfc966de 100644 --- a/js/tests/unit/toast.spec.js +++ b/js/tests/unit/toast.spec.js @@ -472,7 +472,7 @@ describe('Toast', () => { const toast = new Toast(toastEl) - expect(Toast.getInstance(toastEl)).toBeDefined() + expect(Toast.getInstance(toastEl)).not.toBeNull() expect(toastEl.addEventListener).toHaveBeenCalledWith('click', jasmine.any(Function), jasmine.any(Boolean)) toast.dispose() @@ -494,7 +494,7 @@ describe('Toast', () => { const toast = new Toast(toastEl) const expected = () => { expect(toastEl.classList.contains('show')).toEqual(true) - expect(Toast.getInstance(toastEl)).toBeDefined() + expect(Toast.getInstance(toastEl)).not.toBeNull() toast.dispose() @@ -523,7 +523,7 @@ describe('Toast', () => { jQueryMock.fn.toast.call(jQueryMock) - expect(Toast.getInstance(div)).toBeDefined() + expect(Toast.getInstance(div)).not.toBeNull() }) it('should not re create a toast', () => { diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 399f1f22a8..0dec2cee46 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -194,7 +194,7 @@ describe('Tooltip', () => { tooltip.enable() tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(document.querySelector('.tooltip')).toBeDefined() + expect(document.querySelector('.tooltip')).not.toBeNull() done() }) @@ -267,7 +267,7 @@ describe('Tooltip', () => { const tooltip = new Tooltip(tooltipEl) tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(document.querySelector('.tooltip')).toBeDefined() + expect(document.querySelector('.tooltip')).not.toBeNull() done() }) @@ -386,7 +386,7 @@ describe('Tooltip', () => { const tooltip = new Tooltip(tooltipEl) tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(document.querySelector('.tooltip')).toBeDefined() + expect(document.querySelector('.tooltip')).not.toBeNull() tooltip.dispose() @@ -408,7 +408,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tooltipShown = document.querySelector('.tooltip') - expect(tooltipShown).toBeDefined() + expect(tooltipShown).not.toBeNull() expect(tooltipEl.getAttribute('aria-describedby')).toEqual(tooltipShown.getAttribute('id')) expect(tooltipShown.getAttribute('id')).toContain('tooltip') done() @@ -516,7 +516,7 @@ describe('Tooltip', () => { }) tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(fixtureEl.querySelector('.tooltip')).toBeDefined() + expect(fixtureEl.querySelector('.tooltip')).not.toBeNull() done() }) @@ -535,7 +535,7 @@ describe('Tooltip', () => { }) tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(fixtureEl.querySelector('.tooltip')).toBeDefined() + expect(fixtureEl.querySelector('.tooltip')).not.toBeNull() done() }) @@ -551,7 +551,7 @@ describe('Tooltip', () => { }) tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(fixtureEl.querySelector('.tooltip')).toBeDefined() + expect(fixtureEl.querySelector('.tooltip')).not.toBeNull() done() }) @@ -568,7 +568,7 @@ describe('Tooltip', () => { }) tooltipEl.addEventListener('shown.bs.tooltip', () => { - expect(document.querySelector('.tooltip')).toBeDefined() + expect(document.querySelector('.tooltip')).not.toBeNull() expect(spy).toHaveBeenCalled() done() }) @@ -587,7 +587,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tip = document.querySelector('.tooltip') - expect(tip).toBeDefined() + expect(tip).not.toBeNull() expect(tip.classList.contains('fade')).toEqual(false) done() }) @@ -810,7 +810,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tip = document.querySelector('.tooltip') - expect(tip).toBeDefined() + expect(tip).not.toBeNull() expect(tip.classList.contains('custom-class')).toBeTrue() done() }) @@ -828,7 +828,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tip = document.querySelector('.tooltip') - expect(tip).toBeDefined() + expect(tip).not.toBeNull() expect(tip.classList.contains('custom-class')).toBeTrue() expect(tip.classList.contains('custom-class-2')).toBeTrue() done() @@ -848,7 +848,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tip = document.querySelector('.tooltip') - expect(tip).toBeDefined() + expect(tip).not.toBeNull() expect(spy).toHaveBeenCalled() expect(tip.classList.contains('custom-class')).toBeTrue() done() @@ -1263,7 +1263,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tooltipShown = document.querySelector('.tooltip') - expect(tooltipShown).toBeDefined() + expect(tooltipShown).not.toBeNull() expect(tooltipEl.getAttribute('aria-label')).toEqual('Another tooltip') done() }) @@ -1280,7 +1280,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tooltipShown = document.querySelector('.tooltip') - expect(tooltipShown).toBeDefined() + expect(tooltipShown).not.toBeNull() expect(tooltipEl.getAttribute('aria-label')).toEqual('Different label') done() }) @@ -1297,7 +1297,7 @@ describe('Tooltip', () => { tooltipEl.addEventListener('shown.bs.tooltip', () => { const tooltipShown = document.querySelector('.tooltip') - expect(tooltipShown).toBeDefined() + expect(tooltipShown).not.toBeNull() expect(tooltipEl.getAttribute('aria-label')).toBeNull() done() }) @@ -1317,7 +1317,7 @@ describe('Tooltip', () => { jQueryMock.fn.tooltip.call(jQueryMock) - expect(Tooltip.getInstance(div)).toBeDefined() + expect(Tooltip.getInstance(div)).not.toBeNull() }) it('should not re create a tooltip', () => { |