diff options
author | Evan Read <eread@gitlab.com> | 2022-01-27 04:26:08 +0300 |
---|---|---|
committer | Evan Read <eread@gitlab.com> | 2022-01-27 23:13:23 +0300 |
commit | 04fb0d30d0f5c5bf6d25eae278aa3a9403f29f49 (patch) | |
tree | 27e596399c656a2ca67e6dc1de1b9c66fb95b4a1 /spec/frontend | |
parent | 47d3524a2913e485dc3bd722ef3ca756533a9483 (diff) |
Remove babel-core as dependency
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/default/components/navigation_toggle_spec.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/frontend/default/components/navigation_toggle_spec.js b/spec/frontend/default/components/navigation_toggle_spec.js index 6b51d6a71..67dd0338f 100644 --- a/spec/frontend/default/components/navigation_toggle_spec.js +++ b/spec/frontend/default/components/navigation_toggle_spec.js @@ -7,9 +7,12 @@ import NavigationToggle from '../../../../content/frontend/default/components/na describe('component: Navigation Toggle', () => { let wrapper; + const className = 'some-selector'; beforeEach(() => { - const propsData = { targetSelector: ['.some-selector'] }; + const propsData = { targetSelector: [`.${className}`] }; + + document.body.innerHTML = `<div class="${className}"></div>`; wrapper = mount(NavigationToggle, { propsData }); }); @@ -26,8 +29,10 @@ describe('component: Navigation Toggle', () => { }); it('toggles the navigation when the navigation toggle is clicked', () => { - wrapper.setMethods({ toggle: jest.fn() }); + const findMenu = () => document.querySelector(`.${className}`); + jest.spyOn(findMenu().classList, 'toggle'); + wrapper.find('.nav-toggle').trigger('click'); - expect(wrapper.vm.toggle).toHaveBeenCalled(); + expect(findMenu().classList.toggle).toHaveBeenCalledWith('active'); }); }); |