package web
import (
"regexp"
"strings"
"testing"
)
// A strip that runs edge to edge subtracts the page's gutter back out of
// its own margin. Written as a literal it is a second copy of a number
// declared somewhere else, and the two silently disagreed: main halves
// its gutter at phone width and the rail's -1rem did not, so the rail
// hung 8px past the screen on exactly the screens it was written for.
//
// The fix is that there is one number. This guard keeps it that way.
func TestFullBleedUsesTheGutterVariable(t *testing.T) {
if !strings.Contains(sheetLiteral, "--gutter:") {
t.Fatal("FAIL: the sheet declares no --gutter to bleed against")
}
lit := regexp.MustCompile(`margin(-left|-right)?: *0? *-(0\.5|1)rem`)
if m := lit.FindString(sheetLiteral); m != "" {
t.Errorf("FAIL: %q is a hand-copied gutter; write calc(-1 * var(--gutter))", m)
} else {
t.Log("ok: no hand-copied gutter in a full-bleed margin")
}
}