Skip to content
Advertisement

How to unit test a mapbox popup with jasmine testing?

I have a mapbox popup. I am using jasmine and I want to write a unit test for it.

So I have this function:

JavaScript

and this is the template:

JavaScript

and this is my unit test:

JavaScript

But I get this error:

JavaScript

So what I have to change?

Thank you

Advertisement

Answer

I dont think you should be testing like that.

JavaScript

To test stopPropagation, you should rather focus on the event which is being stopped by it. If your test checks that the event is not happening, you can be sure that event.stopPropagation(); is doing its thing in the code.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement