scripttests

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package scripttests contains a specification of the behaviour of client-side scripting.

The tests are written targetting an interface; allowing different script engines to use the same suite of tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunSuites

func RunSuites(t *testing.T, h ScriptHostFactory)

Types

type DocumentTestSuite added in v0.5.4

type DocumentTestSuite struct {
	ScriptHostSuite
}

func NewDocumentSuite added in v0.5.4

func NewDocumentSuite(h html.ScriptHost) *DocumentTestSuite

func (*DocumentTestSuite) TestCreateElement added in v0.5.4

func (s *DocumentTestSuite) TestCreateElement()

func (*DocumentTestSuite) TestGetElementByID added in v0.5.4

func (s *DocumentTestSuite) TestGetElementByID()

func (*DocumentTestSuite) TestNewDocument added in v0.5.4

func (s *DocumentTestSuite) TestNewDocument()

func (*DocumentTestSuite) TestPrototype added in v0.5.4

func (s *DocumentTestSuite) TestPrototype()

type EventLoopTestSuite added in v0.3.0

type EventLoopTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func NewEventLoopTestSuite added in v0.3.0

func NewEventLoopTestSuite(host html.ScriptHost) *EventLoopTestSuite

func (*EventLoopTestSuite) SetupTest added in v0.3.0

func (s *EventLoopTestSuite) SetupTest()

func (*EventLoopTestSuite) TeardownTest added in v0.3.0

func (s *EventLoopTestSuite) TeardownTest()

func (*EventLoopTestSuite) TestClearTimeout added in v0.3.0

func (s *EventLoopTestSuite) TestClearTimeout()

func (*EventLoopTestSuite) TestDeferExecution added in v0.3.0

func (s *EventLoopTestSuite) TestDeferExecution()

func (*EventLoopTestSuite) TestDispatchError added in v0.3.0

func (s *EventLoopTestSuite) TestDispatchError()

func (*EventLoopTestSuite) TestGlobals added in v0.3.0

func (s *EventLoopTestSuite) TestGlobals()

func (*EventLoopTestSuite) TestInterval added in v0.3.0

func (s *EventLoopTestSuite) TestInterval()

func (*EventLoopTestSuite) TestQueueMicrotask added in v0.6.0

func (s *EventLoopTestSuite) TestQueueMicrotask()

type EventTargetTestSuite added in v0.5.4

type EventTargetTestSuite struct {
	ScriptHostSuite
}

func NewEventTargetTestSuite added in v0.5.4

func NewEventTargetTestSuite(h html.ScriptHost) *EventTargetTestSuite

func (*EventTargetTestSuite) TestCallingEventListener added in v0.5.4

func (s *EventTargetTestSuite) TestCallingEventListener()

func (*EventTargetTestSuite) TestCancelable added in v0.5.4

func (s *EventTargetTestSuite) TestCancelable()

func (*EventTargetTestSuite) TestDOMEventBubble added in v0.5.4

func (s *EventTargetTestSuite) TestDOMEventBubble()

func (*EventTargetTestSuite) TestDOMEventBubbleNotSpecified added in v0.5.4

func (s *EventTargetTestSuite) TestDOMEventBubbleNotSpecified()

func (*EventTargetTestSuite) TestPropagateGoEventToJS added in v0.5.4

func (s *EventTargetTestSuite) TestPropagateGoEventToJS()

func (*EventTargetTestSuite) TestPrototype added in v0.5.4

func (s *EventTargetTestSuite) TestPrototype()

type LocationSuite

type LocationSuite struct {
	ScriptHostSuite
}

func NewLocationSuite

func NewLocationSuite(h html.ScriptHost) *LocationSuite

func (*LocationSuite) TestGlobalScope

func (s *LocationSuite) TestGlobalScope()

func (*LocationSuite) TestHrefEqualsDocumentLocation added in v0.3.0

func (s *LocationSuite) TestHrefEqualsDocumentLocation()

type ScriptHostFactory added in v0.7.0

type ScriptHostFactory interface{ New() html.ScriptHost }

type ScriptHostSuite

type ScriptHostSuite struct {
	gosttest.GomegaSuite

	Window htmltest.WindowHelper
	// contains filtered or unexported fields
}

func NewScriptHostSuite

func NewScriptHostSuite(h html.ScriptHost) *ScriptHostSuite

func (*ScriptHostSuite) Eval added in v0.5.7

func (s *ScriptHostSuite) Eval(script string) (any, error)

Runs a script and returns the evaluated value as a native Go value.

Panics (or generates an error?) if no suitable conversion could be found (i.e. gost doesn't implement this yet).

Returns an error if script code throws.

If the return value is not used, call run; to avoid panic/error

func (*ScriptHostSuite) MustEval added in v0.5.7

func (s *ScriptHostSuite) MustEval(script string) any

func (*ScriptHostSuite) MustLoadHTML added in v0.5.7

func (s *ScriptHostSuite) MustLoadHTML(html string)

func (*ScriptHostSuite) MustRunScript added in v0.5.7

func (s *ScriptHostSuite) MustRunScript(script string)

MustRunScript runs a script and marks the test as an error if an error occurrs.

func (*ScriptHostSuite) OpenWindow added in v0.3.0

func (s *ScriptHostSuite) OpenWindow(location string) html.Window

func (*ScriptHostSuite) RunScript added in v0.5.7

func (s *ScriptHostSuite) RunScript(script string) error

Runs a script, and discards the returned value.

Returns an error if the script code throws. Named RunScript to not shadow [Suite.Run].

func (*ScriptHostSuite) SetupTest

func (s *ScriptHostSuite) SetupTest()

func (*ScriptHostSuite) TeardownTest

func (s *ScriptHostSuite) TeardownTest()

type UIEventTestSuite added in v0.4.0

type UIEventTestSuite struct {
	ScriptHostSuite
}

func NewUIEventTestSuite added in v0.4.0

func NewUIEventTestSuite(h html.ScriptHost) *UIEventTestSuite

func (*UIEventTestSuite) TestClickEventIsAPointerEvent added in v0.4.0

func (s *UIEventTestSuite) TestClickEventIsAPointerEvent()

func (*UIEventTestSuite) TestEventInheritance added in v0.4.0

func (s *UIEventTestSuite) TestEventInheritance()

type WindowTestSuite added in v0.4.0

type WindowTestSuite struct {
	ScriptHostSuite
}

func NewWindowTestSuite added in v0.4.0

func NewWindowTestSuite(h html.ScriptHost) *WindowTestSuite

func (*WindowTestSuite) TestConstructorName added in v0.4.0

func (s *WindowTestSuite) TestConstructorName()

func (*WindowTestSuite) TestDOMContentLoaded added in v0.4.0

func (s *WindowTestSuite) TestDOMContentLoaded()

func (*WindowTestSuite) TestDocumentProperty added in v0.4.0

func (s *WindowTestSuite) TestDocumentProperty()

func (*WindowTestSuite) TestGlobalInstance added in v0.4.0

func (s *WindowTestSuite) TestGlobalInstance()

func (*WindowTestSuite) TestWindowConstructor added in v0.4.0

func (s *WindowTestSuite) TestWindowConstructor()

func (*WindowTestSuite) TestWindowInheritance added in v0.4.0

func (s *WindowTestSuite) TestWindowInheritance()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL