testconversions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package testconversions provides functions to to create arbitrary values of package safehtml types for use by tests only. Note that the created values may violate type contracts.

These functions are useful when types are constructed in a manner where using the package safehtml API is too inconvenient. Please use the package safehtml API whenever possible; there is value in having tests reflect common usage. Using the package safehtml API also avoids, by design, non-contract complying instances from being created.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHTMLForTest

func MakeHTMLForTest(s string) safehtml.HTML

MakeHTMLForTest converts a plain string into a HTML. This function must only be used in tests.

func MakeIdentifierForTest

func MakeIdentifierForTest(s string) safehtml.Identifier

MakeIdentifierForTest converts a plain string into an Identifier. This function must only be used in tests.

func MakeScriptForTest

func MakeScriptForTest(s string) safehtml.Script

MakeScriptForTest converts a plain string into a Script. This function must only be used in tests.

func MakeStyleForTest

func MakeStyleForTest(s string) safehtml.Style

MakeStyleForTest converts a plain string into a Style. This function must only be used in tests.

func MakeStyleSheetForTest

func MakeStyleSheetForTest(s string) safehtml.StyleSheet

MakeStyleSheetForTest converts a plain string into a StyleSheet. This function must only be used in tests.

func MakeTrustedResourceURLForTest

func MakeTrustedResourceURLForTest(s string) safehtml.TrustedResourceURL

MakeTrustedResourceURLForTest converts a plain string into a TrustedResourceURL. This function must only be used in tests.

func MakeURLForTest

func MakeURLForTest(s string) safehtml.URL

MakeURLForTest converts a plain string into a URL. This function must only be used in tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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