rastrillo / fiesta Public

Task 5: the Row Rule, red then green open

On branch fiesta-1-1

Commit d49fca4 "A dropdown sits in a row beside what it acts on: the rule, the check, and the examples that show it". Hub CI passed on d49fca4: 48 of 48 shards, suite 102 s. Size unchanged (no CSS): fiesta.css 23,146, fiesta-plain.css 22,431, fiesta-signal.css 22,542.

Red 1: the checker's table against a stub returning nil

--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:103: alone at the top of the page, above its title:
          got  []
          want ["a dropdown sits in main[rst-page], not in a row" "a dropdown comes before the page header"]
    rows_rule_test.go:103: in a bare div:
          got  []
          want ["a dropdown sits in div, not in a row"]
    rows_rule_test.go:103: in a toolbar above the page's title:
          got  []
          want ["a dropdown comes before the page header"]
    rows_rule_test.go:103: a page header with no title:
          got  []
          want ["a page header holds a dropdown and no h1"]
    rows_rule_test.go:103: a section head with no heading:
          got  []
          want ["a section head holds a dropdown and no heading"]
    rows_rule_test.go:103: class-spelled, alone in the body:
          got  []
          want ["a dropdown sits in body, not in a row"]
    rows_rule_test.go:103: in a form that lays itself out:
          got  []
          want ["a dropdown sits in form[rst-search], not in a row"]
    rows_rule_test.go:103: a heading inside the menu is not the section's:
          got  []
          want ["a section head holds a dropdown and no heading"]
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.006s
FAIL

Red 2: the walk over every example, on the tree before the rewrite (4306038)

It names the five component states and nothing else.

--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
    rows_rule_test.go:240: put each menu in one of these rows: rst-box-head (a section head: a heading and its actions), rst-bulkbar (the bulk bar), rst-dropdown-menu (a dropdown inside a menu is one of that menu's rows), rst-lbar (a list's toolbar), rst-page-foot (the column's footer row), rst-page-header (the page header: a title and its actions), rst-shell-rail-foot (the rail's foot), rst-shell-tail (the shell's bar)
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL

Red 3: the same test file at 04d01e1 (scratch worktree /var/tmp/fiesta-rows-check, removed)

It also names layout-column/default, which Task 4's footer row fixed.

--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
    rows_rule_test.go:227: layout-column/default: a dropdown sits in main[rst-page], not in a row
    rows_rule_test.go:227: layout-column/default: a dropdown comes before the page header
    rows_rule_test.go:240: put each menu in one of these rows: rst-box-head (a section head: a heading and its actions), rst-bulkbar (the bulk bar), rst-dropdown-menu (a dropdown inside a menu is one of that menu's rows), rst-lbar (a list's toolbar), rst-page-foot (the column's footer row), rst-page-header (the page header: a title and its actions), rst-shell-rail-foot (the rail's foot), rst-shell-tail (the shell's bar)
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.015s
FAIL

Red 4: TestEachRowedStateHoldsOneComponent against the bare 1.0 examples

--- FAIL: TestEachRowedStateHoldsOneComponent (0.00s)
    example_test.go:752: dropdown/menu-idiom: example: no element carries rst-lbar
FAIL
FAIL	amadan.net/rastrillo/fiesta/example	0.002s
FAIL

Mutations of the checker, each one line, in scratch worktree /var/tmp/fiesta-t5-mut (removed)

That worktree held the old examples, so the walk is red in every run. Read the TestTheRowCheckNamesEachBreach lines: each one names the mutation's own case.

===== M1 no respelling : respelled, notes := markup.Respell([]byte(src)) -> respelled, notes := []byte(src), []markup.Note(nil)
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: class-spelled, alone in the body:
          got  []
          want ["a dropdown sits in body, not in a row"]
    rows_rule_test.go:210: class-spelled, in a section head with its heading:
          got  ["a dropdown sits in div, not in a row"]
          want []
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.010s
FAIL
===== M2 forms and searches not skipped : for row != nil && groupsControls(row) { -> for row != nil && false && groupsControls(row) {
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: in a toolbar, inside a form, after the toolbar's search:
          got  ["a dropdown sits in form, not in a row"]
          want []
    rows_rule_test.go:210: in a toolbar, inside a search's form:
          got  ["a dropdown sits in form, not in a row"]
          want []
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL
===== M3 no shell-chrome exception : !inShellChrome(n) { -> true {
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: in the shell's bar, before the page header:
          got  ["a dropdown comes before the page header"]
          want []
    rows_rule_test.go:210: in a menu in the rail's foot, before the page header:
          got  ["a dropdown comes before the page header" "a dropdown comes before the page header"]
          want []
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
    rows_rule_test.go:227: layout-topbar/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-topbar/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-sidebar/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-sidebar/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-sidebar-page/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-sidebar-page/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-console/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-console/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-console-page/default: a dropdown comes before the page header
    rows_rule_test.go:227: layout-console-page/default: a dropdown comes before the page header
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL
===== M4 a heading in the menu counts : if c.Type != xhtml.ElementNode || isDropdown(c) { -> if c.Type != xhtml.ElementNode {
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: a heading inside the menu is not the section's:
          got  []
          want ["a section head holds a dropdown and no heading"]
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL
===== M5 a styled form is skipped too : return !slices.ContainsFunc(n.Attr, func(a xhtml.Attribute) bool { return strings.HasPrefix(a.Key, "rst-") }) -> return true
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: in a form that lays itself out:
          got  []
          want ["a dropdown sits in form[rst-search], not in a row"]
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL
===== M6 a page header needs no h1 : nodeCarries(row, "rst-page-header") && !holds(row, "h1") -> false
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: a page header with no title:
          got  []
          want ["a page header holds a dropdown and no h1"]
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL
===== M7 a section head needs no heading : nodeCarries(row, "rst-box-head") && !holds(row, "h2", "h3", "h4", "h5", "h6") -> false
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: a section head with no heading:
          got  []
          want ["a section head holds a dropdown and no heading"]
    rows_rule_test.go:210: a heading inside the menu is not the section's:
          got  []
          want ["a section head holds a dropdown and no heading"]
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL
===== M8 nothing checked above the title : header >= 0 && at < header -> false && at < header
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:210: alone at the top of the page, above its title:
          got  ["a dropdown sits in main[rst-page], not in a row"]
          want ["a dropdown sits in main[rst-page], not in a row" "a dropdown comes before the page header"]
    rows_rule_test.go:210: in a toolbar above the page's title:
          got  []
          want ["a dropdown comes before the page header"]
--- FAIL: TestEveryDropdownSitsInARow (0.01s)
    rows_rule_test.go:227: dropdown/a-filter-menu-with-one-choice-applied: a dropdown sits in body, not in a row
    rows_rule_test.go:227: dropdown/menu-idiom: a dropdown sits in body, not in a row
    rows_rule_test.go:227: locale-menu/twelve-languages-current-highlighted: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/three-choices-dark-current: a dropdown sits in body, not in a row
    rows_rule_test.go:227: scheme-menu/standalone: a dropdown sits in body, not in a row
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.015s
FAIL

Green, locally

go test . ./example ./check ./internal/gallery ./internal/www -count=1: all ok
./hack/gotest.sh browser internal.gallery -run TestPreviewFrameHeightsFit: ok (373.8s); no height changes needed
ok  	amadan.net/rastrillo/fiesta/check	65.286s
(./hack/gotest.sh browser check -run Dropdown|Scheme|Menu)
ok  	amadan.net/rastrillo/fiesta/internal/gallery	51.997s
(./hack/gotest.sh browser internal.gallery -run TestEveryExamplePassesAxe|TestTheSchemeMenuRepaintsTheFrames)

Fixes after Astra's review: 939f375

Commit 939f375 "Ask every enclosing header for its heading, and read unrespelled classes off the element, not the notes". Only check/rowsruletest.go changes. Hub CI passed on 939f375: 48 of 48 shards, suite 103 s.

  1. Every page header and section head around a dropdown must hold its heading, not only the nearest row. Both spellings are covered.
  2. The respeller's notes are no longer read. The breach is an element whose class list still names a component class after respelling, read off the parsed element. Escaped code is text and passes.

Red: the new controls against d49fca4's checker

--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:232: in a toolbar inside a page header with no title:
          got  []
          want ["a page header holds a dropdown and no h1"]
    rows_rule_test.go:232: class-spelled, in a toolbar inside a page header with no title:
          got  []
          want ["a page header holds a dropdown and no h1"]
    rows_rule_test.go:232: in a toolbar inside a section head with no heading:
          got  []
          want ["a section head holds a dropdown and no heading"]
    rows_rule_test.go:232: class-spelled, in a toolbar inside a section head with no heading:
          got  []
          want ["a section head holds a dropdown and no heading"]
    rows_rule_test.go:232: a class list the respeller cannot read:
          got  ["the markup could not be respelled: 1: class=\"rst-dropdown{{if\" is a shape this cannot take apart — an unquoted value with a template action in it. Quote it, or rewrite it by hand: left as it was"]
          want ["a class list could not be respelled, so the check cannot read it: <details class=\"rst-dropdown{{if .Open}}x{{end}}\">"]
    rows_rule_test.go:232: escaped markup in a code sample:
          got  ["the markup could not be respelled: 1: escaped markup (class=&quot;rst-box&quot;) is documentation rather than markup: rewrite it by hand if it should teach the attribute spelling"]
          want []
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.002s
FAIL

The unreadable-class control was then changed to a value with no space (class=rst-dropdown{{.Open}}), because an unquoted value ends at its first space when the parser reads it.

Mutations of the fix (scratch worktree /var/tmp/fiesta-t5-fix, removed)

===== F1 an unread class list is not reported : if _, _, ok := markup.Attribute(name); ok { -> if _, _, ok := markup.Attribute(name); ok && false {
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:260: a class list the respeller cannot read:
          got  []
          want ["a class list could not be respelled, so the check cannot read it: <details class=\"rst-dropdown{{.Open}}\">"]
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.015s
FAIL
===== F2 only the nearest row is checked for its heading : for p := n.Parent; p != nil; p = p.Parent { -> for p := row; p != nil; p = nil {
--- FAIL: TestTheRowCheckNamesEachBreach (0.00s)
    rows_rule_test.go:260: in a toolbar inside a page header with no title:
          got  []
          want ["a page header holds a dropdown and no h1"]
    rows_rule_test.go:260: class-spelled, in a toolbar inside a page header with no title:
          got  []
          want ["a page header holds a dropdown and no h1"]
    rows_rule_test.go:260: in a toolbar inside a section head with no heading:
          got  []
          want ["a section head holds a dropdown and no heading"]
    rows_rule_test.go:260: class-spelled, in a toolbar inside a section head with no heading:
          got  []
          want ["a section head holds a dropdown and no heading"]
FAIL
FAIL	amadan.net/rastrillo/fiesta/check	0.014s
FAIL

Green

go vet ./check: ok
go test ./check -count=1: ok