You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would you be open to adding height and width properties to the media service?
I made a simple addon service to return the height and width of the screen in pixels. I worked on some projects recently where developers were doing some specific element positioning based on the height and width of window. The ember addon they were finding first had an approach that wasn't working well for us.
I also added some breakpoint functionality to the addon I made. @taras pointed out that Ember Responsive already has this breakpoint feature. Getting the screen height and width is a little different that using matchMedia from an implementation perspective, but it might fit well into the space of "do things with Ember based on the size of the window".
I could create a PR for this although I'm not sure what the testing approach would be. I don't see any tests in this project that integrate with browser APIs. I think this approach is justified since resizing a browser while testing is non-trivial. Perhaps a smoke test that reads the current innerHeight and innerWidth and makes sure that the properties on media match that would be sufficient. You can take a look at the testing approach I used which opens a browser window with window.open so that it can be manipulated during tests. It was interesting to work on, but might be better in the long run to just have a manual test like you have in the dummy app index template.
The text was updated successfully, but these errors were encountered:
Would you be open to adding
height
andwidth
properties to themedia
service?I made a simple addon service to return the
height
andwidth
of the screen in pixels. I worked on some projects recently where developers were doing some specific element positioning based on the height and width ofwindow
. The ember addon they were finding first had an approach that wasn't working well for us.I also added some
breakpoint
functionality to the addon I made. @taras pointed out that Ember Responsive already has thisbreakpoint
feature. Getting the screen height and width is a little different that usingmatchMedia
from an implementation perspective, but it might fit well into the space of "do things with Ember based on the size of the window".I could create a PR for this although I'm not sure what the testing approach would be. I don't see any tests in this project that integrate with browser APIs. I think this approach is justified since resizing a browser while testing is non-trivial. Perhaps a smoke test that reads the current
innerHeight
andinnerWidth
and makes sure that the properties onmedia
match that would be sufficient. You can take a look at the testing approach I used which opens a browser window withwindow.open
so that it can be manipulated during tests. It was interesting to work on, but might be better in the long run to just have a manual test like you have in the dummy appindex
template.The text was updated successfully, but these errors were encountered: