Auto merge of #18917 - heycam:observer-test, r=emilio

style: Add some more tests for disallowed rootMargin values.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18917)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-17 08:11:16 -05:00 committed by GitHub
commit aa3122e7d1
3 changed files with 19 additions and 2 deletions

View file

@ -81,6 +81,11 @@ impl ToNsCssValue for PixelOrPercentage {
}
/// The value of an IntersectionObserver's rootMargin property.
///
/// Only bare px or percentage values are allowed. Other length units and
/// calc() values are not allowed.
///
/// https://w3c.github.io/IntersectionObserver/#parse-a-root-margin
pub struct IntersectionObserverRootMargin(pub Rect<PixelOrPercentage>);
impl Parse for IntersectionObserverRootMargin {

View file

@ -557079,7 +557079,7 @@
"testharness"
],
"intersection-observer/observer-exceptions.html": [
"28ccc6905713894b43033e30949170439215bf2e",
"85d5416475091c1020e0ff92b15f841bf58c606e",
"testharness"
],
"intersection-observer/observer-in-iframe.html": [

View file

@ -31,7 +31,19 @@ test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "auto"})
})
}, 'IntersectionObserver constructor width { rootMargin: "auto" }');
}, 'IntersectionObserver constructor with { rootMargin: "auto" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "calc(1px + 2px)"})
})
}, 'IntersectionObserver constructor with { rootMargin: "calc(1px + 2px)" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "1px !important"})
})
}, 'IntersectionObserver constructor with { rootMargin: "1px !important" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {