Documentation
¶
Overview ¶
Package axe provides accessibility testing using axe-core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
HTML string `json:"html"`
Target []string `json:"target"`
FailureSummary string `json:"failureSummary,omitempty"`
Impact Impact `json:"impact,omitempty"`
}
Node represents a DOM element that violated or passed a rule.
type Options ¶
type Options struct {
// Standard is the WCAG standard to check against.
Standard Standard
// IncludeSelector limits checking to elements matching this selector.
IncludeSelector string
// ExcludeSelector excludes elements matching this selector.
ExcludeSelector string
// Rules specifies which rules to run.
Rules []string
// DisabledRules specifies rules to skip.
DisabledRules []string
// FailOn specifies which impact levels cause failure.
// Default is "serious" (fails on critical and serious).
FailOn Impact
}
Options configures accessibility checking.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns sensible defaults for WCAG 2.2 AA.
type Result ¶
type Result struct {
Violations []Violation `json:"violations"`
Passes []RuleResult `json:"passes"`
Incomplete []RuleResult `json:"incomplete"`
Inapplicable []RuleResult `json:"inapplicable"`
URL string `json:"url"`
Timestamp string `json:"timestamp"`
TestEngine TestEngine `json:"testEngine"`
TestRunner TestRunner `json:"testRunner"`
TestEnvironment TestEnvironment `json:"testEnvironment"`
}
Result contains the accessibility check results.
func (*Result) FilterViolations ¶
FilterViolations returns violations at or above the specified impact level.
func (*Result) HasFailures ¶
HasFailures checks if the result has violations at or above the specified impact level.
func (*Result) SaveReport ¶
SaveReport saves the full results to a JSON file.
type RuleResult ¶
type RuleResult struct {
ID string `json:"id"`
Impact Impact `json:"impact,omitempty"`
Tags []string `json:"tags"`
Description string `json:"description"`
Help string `json:"help"`
HelpURL string `json:"helpUrl"`
Nodes []Node `json:"nodes"`
}
RuleResult represents an axe-core rule result (for passes, incomplete, inapplicable).
type TestEngine ¶
TestEngine contains axe-core version info.
type TestEnvironment ¶
type TestEnvironment struct {
UserAgent string `json:"userAgent"`
WindowWidth int `json:"windowWidth"`
WindowHeight int `json:"windowHeight"`
}
TestEnvironment contains browser info.
type TestRunner ¶
type TestRunner struct {
Name string `json:"name"`
}
TestRunner contains runner info.