From b6667181ee05ed8e17a3f0179a725f63c2da48ab Mon Sep 17 00:00:00 2001 From: Jonathan Chan Date: Thu, 12 Oct 2017 09:30:15 -0400 Subject: [PATCH] Correctly test CSSStyleRule.style. Remove the assert_readonly test and add one to verify that assigning to CSSStyleRule.style correctly forwards to CSSStyleRule.style.cssText. We currently test for whether CSSStyleRule.style is read-only by trying to assign to it; however, the spec has it as actually: interface CSSStyleRule : CSSRule { ... [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; }; See: https://drafts.csswg.org/cssom/ The `PutForwards=cssText` means that assigning to CSSStyleRule.style should actually assign to style.cssText. --- tests/wpt/metadata/MANIFEST.json | 2 +- .../cssom/CSSStyleRule.html | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 34e824fc394..25f3e0fcdda 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -574763,7 +574763,7 @@ "testharness" ], "cssom/CSSStyleRule.html": [ - "e9d0acfc0c9123dcd2295e217bdfc1ac5195c3f0", + "9fe62d2e23709b77e9b5cda4522ec1c04d2940cf", "testharness" ], "cssom/CSSStyleSheet.html": [ diff --git a/tests/wpt/web-platform-tests/cssom/CSSStyleRule.html b/tests/wpt/web-platform-tests/cssom/CSSStyleRule.html index b103d3310a9..3acdfb12852 100644 --- a/tests/wpt/web-platform-tests/cssom/CSSStyleRule.html +++ b/tests/wpt/web-platform-tests/cssom/CSSStyleRule.html @@ -67,7 +67,24 @@ assert_idl_attribute(rule, "selectorText"); assert_equals(typeof rule.selectorText, "string"); assert_idl_attribute(rule, "style"); - }, "Existence, writability and type of CSSStyleRule attributes"); + }, "Existence and type of CSSStyleRule attributes"); + + test(function() { + // CSSStyleRule.style has PutForwards=cssText and SameObject. + var initial = rule.style.cssText; + var style = rule.style; + + rule.style = ""; + assert_equals(rule.style.cssText, ""); + assert_equals(rule.style, style); + + rule.style = "margin: 42px;"; + assert_equals(rule.style.margin, "42px"); + assert_equals(rule.style, style); + + rule.style = initial; + assert_equals(rule.style, style); + }, "Assigning to CSSStyleRule.style assigns to cssText; CSSStyleRule.style returns the same object"); test(function() { assert_equals(rule.selectorText, "div");