Bug 951793 - Add a test for the pref that controls overscroll-behavior. r=emilio draft
authorBotond Ballo <botond@mozilla.com>
Mon, 20 Nov 2017 18:11:24 -0500
changeset 703295 825cc20e6877c9ec5804c19540b5c4104ee4406c
parent 703294 d058a76b173a951e112d1eef72aacf6d264ea60d
child 703296 4f145fb29eddcc5f83506cc6f512b123c29676ef
push id90783
push userbballo@mozilla.com
push dateFri, 24 Nov 2017 21:22:10 +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
@@ -250,16 +250,17 @@ skip-if = android_version == '18' #debug
 [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_non_content_accessible_properties.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", false]] },
+                          runTest);
+SimpleTest.waitForExplicitFinish();
+</script>
+</html>