Jenkins没有注意到我的测试用例是在Polymer中运行的,我不太确定如何生成正确的JUnit文件.使用web-component-tester,如何生成JUnit格式的测试输出?
我的问题如标题所述.我想做的事情如下:
{{range $index, $element := .Products}}
{{if $index % 4 == 0}}<div class="row">{{end}}
<div class="columns small-3 product">
<img src="/img/{{.ImageUrl}}" alt="{{.ImageUrl}}" />
<a href="/product">
<h3>{{.Title}}</h3>
</a>
<p>
{{.Description}}
</p>
<p>
{{.Price}} / liter
</p>
</div>
{{if index % 4 == 0}}</div>{{end}}
{{end}}
Run Code Online (Sandbox Code Playgroud)
我收到错误:
template: products.html:9: unexpected "%" in operand
是否有另一种方法可以在模板中进行模数?
我环顾四周,没有发现任何具体的东西.我正在使用Go的标准库构建API.在提供我的资源文件时,我的CSS文件会像text/plain
我想要发送一样发送text/css
.
控制台向我发出一条信息消息说:
Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://localhost:3000/css/app.css".
main.go
package main
import (
"bufio"
"log"
"net/http"
"os"
"strings"
"text/template"
)
func main() {
templates := populateTemplates()
http.HandleFunc("/",
func(w http.ResponseWriter, req *http.Request) {
requestedFile := req.URL.Path[1:]
template := templates.Lookup(requestedFile + ".html")
if template != nil {
template.Execute(w, nil)
} else {
w.WriteHeader(404)
}
})
http.HandleFunc("/img/", serveResource)
http.HandleFunc("/css/", serveResource)
log.Fatal(http.ListenAndServe(":3000", nil))
}
func serveResource(w http.ResponseWriter, req *http.Request) {
path := "public" + req.URL.Path …
Run Code Online (Sandbox Code Playgroud)