8
0

scroll-iframe.md 1.5 KB

scrollViewportToShowTarget() helper in an iframe

The aim of this test is checking if the helper function works for targets residing in a child document (window) within an <iframe>. There are 3 elements that interact in this test:

  1. the target, which is a red square with green border,
  2. the iframe, which is a blue–bordered square,
  3. the scrollable iframe parent has an orange border.

Scenario #1

  1. Click the "Scroll" button in the upper–right corner of the viewport.

Expected:

The viewport should scroll so the red (target) square (and its green border). It should be revealed and completely visible in the viewport. Most certainly, it will land directly in the bottom–right corner of the viewport.

Scenario #2

  1. Click the "Scroll" button again.

Expected:

Basically, nothing should happen (nothing should get scrolled).

Scenario #3

  1. Play with the scrollbars of each element (iframe, iframe's parent, top window), e.g. to partially hide the target or to completely hide it to to hide it to the left/right/top/bottom. Be creative.
  2. Click the "Scroll" button.

Expected:

The target should always be scrolled back and become completely visible. Mind the green border, it should become visible too. The location of the target on the screen will vary, depending on where you "hide" in its scrollable ancestors.