scroll position save fix attempt no. 1 feat. 'What happens next…?' text at bottom of scroll; buffer added to scroll, accounter for in FTs
This commit is contained in:
@@ -154,15 +154,17 @@ class BillscrollPositionTest(FunctionalTest):
|
||||
)
|
||||
|
||||
# 2. Force the element scrollable (CSS not served by StaticLiveServerTestCase),
|
||||
# set position, and dispatch scroll event to trigger the debounced save
|
||||
target = 100
|
||||
# set position, and dispatch scroll event to trigger the debounced save.
|
||||
# JS saves scrollTop + clientHeight (bottom-of-viewport); forced height is 150px.
|
||||
scroll_top = 100
|
||||
forced_height = 150
|
||||
self.browser.execute_script("""
|
||||
var el = arguments[0];
|
||||
el.style.overflow = 'auto';
|
||||
el.style.height = '150px';
|
||||
el.scrollTop = arguments[1];
|
||||
el.dispatchEvent(new Event('scroll'));
|
||||
""", scroll_el, target)
|
||||
""", scroll_el, scroll_top)
|
||||
|
||||
# 3. Wait for debounce (800ms) + fetch to complete
|
||||
time.sleep(3)
|
||||
@@ -178,8 +180,11 @@ class BillscrollPositionTest(FunctionalTest):
|
||||
scroll_el = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_drama_scroll")
|
||||
)
|
||||
buffer_px = self.browser.execute_script(
|
||||
"return Math.round(parseFloat(getComputedStyle(document.documentElement).fontSize) * 2.5)"
|
||||
)
|
||||
restored = int(scroll_el.get_attribute("data-scroll-position"))
|
||||
self.assertEqual(restored, target)
|
||||
self.assertEqual(restored, scroll_top + forced_height + buffer_px)
|
||||
|
||||
|
||||
class BillboardAppletsTest(FunctionalTest):
|
||||
|
||||
Reference in New Issue
Block a user