@@ -4,18 +4,13 @@ import (
4
4
"strings"
5
5
"testing"
6
6
7
- . "github.com/onsi/ginkgo/v2"
8
- . "github.com/onsi/gomega"
9
7
"github.com/stretchr/testify/suite"
10
8
11
9
"github.com/gost-dom/browser/dom"
12
- "github.com/gost-dom/browser/dom/event"
13
- "github.com/gost-dom/browser/html"
14
10
. "github.com/gost-dom/browser/html"
15
- "github.com/gost-dom/browser/internal/domslices "
11
+ . "github.com/gost-dom/browser/internal/testing/gomega-matchers "
16
12
"github.com/gost-dom/browser/internal/testing/gosttest"
17
13
. "github.com/gost-dom/browser/testing/gomega-matchers"
18
- "github.com/gost-dom/browser/testing/testservers"
19
14
)
20
15
21
16
type WindowTestSuite struct {
@@ -37,75 +32,3 @@ func (s *WindowTestSuite) TestDocumentWithDOCTYPE() {
37
32
func TestWindow (t * testing.T ) {
38
33
suite .Run (t , new (WindowTestSuite ))
39
34
}
40
-
41
- var _ = Describe ("Window" , func () {
42
- Describe ("Location()" , func () {
43
- var window Window
44
-
45
- BeforeEach (func () {
46
- server := testservers .NewAnchorTagNavigationServer ()
47
- DeferCleanup (func () { server = nil })
48
- window = NewWindowFromHandler (server )
49
- })
50
-
51
- It ("Should be about:blank" , func () {
52
- Expect (window .Location ().Href ()).To (Equal ("about:blank" ))
53
- })
54
-
55
- It ("Should return the path loaded from" , func () {
56
- Expect (window .Navigate ("/index" )).To (Succeed ())
57
- Expect (window .Location ().Pathname ()).To (Equal ("/index" ))
58
- })
59
-
60
- Describe ("Navigate" , func () {
61
- It ("Should load a blank page when loading about:blank" , func () {
62
- Expect (window .Navigate ("about:blank" )).To (Succeed ())
63
- Expect (window .Document ()).To (HaveH1 ("Gost-DOM" ))
64
- })
65
-
66
- It ("Should clear event handlers" , func () {
67
- count := 0
68
- Expect (window .Navigate ("about:blank" )).To (Succeed ())
69
- window .AddEventListener (
70
- "gost-event" ,
71
- event .NewEventHandlerFunc (func (e * event.Event ) error {
72
- count ++
73
- return nil
74
- }))
75
-
76
- Expect (window .Navigate ("/index" )).To (Succeed ())
77
- window .DispatchEvent (event .New ("gost-event" , nil ))
78
- Expect (count ).To (Equal (0 ))
79
- })
80
- })
81
-
82
- Describe ("User navigation (clicking links)" , func () {
83
- var links []dom.Node
84
-
85
- BeforeEach (func () {
86
- Expect (window .Navigate ("/index" )).To (Succeed ())
87
- nodes , err := window .Document ().QuerySelectorAll ("a" )
88
- Expect (err ).ToNot (HaveOccurred ())
89
- links = nodes .All ()
90
- })
91
-
92
- It ("Should update when using a link with absolute url" , func () {
93
- link , ok := domslices .SliceFindFunc (links , func (n dom.Node ) bool {
94
- return n .TextContent () == "Products from absolute url"
95
- })
96
- Expect (ok ).To (BeTrue ())
97
- link .(html.HTMLElement ).Click ()
98
- Expect (window .Location ().Pathname ()).To (Equal ("/products" ))
99
- })
100
-
101
- It ("Should update when using a link with relative url" , func () {
102
- link , ok := domslices .SliceFindFunc (links , func (n dom.Node ) bool {
103
- return n .TextContent () == "Products from relative url"
104
- })
105
- Expect (ok ).To (BeTrue ())
106
- link .(html.HTMLElement ).Click ()
107
- Expect (window .Location ().Pathname ()).To (Equal ("/products" ))
108
- })
109
- })
110
- })
111
- })
0 commit comments