Commit 3f66736f authored by Luke Bennett's avatar Luke Bennett

Revert and fix

parent 3283386a
...@@ -2,13 +2,12 @@ import $ from 'jquery'; ...@@ -2,13 +2,12 @@ import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
export function togglePopover(show) { export function togglePopover(show) {
const $popover = $(this); const isAlreadyShown = this.hasClass('js-popover-show');
const isAlreadyShown = $popover.hasClass('js-popover-show');
if ((show && isAlreadyShown) || (!show && !isAlreadyShown)) { if ((show && isAlreadyShown) || (!show && !isAlreadyShown)) {
return false; return false;
} }
$popover.popover(show ? 'show' : 'hide'); this.popover(show ? 'show' : 'hide');
$popover.toggleClass('disable-animation js-popover-show', show); this.toggleClass('disable-animation js-popover-show', show);
return true; return true;
} }
......
...@@ -29,7 +29,6 @@ describe('feature highlight', () => { ...@@ -29,7 +29,6 @@ describe('feature highlight', () => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
mock.onGet('/test').reply(200); mock.onGet('/test').reply(200);
spyOn(window, 'addEventListener'); spyOn(window, 'addEventListener');
spyOn(window, 'removeEventListener');
featureHighlight.setupFeatureHighlightPopover('test', 0); featureHighlight.setupFeatureHighlightPopover('test', 0);
}); });
...@@ -64,12 +63,7 @@ describe('feature highlight', () => { ...@@ -64,12 +63,7 @@ describe('feature highlight', () => {
it('setup show.bs.popover', () => { it('setup show.bs.popover', () => {
$(selector).trigger('show.bs.popover'); $(selector).trigger('show.bs.popover');
expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function)); expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function), { once: true });
});
it('setup hide.bs.popover', () => {
$(selector).trigger('hide.bs.popover');
expect(window.removeEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function));
}); });
it('removes disabled attribute', () => { it('removes disabled attribute', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment