Class: CustomElementTest

CustomElementTest()

The class that implements a test case. Typically, an instance of this is created for you and you call test on that to write your test case.

Constructor

new CustomElementTest()

Source:

Methods

andQueryString()

Configure a query string to be present when the custom elements are defined and connected.

Source:

onFetch(url, behavior)

Configure behavior when #{link external:fetch} is called, since it's not implemented by JSDom or NodeJS.

Parameters:
Name Type Description
url String

the URL that is expected. This should be a relative URL, as that is all that is currently supported. This URL must match exactly to a fetch call.

behavior Object

an object describing what you want to happen when url is fetched. This currently supports only a few rudimentary behaviors:

  • {then: { ok: { text: "some text" } } } - This will return an "ok" response whose body is the given text, available only as text.
  • {then: { status: XXX, text: "some text" }} - This will return the given http status, with ok as true if it's 2xx or 3xx. If text is given, that will be available as text only.
Source:

test(description, testCode)

Declare a test to run with the previously-defined HTML, query string, and fetch behavior.

Parameters:
Name Type Description
description String

a description of the test.

testCode testCodeCallback

a function containing the code for your test.

Source:

xtest()

Comment out a test without using code comments

Source: