MCPcopy
hub / github.com/tdewolff/minify / TestCSS2

Function TestCSS2

css/css_test.go:449–474  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

447}
448
449func TestCSS2(t *testing.T) {
450 tests := []struct {
451 css string
452 expected string
453 }{
454 {`margin:5000`, `margin:5000`},
455 {`margin:5000%`, `margin:5000%`},
456 {`margin:5000em`, `margin:5000em`},
457 {`color:transparent`, `color:transparent`},
458 {`background-color:transparent`, `background-color:transparent`},
459 //{`background-color:black!important`, `background-color:#000!important`}, // TODO: fails! may make result bigger
460 {`background-color:black !important`, `background-color:#000 !important`},
461 }
462
463 m := minify.New()
464 params := map[string]string{"inline": "1"}
465 cssMinifier := &Minifier{Version: 2}
466 for _, tt := range tests {
467 t.Run(tt.css, func(t *testing.T) {
468 r := bytes.NewBufferString(tt.css)
469 w := &bytes.Buffer{}
470 err := cssMinifier.Minify(m, w, r, params)
471 test.Minify(t, tt.css, err, w.String(), tt.expected)
472 })
473 }
474}
475
476func TestReaderErrors(t *testing.T) {
477 r := test.NewErrorReader(0)

Callers

nothing calls this directly

Calls 4

MinifyMethod · 0.95
RunMethod · 0.80
MinifyMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…