1# A link to one shelf (/dami/#games, from the home page's topics) opens the2# owner's page on that shelf's tab, also when followed on the page itself;3# an address naming no shelf opens on "all". Without JS the address picks the panel too (:target, in the4# shelves macro's CSS).5. "$(dirname "$0")/../lib.sh"6user dami7for r in chess go notes blog; do8 repo "dami/$r"9 clone dami "dami/$r" "$T/w/$r"10 tick 360011 at "$T/w/$r" commit "first"12 push_as dami "$T/w/$r" origin main13done14printf 'games\n' >"$FORGE_ROOT/dami/chess.git/category"15printf 'games\n' >"$FORGE_ROOT/dami/go.git/category"16printf 'tools\n' >"$FORGE_ROOT/dami/notes.git/category"17export FORGE_STRICT=118build19i=$FORGE_WWW/dami/index.html20page() { node --no-warnings "$T_HOME/test/page.ts" shelves "$i" "$@"; }21has "$FORGE_WWW/index.html" '<a href="/dami/#games">games'22eq "$(page '#games')" "games 2: go chess"23eq "$(page '#tools')" "tools 1: notes"24eq "$(page '#nothing')" "all 4: blog notes go chess"25# Following such a link on the page itself, or going back: the address26# changes, the page stays.27eq "$(page go '#games')" "games 2: go chess"28eq "$(page click '[data-shelves] a[data-shelf="tools"]' go '#games')" "games 2: go chess"29eq "$(page '#games' go '#')" "all 4: blog notes go chess"30has "$i" '<section class="panel shelf" data-shelf="games" id="games">'31css=$FORGE_WWW$(grep -o '/assets/[A-Za-z0-9_-]*\.css' "$i" | while read -r f; do grep -q shelves-js "$FORGE_WWW$f" && echo "$f"; done | head -n 1)32has "$css" '\.shelves:not\(\.shelves-js\) > \.shelf\[data-shelf\]:not\(\[data-shelf=""\]\):not\(:target\) \{ display: none; \}'33has "$css" '\.shelves:not\(\.shelves-js\):has\(> \.shelf:target\) > \.shelf\[data-shelf=""\] \{ display: none; \}'