Skip to content

Commit

Permalink
add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Oct 1, 2019
1 parent 1607d22 commit 90a4a7a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions spec/html-minifier_spec.cr
@@ -1,7 +1,20 @@
require "./spec_helper"

describe HtmlMinifier do
it "works" do
false.should eq(true)
it "minifies HTML" do
html = "<html> <head><title> yay</title></head><body> omg \n\n\n</body></html>"
HtmlMinifier.minify!(html).should eq "<html> <head><title> yay</title></head><body> omg </body></html>"
end

it "minifies CSS" do
html = "<html><head><style>body { background-color: black; padding-left: 10px; padding-right: 10px; }</style>\n</head></html>"
result = "<html><head><style>body{background-color:#000;padding-left:10px;padding-right:10px}</style> </head></html>"
HtmlMinifier.minify!(html).should eq result
end

it "minifies Javascript" do
html = "<html><head><script>function foo() { return 0; }</script></head></html>"
result = "<html><head><script>function foo(){return 0}</script></head></html>"
HtmlMinifier.minify!(html).should eq result
end
end

0 comments on commit 90a4a7a

Please sign in to comment.