@@ -85,7 +85,7 @@ describe("CSSStyleDeclaration", () => {
8585 } ) ;
8686 } ) ;
8787
88- it ( "getting cssText returns empty string if computedflag is set" , ( ) => {
88+ it ( "getting cssText returns empty string if computed flag is set" , ( ) => {
8989 const window = {
9090 getComputedStyle : ( ) => { } ,
9191 DOMException : globalThis . DOMException
@@ -166,7 +166,28 @@ describe("CSSStyleDeclaration", () => {
166166 assert . strictEqual ( style . getPropertyPriority ( "--foo" ) , "important" ) ;
167167 } ) ;
168168
169- it ( "removeProperty throws if readonly flag is set" , ( ) => {
169+ it ( "setProperty throws if read-only flag is set" , ( ) => {
170+ const window = {
171+ getComputedStyle : ( ) => { } ,
172+ DOMException : globalThis . DOMException
173+ } ;
174+ const style = new CSSStyleDeclaration ( window ) ;
175+ style . setProperty ( "color" , "green" ) ;
176+ style . setReadOnlyFlag ( ) ;
177+ assert . throws (
178+ ( ) => {
179+ style . setProperty ( "color" , "red" ) ;
180+ } ,
181+ ( e ) => {
182+ assert . strictEqual ( e instanceof window . DOMException , true ) ;
183+ assert . strictEqual ( e . name , "NoModificationAllowedError" ) ;
184+ assert . strictEqual ( e . message , "Property color can not be modified." ) ;
185+ return true ;
186+ }
187+ ) ;
188+ } ) ;
189+
190+ it ( "removeProperty throws if read-only flag is set" , ( ) => {
170191 const window = {
171192 getComputedStyle : ( ) => { } ,
172193 DOMException : globalThis . DOMException
@@ -175,9 +196,7 @@ describe("CSSStyleDeclaration", () => {
175196 style . setProperty ( "--foo" , "green" ) ;
176197 style . setProperty ( "--bar" , "red" ) ;
177198 assert . strictEqual ( style . removeProperty ( "--foo" ) , "green" ) ;
178- style . setOptions ( {
179- readOnly : true
180- } ) ;
199+ style . setReadOnlyFlag ( ) ;
181200 assert . throws (
182201 ( ) => {
183202 style . removeProperty ( "--bar" ) ;
0 commit comments