BigW Consortium Gitlab

Revert and fix

parent 3283386a
......@@ -2,13 +2,12 @@ import $ from 'jquery';
import _ from 'underscore';
export function togglePopover(show) {
const $popover = $(this);
const isAlreadyShown = $popover.hasClass('js-popover-show');
const isAlreadyShown = this.hasClass('js-popover-show');
if ((show && isAlreadyShown) || (!show && !isAlreadyShown)) {
return false;
}
$popover.popover(show ? 'show' : 'hide');
$popover.toggleClass('disable-animation js-popover-show', show);
this.popover(show ? 'show' : 'hide');
this.toggleClass('disable-animation js-popover-show', show);
return true;
}
......
......@@ -29,7 +29,6 @@ describe('feature highlight', () => {
mock = new MockAdapter(axios);
mock.onGet('/test').reply(200);
spyOn(window, 'addEventListener');
spyOn(window, 'removeEventListener');
featureHighlight.setupFeatureHighlightPopover('test', 0);
});
......@@ -64,12 +63,7 @@ describe('feature highlight', () => {
it('setup show.bs.popover', () => {
$(selector).trigger('show.bs.popover');
expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function));
});
it('setup hide.bs.popover', () => {
$(selector).trigger('hide.bs.popover');
expect(window.removeEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function));
expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function), { once: true });
});
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