Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 | |
| 2 <div id="root"></div> | 5 <div id="root"></div> |
| 3 <script src="../resources/js-test.js"></script> | 6 |
| 4 <script> | 7 <script> |
| 5 description("Test for observer attribute getters."); | 8 test(function() { |
| 9 var observer = new IntersectionObserver(function(e) {}, {}); | |
| 10 test(function() { assert_true(observer.root === null) }, | |
|
foolip
2017/01/11 13:42:53
Suggest assert_equals(observer.root, null, "observ
szager1
2017/01/23 23:18:03
Done.
| |
| 11 "observer.root === null"); | |
| 12 test(function() { assert_array_equals(observer.thresholds, [0]) }, | |
| 13 "observer.thresholds == [0]"); | |
| 14 test(function() { assert_equals(observer.rootMargin, "0px 0px 0px 0px") }, | |
| 15 "observer.rootMargin == '0px 0px 0px 0px'"); | |
| 16 | |
| 6 var rootDiv = document.getElementById("root"); | 17 var rootDiv = document.getElementById("root"); |
| 7 | |
| 8 var observer = new IntersectionObserver(function(e) {}, {}); | |
| 9 shouldBeNull("observer.root"); | |
| 10 shouldBe("observer.thresholds", "[0]"); | |
| 11 shouldBeEqualToString("observer.rootMargin", "0px 0px 0px 0px"); | |
| 12 | |
| 13 observer = new IntersectionObserver(function(e) {}, { | 18 observer = new IntersectionObserver(function(e) {}, { |
| 14 root: rootDiv, | 19 root: rootDiv, |
| 15 threshold: [0, 0.25, 0.5, 1.0], | 20 threshold: [0, 0.25, 0.5, 1.0], |
| 16 rootMargin: "10% 20px" | 21 rootMargin: "10% 20px" |
| 17 }); | 22 }); |
| 18 shouldBe("observer.root", "rootDiv"); | 23 test(function() { assert_true(observer.root === rootDiv) }, |
| 19 shouldBe("observer.thresholds", "[0, 0.25, 0.5, 1.0]"); | 24 "observer.root === rootDiv"); |
| 20 shouldBeEqualToString("observer.rootMargin", "10% 20px 10% 20px"); | 25 test(function() { assert_array_equals(observer.thresholds, [0, 0.25, 0.5, 1.0] ) }, |
| 26 "observer.thresholds == [0, 0.25, 0.5, 1.0]"); | |
| 27 test(function() { assert_equals(observer.rootMargin, "10% 20px 10% 20px") }, | |
| 28 "observer.rootMargin == '10% 20px 10% 20px'"); | |
| 29 }, "Test for observer attribute getters."); | |
|
foolip
2017/01/11 13:42:53
"Test for " not needed.
szager1
2017/01/23 23:18:04
Done.
| |
| 30 | |
| 21 </script> | 31 </script> |
| OLD | NEW |