Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cssText test cases in cssom-pagerule.html #50401

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions css/cssom/cssom-pagerule.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down