@@ -1520,7 +1520,6 @@ public void domEventNameUsedAsFunctionName() throws Exception {
15201520 }
15211521
15221522 /**
1523- * Tests that JavaScript scrollIntoView() scrollEvent.
15241523 * @throws Exception if the test fails
15251524 */
15261525 @ Test
@@ -1540,7 +1539,7 @@ public void scrollEventFromScrollIntoView() throws Exception {
15401539 + "<body>\n "
15411540 + " <div id='container' style='overflow-y: scroll; height: 100px;'>\n "
15421541 + " <div style='height: 1000px;'>spacer</div>\n "
1543- + " <div id='target' style='background: red;'>Target</div>"
1542+ + " <div id='target' style='background: red;'>Target</div>\n "
15441543 + " </div>\n "
15451544
15461545 + " <script>\n "
@@ -1555,6 +1554,39 @@ public void scrollEventFromScrollIntoView() throws Exception {
15551554
15561555 loadPageVerifyTitle2 (html );
15571556 }
1557+ /**
1558+ * @throws Exception if the test fails
1559+ */
1560+ @ Test
1561+ @ Alerts (DEFAULT = {"[object Event]" , "scroll" , "true" , "false" , "false" },
1562+ FF = {"[object UIEvent]" , "scroll" , "true" , "true" , "false" },
1563+ FF_ESR = {"[object UIEvent]" , "scroll" , "true" , "true" , "false" })
1564+ public void scrollEventWindowFromScrollIntoView () throws Exception {
1565+ final String html = DOCTYPE_HTML
1566+ + "<html>\n "
1567+ + "<head>\n "
1568+ + "<script>\n "
1569+ + LOG_TITLE_FUNCTION
1570+ + DUMP_EVENT_FUNCTION
1571+ + "</script>\n "
1572+ + "</head>\n "
1573+
1574+ + "<body>\n "
1575+ + " <div id='container' style='height: 10000px;'>\n "
1576+ + " </div>\n "
1577+ + " <div id='target' style='background: red;'>Target</div>\n "
1578+
1579+ + " <script>\n "
1580+ + " window.addEventListener('scroll', function(e) { dump(e); });\n "
1581+
1582+ + " var s = document.getElementById('target');"
1583+ + " s.scrollIntoView();\n "
1584+ + " </script>\n "
1585+ + "</body>\n "
1586+ + "</html>" ;
1587+
1588+ loadPageVerifyTitle2 (html );
1589+ }
15581590
15591591 /**
15601592 * @throws Exception if the test fails
@@ -1586,6 +1618,36 @@ public void scrollEventFromScrollBy() throws Exception {
15861618 loadPageVerifyTitle2 (html );
15871619 }
15881620
1621+ /**
1622+ * @throws Exception if the test fails
1623+ */
1624+ @ Test
1625+ @ Alerts (DEFAULT = {"[object Event]" , "scroll" , "true" , "false" , "false" },
1626+ FF = {"[object UIEvent]" , "scroll" , "true" , "true" , "false" },
1627+ FF_ESR = {"[object UIEvent]" , "scroll" , "true" , "true" , "false" })
1628+ public void scrollEventWindowFromScrollBy () throws Exception {
1629+ final String html = DOCTYPE_HTML
1630+ + "<html>\n "
1631+ + "<head>\n "
1632+ + "<script>\n "
1633+ + LOG_TITLE_FUNCTION
1634+ + DUMP_EVENT_FUNCTION
1635+ + "</script>\n "
1636+ + "</head>\n "
1637+
1638+ + "<body>\n "
1639+ + " <div style='height: 1000px;'></div>\n "
1640+
1641+ + " <script>\n "
1642+ + " window.addEventListener('scroll', function(e) { dump(e) });\n "
1643+ + " window.scrollBy(10, 20);\n "
1644+ + " </script>\n "
1645+ + "</body>\n "
1646+ + "</html>" ;
1647+
1648+ loadPageVerifyTitle2 (html );
1649+ }
1650+
15891651 /**
15901652 * @throws Exception if the test fails
15911653 */
@@ -1615,4 +1677,34 @@ public void scrollEventFromScrollTo() throws Exception {
16151677
16161678 loadPageVerifyTitle2 (html );
16171679 }
1680+
1681+ /**
1682+ * @throws Exception if the test fails
1683+ */
1684+ @ Test
1685+ @ Alerts (DEFAULT = {"[object Event]" , "scroll" , "true" , "false" , "false" },
1686+ FF = {"[object UIEvent]" , "scroll" , "true" , "true" , "false" },
1687+ FF_ESR = {"[object UIEvent]" , "scroll" , "true" , "true" , "false" })
1688+ public void scrollEventWindowFromScrollTo () throws Exception {
1689+ final String html = DOCTYPE_HTML
1690+ + "<html>\n "
1691+ + "<head>\n "
1692+ + "<script>\n "
1693+ + LOG_TITLE_FUNCTION
1694+ + DUMP_EVENT_FUNCTION
1695+ + "</script>\n "
1696+ + "</head>\n "
1697+
1698+ + "<body>\n "
1699+ + " <div style='height: 1000px;'></div>\n "
1700+
1701+ + " <script>\n "
1702+ + " window.addEventListener('scroll', function(e) { dump(e) });\n "
1703+ + " window.scrollTo(10, 20);\n "
1704+ + " </script>\n "
1705+ + "</body>\n "
1706+ + "</html>" ;
1707+
1708+ loadPageVerifyTitle2 (html );
1709+ }
16181710}
0 commit comments