From 8f878570d42f848912931e0699846f4900583440 Mon Sep 17 00:00:00 2001 From: Casey Holzer Date: Sat, 30 Jan 2021 12:34:33 -0700 Subject: [PATCH] add test for click events --- js/tests/unit/dropdown.spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js index ba1d0f4438f2..6bf2380c6063 100644 --- a/js/tests/unit/dropdown.spec.js +++ b/js/tests/unit/dropdown.spec.js @@ -54,6 +54,25 @@ describe('Dropdown', () => { expect(dropdown.toggle).toHaveBeenCalled() }) + it('should allow click events to bubble', () => { + fixtureEl.innerHTML = [ + '' + ].join('') + + const btnDropdown = fixtureEl.querySelector('[data-bs-toggle="dropdown"]') + const clickListener = jasmine.createSpy('clickListener') + + btnDropdown.addEventListener('click', () => clickListener()) + btnDropdown.click() + + expect(clickListener).toHaveBeenCalled() + }) + it('should allow to pass config to Popper with `popperConfig`', () => { fixtureEl.innerHTML = [ '