dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / css / tests_css_sheets_cases.lucb
#==============================================================================================
#
# tests_css_sheets_cases - the style sheet, rule list and rule cases pinned to the reference
# build
#
# DESCRIPTION:
# Generated (a test vector table) from the output of a local oracle that runs the
# reference Ladybird build's CSS parser and CSSOM on the same inputs (luce-browser-tools,
# oracles/luce-browser-engine/css_sheets: cases.txt, oracle.cpp, gen_luce_cases.py,
# build.sh). tests_css_sheets runs each case through the port and compares the output.
#
#==============================================================================================
## One oracle case: the mode, its arguments, and the reference build's output.
struct TestCssSheetsCase:
let mode: str
let arguments: str[4]
let expected: str
## Every oracle case, in cases.txt order (0 more, marked "!" in cases.txt, wait for other regions).
let test_css_sheets_cases: TestCssSheetsCase[134] = [
TestCssSheetsCase(mode = "sheet", arguments = ["", "", "", ""], expected = " rules 0\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a {}", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a, b > c, .x#y {}", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a, b > c, .x#y { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a {} b {} c {}", "", "", ""], expected = " rules 3\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n CSSStyleRule type=1 internal=1 text=c { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a { b {} }", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & b { }\n}\n CSSStyleRule type=1 internal=1 text=& b { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a { & b {} .c {} }", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & b { }\n & .c { }\n}\n CSSStyleRule type=1 internal=1 text=& b { }\n CSSStyleRule type=1 internal=1 text=& .c { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a { b { c {} } }", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & b {\n & c { }\n}\n}\n CSSStyleRule type=1 internal=1 text=& b {\n & c { }\n}\n CSSStyleRule type=1 internal=1 text=& c { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer x;", "", "", ""], expected = " rules 1\n CSSLayerStatementRule type=0 internal=101 text=@layer x;\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer x, y.z, w;", "", "", ""], expected = " rules 1\n CSSLayerStatementRule type=0 internal=101 text=@layer x, y.z, w;\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer x { a {} }", "", "", ""], expected = " rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n a { }\n}\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer { a {} }", "", "", ""], expected = " rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer {\n a { }\n}\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer x {}", "", "", ""], expected = " rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n}\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer x { @layer y { a {} } b {} }", "", "", ""], expected = " rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n @layer y {\n a { }\n}\n b { }\n}\n CSSLayerBlockRule type=0 internal=100 text=@layer y {\n a { }\n}\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@layer a, b; @layer a { x {} } @layer { y {} }", "", "", ""], expected = " rules 3\n CSSLayerStatementRule type=0 internal=101 text=@layer a, b;\n CSSLayerBlockRule type=0 internal=100 text=@layer a {\n x { }\n}\n CSSStyleRule type=1 internal=1 text=x { }\n CSSLayerBlockRule type=0 internal=100 text=@layer {\n y { }\n}\n CSSStyleRule type=1 internal=1 text=y { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@namespace url(http://www.w3.org/2000/svg);", "", "", ""], expected = " rules 1\n CSSNamespaceRule type=10 internal=10 text=@namespace url(\"http://www.w3.org/2000/svg\");\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@namespace svg url(http://www.w3.org/2000/svg);", "", "", ""], expected = " rules 1\n CSSNamespaceRule type=10 internal=10 text=@namespace svg url(\"http://www.w3.org/2000/svg\");\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@namespace svg \"http://www.w3.org/2000/svg\";", "", "", ""], expected = " rules 1\n CSSNamespaceRule type=10 internal=10 text=@namespace svg url(\"http://www.w3.org/2000/svg\");\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@namespace svg url(http://www.w3.org/2000/svg); svg|rect {}", "", "", ""], expected = " rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace svg url(\"http://www.w3.org/2000/svg\");\n CSSStyleRule type=1 internal=1 text=svg|rect { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@namespace a url(x); @namespace b url(y); a|p {} b|q {} *|r {}", "", "", ""], expected = " rules 5\n CSSNamespaceRule type=10 internal=10 text=@namespace a url(\"x\");\n CSSNamespaceRule type=10 internal=10 text=@namespace b url(\"y\");\n CSSStyleRule type=1 internal=1 text=a|p { }\n CSSStyleRule type=1 internal=1 text=b|q { }\n CSSStyleRule type=1 internal=1 text=r { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a {} @namespace x url(y);", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@page {}", "", "", ""], expected = " rules 1\n CSSPageRule type=6 internal=6 text=@page { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@page :first {}", "", "", ""], expected = " rules 1\n CSSPageRule type=6 internal=6 text=@page :first { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@page foo:left, bar {}", "", "", ""], expected = " rules 1\n CSSPageRule type=6 internal=6 text=@page foo:left, bar { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@page { @top-left {} }", "", "", ""], expected = " rules 1\n CSSPageRule type=6 internal=6 text=@page { @top-left { } }\n CSSMarginRule type=9 internal=9 text=@top-left { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@keyframes foo {}", "", "", ""], expected = " rules 1\n CSSKeyframesRule type=7 internal=7 text=@keyframes \"foo\" { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@keyframes \"bar\" {}", "", "", ""], expected = " rules 1\n CSSKeyframesRule type=7 internal=7 text=@keyframes \"bar\" { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@function --foo() {}", "", "", ""], expected = " rules 1\n CSSFunctionRule type=0 internal=104 text=@function --foo() { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@function --foo(--a, --b) {}", "", "", ""], expected = " rules 1\n CSSFunctionRule type=0 internal=104 text=@function --foo(--a, --b) { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@function --foo() { @layer x {} }", "", "", ""], expected = " rules 1\n CSSFunctionRule type=0 internal=104 text=@function --foo() { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a {} @layer x; b { c {} }", "", "", ""], expected = " rules 3\n CSSStyleRule type=1 internal=1 text=a { }\n CSSLayerStatementRule type=0 internal=101 text=@layer x;\n CSSStyleRule type=1 internal=1 text=b {\n & c { }\n}\n CSSStyleRule type=1 internal=1 text=& c { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["@unknown { a {} } b {}", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = ["a { @layer x { b {} } }", "", "", ""], expected = " rules 1\n CSSStyleRule type=1 internal=1 text=a {\n @layer x {\n & b { }\n}\n}\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n & b { }\n}\n CSSStyleRule type=1 internal=1 text=& b { }\n"),
TestCssSheetsCase(mode = "sheet", arguments = [":is(a, b) {} ::before {} a:hover {}", "", "", ""], expected = " rules 3\n CSSStyleRule type=1 internal=1 text=:is(a, b) { }\n CSSStyleRule type=1 internal=1 text=::before { }\n CSSStyleRule type=1 internal=1 text=a:hover { }\n"),
TestCssSheetsCase(mode = "dump", arguments = ["a, b {}", "", "", ""], expected = " dump: CSSStyleRule:\n dump: CSS::Selector:\n dump: {None} TagName:NamespaceType=Default, Namespace='', Name='a'\n dump: CSS::Selector:\n dump: {None} TagName:NamespaceType=Default, Namespace='', Name='b'\n dump: Declarations (0):\n dump: Child rules (0):\n"),
TestCssSheetsCase(mode = "dump", arguments = ["a { b {} }", "", "", ""], expected = " dump: CSSStyleRule:\n dump: CSS::Selector:\n dump: {None} TagName:NamespaceType=Default, Namespace='', Name='a'\n dump: Declarations (0):\n dump: Child rules (1):\n dump: CSSStyleRule:\n dump: CSS::Selector:\n dump: {None} Nesting:\n dump: {Descendant} TagName:NamespaceType=Default, Namespace='', Name='b'\n dump: Declarations (0):\n dump: Child rules (0):\n"),
TestCssSheetsCase(mode = "dump", arguments = ["@layer x, y;", "", "", ""], expected = " dump: CSSLayerStatementRule:\n dump: Names: x, y\n"),
TestCssSheetsCase(mode = "dump", arguments = ["@layer x { a {} }", "", "", ""], expected = " dump: CSSLayerBlockRule:\n dump: Name: `x` (internal `x`)\n dump: Rules (1):\n dump: CSSStyleRule:\n dump: CSS::Selector:\n dump: {None} TagName:NamespaceType=Default, Namespace='', Name='a'\n dump: Declarations (0):\n dump: Child rules (0):\n"),
TestCssSheetsCase(mode = "dump", arguments = ["@namespace svg url(http://www.w3.org/2000/svg);", "", "", ""], expected = " dump: CSSNamespaceRule:\n dump: Namespace: http://www.w3.org/2000/svg\n dump: Prefix: svg\n"),
TestCssSheetsCase(mode = "dump", arguments = ["@page :first {}", "", "", ""], expected = " dump: CSSPageRule:\n dump: Selector: :first\n dump: Declarations (0):\n dump: Rules (0):\n"),
TestCssSheetsCase(mode = "dump", arguments = ["@keyframes foo {}", "", "", ""], expected = " dump: CSSKeyframesRule:\n dump: Name: foo\n dump: Keyframes (0):\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "b {}", "0", ""], expected = " inserted at 0\n rules 2\n CSSStyleRule type=1 internal=1 text=b { }\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "b {}", "1", ""], expected = " inserted at 1\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "b {}", "2", ""], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "bogus {", "0", ""], expected = " inserted at 0\n rules 2\n CSSStyleRule type=1 internal=1 text=bogus { }\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "@layer x;", "0", ""], expected = " inserted at 0\n rules 2\n CSSLayerStatementRule type=0 internal=101 text=@layer x;\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "@namespace x url(y);", "0", ""], expected = " exception InvalidStateError: Cannot insert @namespace rule into a stylesheet with non-namespace/import rules\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "@namespace x url(y);", "1", ""], expected = " exception HierarchyRequestError: Cannot insert rule at specified index.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["@namespace x url(y);", "@namespace z url(w);", "1", ""], expected = " inserted at 1\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n CSSNamespaceRule type=10 internal=10 text=@namespace z url(\"w\");\n"),
TestCssSheetsCase(mode = "insert", arguments = ["@namespace x url(y);", "@namespace z url(w);", "0", ""], expected = " inserted at 0\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace z url(\"w\");\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n"),
TestCssSheetsCase(mode = "insert", arguments = ["@namespace x url(y);", "a {}", "1", ""], expected = " inserted at 1\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["@namespace x url(y);", "a {}", "0", ""], expected = " exception HierarchyRequestError: Cannot insert rule at specified index.\n rules 1\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n"),
TestCssSheetsCase(mode = "insert", arguments = ["@layer a; a {}", "@layer b;", "1", ""], expected = " inserted at 1\n rules 3\n CSSLayerStatementRule type=0 internal=101 text=@layer a;\n CSSLayerStatementRule type=0 internal=101 text=@layer b;\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "b {} c {}", "0", ""], expected = " exception SyntaxError: Unable to parse CSS rule.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "@layer x { y {} }", "1", ""], expected = " inserted at 1\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n y { }\n}\n CSSStyleRule type=1 internal=1 text=y { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["@namespace svg url(http://www.w3.org/2000/svg);", "svg|a {}", "1", ""], expected = " inserted at 1\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace svg url(\"http://www.w3.org/2000/svg\");\n CSSStyleRule type=1 internal=1 text=svg|a { }\n"),
TestCssSheetsCase(mode = "insert", arguments = ["a {}", "q|a {}", "1", ""], expected = " exception SyntaxError: Unable to parse CSS rule.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "delete", arguments = ["a {} b {}", "0", "", ""], expected = " deleted\n rules 1\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "delete", arguments = ["a {} b {}", "1", "", ""], expected = " deleted\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "delete", arguments = ["a {} b {}", "2", "", ""], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "delete", arguments = ["@namespace x url(y);", "0", "", ""], expected = " deleted\n rules 0\n"),
TestCssSheetsCase(mode = "delete", arguments = ["@namespace x url(y); a {}", "0", "", ""], expected = " exception InvalidStateError: Cannot remove @namespace rule from a stylesheet with non-namespace/import rules.\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "delete", arguments = ["@namespace x url(y); @namespace z url(w);", "0", "", ""], expected = " deleted\n rules 1\n CSSNamespaceRule type=10 internal=10 text=@namespace z url(\"w\");\n"),
TestCssSheetsCase(mode = "addrule", arguments = ["a {}", "b", "-", "-"], expected = " returned -1\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "addrule", arguments = ["a {}", "b", "-", "0"], expected = " returned -1\n rules 2\n CSSStyleRule type=1 internal=1 text=b { }\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "addrule", arguments = ["a {}", "-", "-", "-"], expected = " exception SyntaxError: Unable to parse CSS rule.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "addrule", arguments = ["a {}", "b", "-", "5"], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["a {}", "b {}", "0", ""], expected = " inserted at 0\n rules 1\n CSSStyleRule type=1 internal=1 text=a {\n b { }\n}\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["a { c {} }", "b {}", "1", ""], expected = " inserted at 1\n rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & c { }\n b { }\n}\n CSSStyleRule type=1 internal=1 text=& c { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["a { c {} }", "b {}", "2", ""], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & c { }\n}\n CSSStyleRule type=1 internal=1 text=& c { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["a {}", "@namespace x url(y);", "0", ""], expected = " exception HierarchyRequestError: Cannot insert rule at specified index.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["a {}", "@layer x;", "0", ""], expected = " inserted at 0\n rules 1\n CSSStyleRule type=1 internal=1 text=a {\n @layer x;\n}\n CSSLayerStatementRule type=0 internal=101 text=@layer x;\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["@layer x { a {} }", "b {}", "0", ""], expected = " inserted at 0\n rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n b { }\n a { }\n}\n CSSStyleRule type=1 internal=1 text=b { }\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["@layer x { a {} }", "@layer y { c {} }", "1", ""], expected = " inserted at 1\n rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n a { }\n @layer y {\n c { }\n}\n}\n CSSStyleRule type=1 internal=1 text=a { }\n CSSLayerBlockRule type=0 internal=100 text=@layer y {\n c { }\n}\n CSSStyleRule type=1 internal=1 text=c { }\n"),
TestCssSheetsCase(mode = "ginsert", arguments = ["a {}", "bogus", "0", ""], expected = " exception SyntaxError: Unable to parse CSS declarations block.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "gdelete", arguments = ["a { b {} c {} }", "0", "", ""], expected = " deleted\n rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & c { }\n}\n CSSStyleRule type=1 internal=1 text=& c { }\n"),
TestCssSheetsCase(mode = "gdelete", arguments = ["a { b {} c {} }", "2", "", ""], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 1\n CSSStyleRule type=1 internal=1 text=a {\n & b { }\n & c { }\n}\n CSSStyleRule type=1 internal=1 text=& b { }\n CSSStyleRule type=1 internal=1 text=& c { }\n"),
TestCssSheetsCase(mode = "gdelete", arguments = ["@layer x { a {} }", "0", "", ""], expected = " deleted\n rules 1\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n}\n"),
TestCssSheetsCase(mode = "selector", arguments = ["a {}", "b", "", ""], expected = " selectorText b\n rules 1\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "selector", arguments = ["a {}", "b, c > d", "", ""], expected = " selectorText b, c > d\n rules 1\n CSSStyleRule type=1 internal=1 text=b, c > d { }\n"),
TestCssSheetsCase(mode = "selector", arguments = ["a {}", "!!!", "", ""], expected = " selectorText a\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "selector", arguments = ["a {}", "", "", ""], expected = " selectorText a\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "selector", arguments = ["a { b {} }", "c", "", ""], expected = " selectorText c\n rules 1\n CSSStyleRule type=1 internal=1 text=c {\n & b { }\n}\n CSSStyleRule type=1 internal=1 text=& b { }\n"),
TestCssSheetsCase(mode = "pageselector", arguments = ["@page {}", ":first", "", ""], expected = " selectorText :first\n rules 1\n CSSPageRule type=6 internal=6 text=@page :first { }\n"),
TestCssSheetsCase(mode = "pageselector", arguments = ["@page :left {}", "foo:right, bar", "", ""], expected = " selectorText foo:right, bar\n rules 1\n CSSPageRule type=6 internal=6 text=@page foo:right, bar { }\n"),
TestCssSheetsCase(mode = "pageselector", arguments = ["@page :left {}", "!!", "", ""], expected = " selectorText :left\n rules 1\n CSSPageRule type=6 internal=6 text=@page :left { }\n"),
TestCssSheetsCase(mode = "namespace", arguments = ["@namespace url(http://example.com/default);", "", "", ""], expected = " namespace_uri 'http://example.com/default'\n default 'http://example.com/default'\n declared '' \n imports 0\n"),
TestCssSheetsCase(mode = "namespace", arguments = ["@namespace svg url(http://www.w3.org/2000/svg);", "svg", "", ""], expected = " namespace_uri 'http://www.w3.org/2000/svg'\n default none\n declared 'svg' \n imports 0\n"),
TestCssSheetsCase(mode = "namespace", arguments = ["@namespace svg url(http://www.w3.org/2000/svg);", "html", "", ""], expected = " namespace_uri none\n default none\n declared 'svg' \n imports 0\n"),
TestCssSheetsCase(mode = "namespace", arguments = ["@namespace svg url(x); @namespace url(y); @namespace svg url(z);", "svg", "", ""], expected = " namespace_uri 'z'\n default 'y'\n declared '' 'svg' \n imports 0\n"),
TestCssSheetsCase(mode = "namespace", arguments = ["a {} @namespace svg url(x);", "svg", "", ""], expected = " namespace_uri none\n default none\n declared \n imports 0\n"),
TestCssSheetsCase(mode = "namespace", arguments = ["@layer a; @namespace svg url(x);", "svg", "", ""], expected = " namespace_uri none\n default none\n declared \n imports 0\n"),
TestCssSheetsCase(mode = "layers", arguments = ["@layer x { a {} }", "", "", ""], expected = " block name='x' qualified='x'\n style 'a' layer='x'\n"),
TestCssSheetsCase(mode = "layers", arguments = ["@layer { a {} } @layer { b {} }", "", "", ""], expected = " block name='' qualified='#3'\n style 'a' layer='#3'\n block name='' qualified='#4'\n style 'b' layer='#4'\n"),
TestCssSheetsCase(mode = "layers", arguments = ["@layer x { @layer y { a {} } }", "", "", ""], expected = " block name='x' qualified='x'\n block name='y' qualified='x.y'\n style 'a' layer='x.y'\n"),
TestCssSheetsCase(mode = "layers", arguments = ["@layer x { @layer y, z; }", "", "", ""], expected = " block name='x' qualified='x'\n statement 'x.y,x.z'\n"),
TestCssSheetsCase(mode = "layers", arguments = ["@layer x.y { a { b {} } }", "", "", ""], expected = " block name='x.y' qualified='x.y'\n style 'a' layer='x.y'\n style '& b' layer='x.y'\n"),
TestCssSheetsCase(mode = "layers", arguments = ["a {}", "", "", ""], expected = " style 'a' layer=''\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "b {}", "0", ""], expected = " inserted at 0\n rules 2\n CSSStyleRule type=1 internal=1 text=b { }\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "b {}", "1", ""], expected = " inserted at 1\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "b {}", "2", ""], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "bogus {", "0", ""], expected = " inserted at 0\n rules 2\n CSSStyleRule type=1 internal=1 text=bogus { }\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "bogus", "0", ""], expected = " exception SyntaxError: Unable to parse CSS rule.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "@layer x;", "0", ""], expected = " inserted at 0\n rules 2\n CSSLayerStatementRule type=0 internal=101 text=@layer x;\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "b {} c {}", "0", ""], expected = " exception SyntaxError: Unable to parse CSS rule.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "@layer x { y {} }", "1", ""], expected = " inserted at 1\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSLayerBlockRule type=0 internal=100 text=@layer x {\n y { }\n}\n CSSStyleRule type=1 internal=1 text=y { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["@layer a; a {}", "@layer b;", "1", ""], expected = " inserted at 1\n rules 3\n CSSLayerStatementRule type=0 internal=101 text=@layer a;\n CSSLayerStatementRule type=0 internal=101 text=@layer b;\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["@layer a; a {}", "@layer b;", "2", ""], expected = " inserted at 2\n rules 3\n CSSLayerStatementRule type=0 internal=101 text=@layer a;\n CSSStyleRule type=1 internal=1 text=a { }\n CSSLayerStatementRule type=0 internal=101 text=@layer b;\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "q|a {}", "1", ""], expected = " exception SyntaxError: Unable to parse CSS rule.\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["a {}", "@namespace x url(y);", "0", ""], expected = " exception InvalidStateError: Cannot insert @namespace rule into a stylesheet with non-namespace/import rules\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["@namespace x url(y);", "a {}", "0", ""], expected = " exception HierarchyRequestError: Cannot insert rule at specified index.\n rules 1\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["@namespace x url(y);", "@namespace z url(w);", "1", ""], expected = " inserted at 1\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n CSSNamespaceRule type=10 internal=10 text=@namespace z url(\"w\");\n"),
TestCssSheetsCase(mode = "listinsert", arguments = ["@namespace svg url(http://www.w3.org/2000/svg);", "svg|a {}", "1", ""], expected = " inserted at 1\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace svg url(\"http://www.w3.org/2000/svg\");\n CSSStyleRule type=1 internal=1 text=svg|a { }\n"),
TestCssSheetsCase(mode = "listremove", arguments = ["a {} b {}", "0", "", ""], expected = " deleted\n rules 1\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "listremove", arguments = ["a {} b {}", "1", "", ""], expected = " deleted\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listremove", arguments = ["a {} b {}", "2", "", ""], expected = " exception IndexSizeError: CSS rule index out of bounds.\n rules 2\n CSSStyleRule type=1 internal=1 text=a { }\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "listremove", arguments = ["@layer x; a {}", "0", "", ""], expected = " deleted\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listremove", arguments = ["@namespace x url(y); a {}", "0", "", ""], expected = " exception InvalidStateError: Cannot remove @namespace rule from a stylesheet with non-namespace/import rules.\n rules 2\n CSSNamespaceRule type=10 internal=10 text=@namespace x url(\"y\");\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "listremove", arguments = ["@namespace x url(y);", "0", "", ""], expected = " deleted\n rules 0\n"),
TestCssSheetsCase(mode = "selectorfree", arguments = ["a {}", "b", "", ""], expected = " selectorText b\n rules 1\n CSSStyleRule type=1 internal=1 text=b { }\n"),
TestCssSheetsCase(mode = "selectorfree", arguments = ["a {}", "b, c > d", "", ""], expected = " selectorText b, c > d\n rules 1\n CSSStyleRule type=1 internal=1 text=b, c > d { }\n"),
TestCssSheetsCase(mode = "selectorfree", arguments = ["a {}", "!!!", "", ""], expected = " selectorText a\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "selectorfree", arguments = ["a {}", "", "", ""], expected = " selectorText a\n rules 1\n CSSStyleRule type=1 internal=1 text=a { }\n"),
TestCssSheetsCase(mode = "selectorfree", arguments = ["a { b {} }", "c", "", ""], expected = " selectorText c\n rules 1\n CSSStyleRule type=1 internal=1 text=c {\n & b { }\n}\n CSSStyleRule type=1 internal=1 text=& b { }\n"),
TestCssSheetsCase(mode = "selectorfree", arguments = ["a {}", ":is(x, y)::before", "", ""], expected = " selectorText :is(x, y)::before\n rules 1\n CSSStyleRule type=1 internal=1 text=:is(x, y)::before { }\n"),
TestCssSheetsCase(mode = "properties", arguments = ["", "", "", ""], expected = " length 0 computed false readonly false\n item0 '' cssText ''\n color '' priority '' --x '' bogus ''\n margin '' cssFloat '' generated color ''\n remove color ''\n set color '' ok true\n set color priority bogus ok true\n set bogus ok true\n generated set_color '' ok true\n cssText '' ok true length 0\n has color false custom count 0\n serialize list ''\n resolved length 0 computed true readonly true item0 '' cssText '' color ''\n exception NoModificationAllowedError: Cannot modify properties in result of getComputedStyle()\n exception NoModificationAllowedError: Cannot remove property: CSSStyleProperties is read-only.\n exception NoModificationAllowedError: Cannot modify properties: CSSStyleProperties is read-only.\n"),
TestCssSheetsCase(mode = "descriptors", arguments = ["", "", "", ""], expected = " length 0 item0 '' cssText '' src '' family '' priority ''\n set bogus ok true set src '' ok true remove src '' remove bogus ''\n cssText '' ok true\n rule valid false text '@font-face { }' parent ok true\n dump: CSSFontFaceRule:\n dump: Valid: false\n dump: Declarations (0):\n page margin '' margin-top '' size '' shorthand margin true margin-top false font-face src false\n page margin longhands margin-top:null margin-right:null margin-bottom:null margin-left:null \n page remove margin ''\n function result ''\n"),
TestCssSheetsCase(mode = "counterstyle", arguments = ["", "", "", ""], expected = " text '@counter-style foo { }' name 'foo' system '' symbols '' speak-as ''\n set_name none -> foo\n set_name DISC -> foo\n set_name Decimal -> foo\n set_name lower-ROMAN -> lower-roman\n set_name Upper-Alpha -> upper-alpha\n set_name bar -> bar\n set_name Baz -> Baz\n non-overridable decimal true\n non-overridable DISC true\n non-overridable square true\n non-overridable circle true\n non-overridable disclosure-open true\n non-overridable disclosure-closed true\n non-overridable foo false\n non-overridable none false\n"),
TestCssSheetsCase(mode = "property", arguments = ["", "", "", ""], expected = " text '@property --my-prop { syntax: \"*\"; inherits: false; }' initial 'none'\n text '@property --a\\ b { syntax: \"<length> | auto\"; inherits: true; }' inherits true\n dump: CSSPropertyRule:\n dump: Name: --a b\n dump: Syntax: <length> | auto\n dump: Inherits: true\n"),
TestCssSheetsCase(mode = "container", arguments = ["", "", "", ""], expected = " text '@container sidebar {\n}' condition 'sidebar' name 'sidebar' query '' conditions 1\n text '@container a\\ b, {\n}' name '' conditions 2\n effective preorder CSSLayerStatementRule CSSLayerBlockRule CSSStyleRule CSSPageRule \n effective postorder CSSLayerStatementRule CSSStyleRule CSSLayerBlockRule CSSPageRule \n"),
TestCssSheetsCase(mode = "import", arguments = ["", "", "", ""], expected = " text '@import url(\"foo.css\");' href 'foo.css' layerName 'null' supportsText 'null' matches true state Unloaded\n dump: CSSImportRule:\n dump: Document URL: url(\"foo.css\")\n dump: Loading state: Unloaded\n dump: Style sheet not loaded\n text '@import url(\"foo.css\") layer;' href 'foo.css' layerName '' supportsText 'null' matches true state Unloaded\n dump: CSSImportRule:\n dump: Document URL: url(\"foo.css\")\n dump: Loading state: Unloaded\n dump: Layer: <anonymous>\n dump: Style sheet not loaded\n text '@import url(\"foo.css\") layer(x.y);' href 'foo.css' layerName 'x.y' supportsText 'null' matches true state Unloaded\n dump: CSSImportRule:\n dump: Document URL: url(\"foo.css\")\n dump: Loading state: Unloaded\n dump: Layer: <anonymous>\n dump: Style sheet not loaded\n"),
TestCssSheetsCase(mode = "keyframe", arguments = ["", "", "", ""], expected = " text '50% { }' key '50%'\n text '12.5% { }' key '12.5%'\n text '@keyframes \"spin\" { 50% { } 12.5% { } }' length 2 parent ok true\n dump: CSSKeyframesRule:\n dump: Name: spin\n dump: Keyframes (2):\n dump: CSSKeyframeRule:\n dump: Key: 50%\n dump: Declarations (0):\n dump: CSSKeyframeRule:\n dump: Key: 12.5%\n dump: Declarations (0):\n"),
TestCssSheetsCase(mode = "names", arguments = ["", "", "", ""], expected = " margin top-left-corner true\n margin TOP-LEFT true\n margin top-center true\n margin right-bottom true\n margin left-middle true\n margin top false\n margin bottom-middle false\n margin false\n feature stylistic true\n feature historical-forms true\n feature styleset true\n feature character-variant true\n feature swash true\n feature ornaments true\n feature annotation true\n feature Swash false\n feature font false\n identifier StyleElement 0\n identifier LinkElement 1\n identifier ImportRule 2\n identifier UserAgent 3\n identifier UserStyle 4\n identifier bogus false\n loading state Unloaded\n loading state Loading\n loading state Loaded\n loading state Error\n escape a\n escape a\\ b\n escape \\31 x\n escape \\-\n escape --x\n escape é\n"),
TestCssSheetsCase(mode = "nested", arguments = ["", "", "", ""], expected = " text '' parent ok true\n dump: CSSNestedDeclarations:\n dump: Declarations (0):\n"),
TestCssSheetsCase(mode = "media", arguments = ["", "", "", ""], expected = " length 0 matches true item0 none\n after '' length 0\n dump: Media list (0):\n sheet type text/css disabled false alternate false origin-clean true href none title none\n title t href https://example.com/a/b.css loading Loaded\n"),
]