short-url/public/vendor/seiyria-bootstrap-slider/test/specs/offMethodSpec.js

33 lines
893 B
JavaScript
Raw Permalink Normal View History

2020-07-01 08:57:45 +00:00
//--------------------------------------------------
//--------------------------------------------------
//-- Removes attached function from slider event --
//--------------------------------------------------
//--------------------------------------------------
describe("'off()' test", function() {
var testSlider, eventHandlerTriggered, mouse;
var onStart = function(){
eventHandlerTriggered = true;
};
beforeEach(function() {
eventHandlerTriggered = false;
mouse = document.createEvent('MouseEvents');
});
it("should properly unbind an event listener", function() {
testSlider = $("#testSlider1").slider();
testSlider.on('slideStart', onStart);
testSlider.off('slideStart', onStart);
testSlider.data('slider')._mousedown(mouse);
expect(eventHandlerTriggered).not.toBeTruthy();
});
});