2017-07-09 01:57:41 +02:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import (
|
|
|
|
"regexp"
|
|
|
|
"testing"
|
|
|
|
|
2022-01-29 20:17:23 +01:00
|
|
|
"github.com/danog/gojekyll/config"
|
|
|
|
"github.com/danog/liquid"
|
2017-07-09 01:57:41 +02:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGistTag(t *testing.T) {
|
|
|
|
engine := liquid.NewEngine()
|
2017-07-09 04:47:50 +02:00
|
|
|
plugins := []string{"jekyll-gist"}
|
2017-09-02 21:50:47 +02:00
|
|
|
_ = Install(plugins, siteFake{config.Default(), engine})
|
2017-07-09 04:47:50 +02:00
|
|
|
require.NoError(t, directory[plugins[0]].ConfigureTemplateEngine(engine))
|
2017-07-09 01:57:41 +02:00
|
|
|
|
2017-08-27 19:56:01 +02:00
|
|
|
s, err := engine.ParseAndRenderString(`{% gist parkr/931c1c8d465a04042403 %}`, liquid.Bindings{})
|
2017-07-09 01:57:41 +02:00
|
|
|
require.NoError(t, err)
|
|
|
|
re := regexp.MustCompile(`<script.*>\s*</script>`)
|
|
|
|
require.Contains(t, s, `src=https://gist.github.com/parkr/931c1c8d465a04042403.js`)
|
|
|
|
require.True(t, re.MatchString(s))
|
|
|
|
}
|