Documentation
¶
Index ¶
- func Compare(ctx context.Context, settings CompareSettings) error
- func WriteCompareArtifacts(result CompareResult, writeJSONFile bool, writeMarkdownFile bool) error
- type Bounds
- type CSSDiffResult
- type Candidate
- type CascadeOrigin
- type CompareInputs
- type CompareResult
- type CompareSettings
- type CompareSideResult
- type MatchedRule
- type MatchedSnapshot
- type MatchedStyleEntry
- type MatchedStylesResult
- type PixelDiffStats
- type RuleProperty
- type Specificity
- type StyleDiff
- type StyleResult
- type StyleSnapshot
- type Winner
- type WinnerDiff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteCompareArtifacts ¶
func WriteCompareArtifacts(result CompareResult, writeJSONFile bool, writeMarkdownFile bool) error
Types ¶
type CSSDiffResult ¶
type CSSDiffResult struct {
Styles []StyleResult `json:"styles"`
}
type Candidate ¶
type Candidate struct {
Property string
Value string
Selector string
Important bool
Specificity Specificity
Origin CascadeOrigin
Order int
}
type CascadeOrigin ¶
type CascadeOrigin string
const ( OriginInline CascadeOrigin = "inline" OriginAuthor CascadeOrigin = "author" OriginUserAgent CascadeOrigin = "user-agent" )
type CompareInputs ¶
type CompareInputs struct {
URL1 string `json:"url1"`
Selector1 string `json:"selector1"`
WaitMS1 int `json:"wait_ms1"`
URL2 string `json:"url2"`
Selector2 string `json:"selector2"`
WaitMS2 int `json:"wait_ms2"`
ViewportW int `json:"viewport_w"`
ViewportH int `json:"viewport_h"`
Props []string `json:"props"`
Attrs []string `json:"attrs"`
OutDir string `json:"out_dir"`
}
type CompareResult ¶
type CompareResult struct {
Inputs CompareInputs `json:"inputs"`
URL1 CompareSideResult `json:"url1"`
URL2 CompareSideResult `json:"url2"`
ComputedDiffs []StyleDiff `json:"computed_diffs"`
WinnerDiffs []WinnerDiff `json:"winner_diffs"`
PixelDiff PixelDiffStats `json:"pixel_diff"`
}
func GenerateCompareResult ¶
func GenerateCompareResult(ctx context.Context, settings CompareSettings) (CompareResult, error)
type CompareSettings ¶
type CompareSideResult ¶
type CompareSideResult struct {
URL string `json:"url"`
Selector string `json:"selector"`
FullScreenshot string `json:"full_screenshot"`
ElementScreenshot string `json:"element_screenshot"`
Computed StyleSnapshot `json:"computed"`
Matched MatchedSnapshot `json:"matched"`
}
type MatchedRule ¶
type MatchedRule struct {
Selector string `json:"selector"`
Origin CascadeOrigin `json:"origin"`
Specificity Specificity `json:"specificity"`
Properties []RuleProperty `json:"properties"`
}
type MatchedSnapshot ¶
type MatchedSnapshot struct {
Exists bool `json:"exists"`
Rules []MatchedRule `json:"rules"`
Computed map[string]string `json:"computed"`
Bounds *Bounds `json:"bounds,omitempty"`
}
type MatchedStyleEntry ¶
type MatchedStyleEntry struct {
Name string `json:"name"`
Selector string `json:"selector,omitempty"`
OriginalSelector string `json:"original_selector,omitempty"`
ReactSelector string `json:"react_selector,omitempty"`
Original MatchedSnapshot `json:"original"`
React MatchedSnapshot `json:"react"`
Winners []WinnerDiff `json:"winners"`
}
type MatchedStylesResult ¶
type MatchedStylesResult struct {
Styles []MatchedStyleEntry `json:"styles"`
}
type PixelDiffStats ¶
type PixelDiffStats struct {
Threshold int `json:"threshold"`
TotalPixels int `json:"total_pixels"`
ChangedPixels int `json:"changed_pixels"`
ChangedPercent float64 `json:"changed_percent"`
NormalizedWidth int `json:"normalized_width"`
NormalizedHeight int `json:"normalized_height"`
DiffComparisonPath string `json:"diff_comparison_path"`
DiffOnlyPath string `json:"diff_only_path"`
}
type RuleProperty ¶
type Specificity ¶
func (Specificity) Add ¶
func (s Specificity) Add(other Specificity) Specificity
func (Specificity) Compare ¶
func (s Specificity) Compare(other Specificity) int
func (Specificity) String ¶
func (s Specificity) String() string
type StyleResult ¶
type StyleResult struct {
Name string `json:"name"`
Selector string `json:"selector,omitempty"`
OriginalSelector string `json:"original_selector,omitempty"`
ReactSelector string `json:"react_selector,omitempty"`
Original StyleSnapshot `json:"original"`
React StyleSnapshot `json:"react"`
Diffs []StyleDiff `json:"diffs"`
}
type StyleSnapshot ¶
type StyleSnapshot = service.StyleSnapshot
type Winner ¶
type Winner struct {
Selector string `json:"selector"`
Value string `json:"value"`
Important bool `json:"important"`
Origin CascadeOrigin `json:"origin"`
Specificity Specificity `json:"specificity"`
}
type WinnerDiff ¶
Click to show internal directories.
Click to hide internal directories.