squidfunk / karma-viewport

A Karma plugin for testing responsive features and layout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No window resize event is triggered

hornta opened this issue · comments

Cab we have window resize event to be triggered when the size of changed?

Thanks for your issue. Could you please elaborate on what you want to achieve and what doesn't work?

Hi. I solved my problem by just triggering a resize event after I changed the viewport size. I initially thought karma-viewport was already dispatching a resize event but I guess I could just do it myself.

karma-viewport runs your tests in an iframe and resizes the iframe:

/* Set width and height */
this.context.style.width = `${width}px`
if (height)
this.context.style.height = `${height}px`

We could dispatch a custom resize event, as I'm not sure if there's an easier solution.