From 8f6af6ff9805a5d312d0724e299b7e9c56b09740 Mon Sep 17 00:00:00 2001 From: Ahmad Saleem <52317531+Ahmad-S792@users.noreply.github.com> Date: Fri, 31 Jan 2025 02:09:27 +0000 Subject: [PATCH] Add `cssText` test cases in `cssom-pagerule.html` It is just merge of test changes done in below WebKIt Commit: Commit: https://commits.webkit.org/289428@main --- css/cssom/cssom-pagerule.html | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/css/cssom/cssom-pagerule.html b/css/cssom/cssom-pagerule.html index 994257b2450b85..65c35e99a6812e 100644 --- a/css/cssom/cssom-pagerule.html +++ b/css/cssom/cssom-pagerule.html @@ -19,55 +19,108 @@ assert_equals(rule.selectorText, ""); }, "Page selector is initially the empty string"); + test(() => { + assert_equals(rule.cssText, "@page { }"); + }, "Page selector 'cssText' is initially the @page { }"); + test(() => { rule.selectorText = ":left"; assert_equals(rule.selectorText, ":left"); }, "Set selectorText to :left pseudo page"); + test(() => { + rule.selectorText = ":left"; + assert_equals(rule.cssText, "@page :left { }"); + }, "Set cssText to :left pseudo page"); + test(() => { rule.selectorText = "named"; assert_equals(rule.selectorText, "named"); }, "Set selectorText to named page"); + test(() => { + rule.selectorText = "named"; + assert_equals(rule.cssText, "@page named { }"); + }, "Set cssText to named page"); + test(() => { rule.selectorText = "named:first"; assert_equals(rule.selectorText, "named:first"); }, "Set selectorText to named page with :first pseudo page"); + test(() => { + rule.selectorText = "named:first"; + assert_equals(rule.cssText, "@page named:first { }"); + }, "Set cssText to named page with :first pseudo page"); + test(() => { rule.selectorText = "named:First"; assert_equals(rule.selectorText, "named:first"); }, "Set selectorText to named page with case insensitive :first pseudo page"); + test(() => { + rule.selectorText = "named:First"; + assert_equals(rule.cssText, "@page named:first { }"); + }, "Set cssText to named page with case insensitive :first pseudo page"); + test(() => { rule.selectorText = "named:first:first"; assert_equals(rule.selectorText, "named:first:first"); }, "Set selectorText to named page with two :first pseudo page"); + test(() => { + rule.selectorText = "named:first:first"; + assert_equals(rule.cssText, "@page named:first:first { }"); + }, "Set cssText to named page with two :first pseudo page"); + test(() => { rule.selectorText = "named:first:left:right:first"; assert_equals(rule.selectorText, "named:first:left:right:first"); }, "Set selectorText to named page with pseudo pages of " + ":first, :left, :right, :first in order."); + test(() => { + rule.selectorText = "named:first:left:right:first"; + assert_equals(rule.cssText, "@page named:first:left:right:first { }"); + }, "Set cssText to named page with pseudo pages of " + + ":first, :left, :right, :first in order."); + test(() => { rule.selectorText = ""; rule.selectorText = "named :first"; assert_equals(rule.selectorText, ""); }, "Cannot set selectorText to named page with pseudo, whitespace between"); + test(() => { + rule.selectorText = ""; + rule.selectorText = "named :first"; + assert_equals(rule.cssText, "@page { }"); + }, "Cannot set cssText to named page with pseudo, whitespace between - return default @page { }"); + test(() => { rule.selectorText = ""; rule.selectorText = ":first :left"; assert_equals(rule.selectorText, ""); }, "Cannot set selectorText to two pseudos, whitespace between"); + test(() => { + rule.selectorText = ""; + rule.selectorText = ":first :left"; + assert_equals(rule.cssText, "@page { }"); + }, "Cannot set cssText to two pseudos, whitespace between - return default @page { }"); + test(() => { rule.selectorText = ""; rule.selectorText = ":notapagepseudo"; assert_equals(rule.selectorText, ""); }, "Cannot set selectorText to invalid pseudo page"); + test(() => { + rule.selectorText = ""; + rule.selectorText = ":notapagepseudo"; + assert_equals(rule.cssText, "@page { }"); + }, "Cannot set cssText to invalid pseudo page - return default @page { }"); + test(() => { assert_equals(rule.parentStyleSheet, sheet); sheet.deleteRule(0);