diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-02-06 18:28:26 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-02-06 18:28:26 +0100 |
commit | dd1db334ac15f3bdb67b40973668d1d7b9ca7f08 (patch) | |
tree | 2bf53f06577643217670c5bc4cb08f2776371c50 /transform/livereloadinject_test.go | |
parent | 96e990456b65c7744819000f67f226c34d487d99 (diff) |
transform: Add missing test case in livereloadinject
* Test for both </body> and </BODY>
* This also cosmetically changes the behaviour, as the case of the end body tag is kept.
Diffstat (limited to 'transform/livereloadinject_test.go')
-rw-r--r-- | transform/livereloadinject_test.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/transform/livereloadinject_test.go b/transform/livereloadinject_test.go index 0c47cb109..5aea8689c 100644 --- a/transform/livereloadinject_test.go +++ b/transform/livereloadinject_test.go @@ -15,18 +15,24 @@ package transform import ( "bytes" + "fmt" "github.com/spf13/hugo/helpers" "testing" ) func TestLiveReloadInject(t *testing.T) { + doTestLiveReloadInject(t, "</body>") + doTestLiveReloadInject(t, "</BODY>") +} + +func doTestLiveReloadInject(t *testing.T, bodyEndTag string) { out := new(bytes.Buffer) - in := helpers.StringToReader("</body>") + in := helpers.StringToReader(bodyEndTag) tr := NewChain(LiveReloadInject) tr.Apply(out, in, []byte("path")) - expected := `<script data-no-instant>document.write('<script src="/livereload.js?mindelay=10"></' + 'script>')</script></body>` + expected := fmt.Sprintf(`<script data-no-instant>document.write('<script src="/livereload.js?mindelay=10"></' + 'script>')</script>%s`, bodyEndTag) if string(out.Bytes()) != expected { t.Errorf("Expected %s got %s", expected, string(out.Bytes())) } |