Skip to content
This repository was archived by the owner on Aug 27, 2018. It is now read-only.

Commit b8a8bbc

Browse files
authored
Merge pull request #123 from myitcv/add_div_test_with_dataset
tests: add <div> elem test with demo of DataSet
2 parents 85d79ec + f3b09ea commit b8a8bbc

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

_scripts/run_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ if [ "${CI:-}" == "true" ]
8787
then
8888
# off the back of https://github.com/myitcv/react/issues/116#issuecomment-380280847
8989
# ensure that we can go get myitcv.io/react/... in a totally clean environment
90+
echo "Verify that we can go get myitcv.io/react/..."
9091
cd `mktemp -d`
9192
export GOPATH=$PWD
9293
go get myitcv.io/react/...

div_elem_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// +build js
2+
3+
package react_test
4+
5+
import (
6+
"testing"
7+
8+
"honnef.co/go/js/dom"
9+
10+
"myitcv.io/react"
11+
"myitcv.io/react/testutils"
12+
)
13+
14+
func TestDivElem(t *testing.T) {
15+
class := "test"
16+
17+
div := react.Div(
18+
&react.DivProps{
19+
ClassName: class,
20+
DataSet: react.DataSet{
21+
"toggle": "dropdown",
22+
},
23+
},
24+
)
25+
26+
x := testutils.Wrapper(div)
27+
cont := testutils.RenderIntoDocument(x)
28+
29+
el := testutils.FindRenderedDOMComponentWithClass(cont, class)
30+
31+
if _, ok := el.(*dom.HTMLDivElement); !ok {
32+
t.Fatal("Failed to find <Div> element")
33+
}
34+
}

0 commit comments

Comments
 (0)