Class: AxeCuprite::Node
- Inherits:
-
Object
- Object
- AxeCuprite::Node
- Defined in:
- lib/axe/cuprite/results.rb
Overview
A single offending DOM node within a violation.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #all ⇒ Object
-
#any ⇒ Object
The check results that caused/contributed to the failure.
-
#contrast_data ⇒ Object
For color-contrast violations axe stores rich data under any[].data.
- #failure_summary ⇒ Object
-
#html ⇒ Object
The offending element’s outer HTML (already truncated by axe).
-
#initialize(raw) ⇒ Node
constructor
A new instance of Node.
- #none ⇒ Object
- #selector ⇒ Object
-
#target ⇒ Object
axe gives ‘target` as an array of CSS selectors (one per frame depth).
Constructor Details
#initialize(raw) ⇒ Node
Returns a new instance of Node.
90 91 92 |
# File 'lib/axe/cuprite/results.rb', line 90 def initialize(raw) @raw = raw || {} end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
88 89 90 |
# File 'lib/axe/cuprite/results.rb', line 88 def raw @raw end |
Instance Method Details
#all ⇒ Object
117 118 119 |
# File 'lib/axe/cuprite/results.rb', line 117 def all Array(@raw["all"]) end |
#any ⇒ Object
The check results that caused/contributed to the failure.
113 114 115 |
# File 'lib/axe/cuprite/results.rb', line 113 def any Array(@raw["any"]) end |
#contrast_data ⇒ Object
For color-contrast violations axe stores rich data under any[].data. Returns a ContrastData (or nil if this node has no contrast data).
127 128 129 130 131 132 |
# File 'lib/axe/cuprite/results.rb', line 127 def contrast_data check = any.find { |c| c.is_a?(Hash) && c["data"].is_a?(Hash) && c["data"].key?("contrastRatio") } return nil unless check ContrastData.new(check["data"]) end |
#failure_summary ⇒ Object
108 109 110 |
# File 'lib/axe/cuprite/results.rb', line 108 def failure_summary @raw["failureSummary"] end |
#html ⇒ Object
The offending element’s outer HTML (already truncated by axe).
104 105 106 |
# File 'lib/axe/cuprite/results.rb', line 104 def html @raw["html"] end |
#none ⇒ Object
121 122 123 |
# File 'lib/axe/cuprite/results.rb', line 121 def none Array(@raw["none"]) end |
#selector ⇒ Object
99 100 101 |
# File 'lib/axe/cuprite/results.rb', line 99 def selector target.join(" ") end |
#target ⇒ Object
axe gives ‘target` as an array of CSS selectors (one per frame depth).
95 96 97 |
# File 'lib/axe/cuprite/results.rb', line 95 def target Array(@raw["target"]) end |