| 312 | } |
| 313 | |
| 314 | func TestHTMLKeepQuotes(t *testing.T) { |
| 315 | htmlTests := []struct { |
| 316 | html string |
| 317 | expected string |
| 318 | }{ |
| 319 | {`<p attr="test">`, `<p attr="test">`}, |
| 320 | {`<p attr='test'>`, `<p attr='test'>`}, |
| 321 | {`<p attr=test>`, `<p attr=test>`}, |
| 322 | {`<meta name='viewport' content='width=device-width, initial-scale=1'>`, `<meta name='viewport' content='width=device-width,initial-scale=1'>`}, |
| 323 | } |
| 324 | |
| 325 | m := minify.New() |
| 326 | htmlMinifier := &Minifier{KeepQuotes: true} |
| 327 | for _, tt := range htmlTests { |
| 328 | t.Run(tt.html, func(t *testing.T) { |
| 329 | r := bytes.NewBufferString(tt.html) |
| 330 | w := &bytes.Buffer{} |
| 331 | err := htmlMinifier.Minify(m, w, r, nil) |
| 332 | test.Minify(t, tt.html, err, w.String(), tt.expected) |
| 333 | }) |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | func TestHTMLURL(t *testing.T) { |
| 338 | htmlTests := []struct { |