summaryrefslogtreecommitdiffstats
path: root/integrations/html_helper.go
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2017-06-17 11:29:59 -0500
committerGitHub <noreply@github.com>2017-06-17 11:29:59 -0500
commit90f9bb12c628a167d30f6f8b4bfb80438fb675a7 (patch)
tree8fc223551e3aa7f10db924661a448b7623e3d124 /integrations/html_helper.go
parent6233e88f7f89b15d91f8047ccc4b2ad300170ec7 (diff)
downloadgitea-90f9bb12c628a167d30f6f8b4bfb80438fb675a7.tar.gz
gitea-90f9bb12c628a167d30f6f8b4bfb80438fb675a7.zip
fix golint error and rename func for suggestion. (#1997)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Diffstat (limited to 'integrations/html_helper.go')
-rw-r--r--integrations/html_helper.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/integrations/html_helper.go b/integrations/html_helper.go
index 6339b2da94..43e75db30d 100644
--- a/integrations/html_helper.go
+++ b/integrations/html_helper.go
@@ -12,26 +12,31 @@ import (
"github.com/stretchr/testify/assert"
)
-type HtmlDoc struct {
+// HTMLDoc struct
+type HTMLDoc struct {
doc *goquery.Document
}
-func NewHtmlParser(t testing.TB, content []byte) *HtmlDoc {
+// NewHTMLParser parse html file
+func NewHTMLParser(t testing.TB, content []byte) *HTMLDoc {
doc, err := goquery.NewDocumentFromReader(bytes.NewReader(content))
assert.NoError(t, err)
- return &HtmlDoc{doc: doc}
+ return &HTMLDoc{doc: doc}
}
-func (doc *HtmlDoc) GetInputValueById(id string) string {
+// GetInputValueByID for get input value by id
+func (doc *HTMLDoc) GetInputValueByID(id string) string {
text, _ := doc.doc.Find("#" + id).Attr("value")
return text
}
-func (doc *HtmlDoc) GetInputValueByName(name string) string {
+// GetInputValueByName for get input value by name
+func (doc *HTMLDoc) GetInputValueByName(name string) string {
text, _ := doc.doc.Find("input[name=\"" + name + "\"]").Attr("value")
return text
}
-func (doc *HtmlDoc) GetCSRF() string {
+// GetCSRF for get CSRC token value from input
+func (doc *HTMLDoc) GetCSRF() string {
return doc.GetInputValueByName("_csrf")
}