Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: third_party/WebKit/LayoutTests/intersection-observer/observer-attributes.html

Issue 2560253004: IntersectionObserver: convert tests to testharness.js (Closed)
Patch Set: Formatting tweaks and explicit resource paths Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/intersection-observer/observer-attributes.html
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/observer-attributes.html b/third_party/WebKit/LayoutTests/intersection-observer/observer-attributes.html
index 322497f8265bdf93368839c318b5a1d1ce5673ea..de10c19350f635559985924aa5ac77180e2540e4 100644
--- a/third_party/WebKit/LayoutTests/intersection-observer/observer-attributes.html
+++ b/third_party/WebKit/LayoutTests/intersection-observer/observer-attributes.html
@@ -1,21 +1,31 @@
<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+
<div id="root"></div>
-<script src="../resources/js-test.js"></script>
-<script>
- description("Test for observer attribute getters.");
- var rootDiv = document.getElementById("root");
+<script>
+test(function() {
var observer = new IntersectionObserver(function(e) {}, {});
- shouldBeNull("observer.root");
- shouldBe("observer.thresholds", "[0]");
- shouldBeEqualToString("observer.rootMargin", "0px 0px 0px 0px");
+ 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.
+ "observer.root === null");
+ test(function() { assert_array_equals(observer.thresholds, [0]) },
+ "observer.thresholds == [0]");
+ test(function() { assert_equals(observer.rootMargin, "0px 0px 0px 0px") },
+ "observer.rootMargin == '0px 0px 0px 0px'");
+ var rootDiv = document.getElementById("root");
observer = new IntersectionObserver(function(e) {}, {
root: rootDiv,
threshold: [0, 0.25, 0.5, 1.0],
rootMargin: "10% 20px"
});
- shouldBe("observer.root", "rootDiv");
- shouldBe("observer.thresholds", "[0, 0.25, 0.5, 1.0]");
- shouldBeEqualToString("observer.rootMargin", "10% 20px 10% 20px");
+ test(function() { assert_true(observer.root === rootDiv) },
+ "observer.root === rootDiv");
+ test(function() { assert_array_equals(observer.thresholds, [0, 0.25, 0.5, 1.0]) },
+ "observer.thresholds == [0, 0.25, 0.5, 1.0]");
+ test(function() { assert_equals(observer.rootMargin, "10% 20px 10% 20px") },
+ "observer.rootMargin == '10% 20px 10% 20px'");
+}, "Test for observer attribute getters.");
foolip 2017/01/11 13:42:53 "Test for " not needed.
szager1 2017/01/23 23:18:04 Done.
+
</script>

Powered by Google App Engine
This is Rietveld 408576698