Bug 951793 - Add a test for the pref that controls overscroll-behavior. r=emilio draft
authorBotond Ballo <botond@mozilla.com>
Mon, 20 Nov 2017 17:04:04 -0500
changeset 700780 e42266c97e7b30f3e7f45a5d2a3438db8de5df51
parent 700779 05cb1d2a1a75239308c4543f377f7de5e68853fa
child 740999 8526f9dac99e30481b3c48b276f0582c3c35b4cc
push id89971
push userbballo@mozilla.com
push dateMon, 20 Nov 2017 22:06:14 +0000
reviewersemilio
bugs951793
milestone59.0a1
Bug 951793 - Add a test for the pref that controls overscroll-behavior. r=emilio MozReview-Commit-ID: 9qIuF1Vdsm4
layout/style/test/mochitest.ini
layout/style/test/test_overscroll_behavior_pref.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -249,16 +249,17 @@ skip-if = !stylo
 skip-if = android_version == '18' #debug-only failure; timed out #Android 4.3 aws only; bug 1030419
 [test_media_queries_dynamic.html]
 [test_media_queries_dynamic_xbl.html]
 [test_media_query_list.html]
 [test_media_query_serialization.html]
 [test_moz_device_pixel_ratio.html]
 [test_namespace_rule.html]
 [test_of_type_selectors.xhtml]
+[test_overscroll_behavior_pref.html]
 [test_page_parser.html]
 [test_parse_eof.html]
 [test_parse_ident.html]
 [test_parse_rule.html]
 [test_parse_url.html]
 [test_parser_diagnostics_unprintables.html]
 [test_pixel_lengths.html]
 [test_pointer-events.html]
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_overscroll_behavior_pref.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<html>
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <title>Test pref for overscroll-behavior property</title>
+    <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  </head>
+<script class="testbody" type="text/javascript">
+function runTest() {
+  let css = "div { overscroll-behavior: auto; }";
+  let style = document.createElement('style');
+  style.appendChild(document.createTextNode(css));
+  document.head.appendChild(style);
+
+  is(document.styleSheets[0].cssRules[0].style.length,
+     0,
+     "overscroll-behavior shouldn't be parsed if the pref is off");
+  SimpleTest.finish();
+}
+SpecialPowers.pushPrefEnv({ set: [["layout.css.overscroll-behavior.enabled", true]] },
+                          runTest);
+SimpleTest.waitForExplicitFinish();
+</script>
+</html>