blob: 4a299060655677c00976c0e78b517e0ab41b471b [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ enableIntersectionObserver=true ] -->
<head>
<title>IntersectionObserver interface tests.</title>
<link rel="author" title="Simon Fraser" href="mailto:simon.fraser@apple.com" />
<link rel="help" href="https://wicg.github.io/IntersectionObserver/">
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
test(function() {
assert_class_string(new IntersectionObserver(function() {}), 'IntersectionObserver');
},'Constructor0');
test(function() {
var observer = new IntersectionObserver(function() {});
assert_equals(observer.rootMargin, '0px');
},'DefaultRootMargin');
test(function() {
var observer = new IntersectionObserver(function() {});
assert_equals(observer.root, null);
},'DefaultRoot');
test(function() {
var observer = new IntersectionObserver(function() {});
assert_array_equals(observer.thresholds, [0]);
},'DefaultThresholds');
test(function() {
var observer = new IntersectionObserver(function() {}, { rootMargin: '33em 10px -120px 3pt' });
assert_equals(observer.rootMargin, '33em 10px -120px 3pt');
},'ExplicitRootMargin');
test(function() {
var observer = new IntersectionObserver(function() {}, { root: document.body });
assert_equals(observer.root, document.body);
},'ExplicitRoot');
test(function() {
var observer = new IntersectionObserver(function() {}, { threshold: 0.45 });
assert_array_equals(observer.thresholds, [0.45]);
},'ExplicitThreshold');
test(function() {
var observer = new IntersectionObserver(function() {}, { threshold: [0, 0.33333678, 0.5, 0.76645] });
assert_array_equals(observer.thresholds, [0, 0.33333678, 0.5, 0.76645]);
},'ExplicitThresholds');
</script>
</body>
</html>