Skip to content

Commit

Permalink
style: Add some more tests for disallowed rootMargin values.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam authored and emilio committed Oct 17, 2017
1 parent ac74cd5 commit 893415c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions components/style/values/specified/gecko.rs
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/wpt/metadata/MANIFEST.json
Expand Up @@ -557079,7 +557079,7 @@
"testharness"
],
"intersection-observer/observer-exceptions.html": [
"28ccc6905713894b43033e30949170439215bf2e",
"85d5416475091c1020e0ff92b15f841bf58c606e",
"testharness"
],
"intersection-observer/observer-in-iframe.html": [
Expand Down
Expand Up @@ -31,7 +31,19 @@
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() {
Expand Down

0 comments on commit 893415c

Please sign in to comment.