Module: A11y::Lint::BlockInspection

Included in:
ErbOutputNode, PhlexNode, SlimNode
Defined in:
lib/a11y/lint/block_inspection.rb

Overview

Shared block-content queries for node types. Depends on the host class implementing #block_has_text_children? and #block_body_codes.

Constant Summary collapse

ICON_HELPERS =
%w[inline_svg icon svg_icon].freeze

Instance Method Summary collapse

Instance Method Details

#block_has_only_icon_helpers?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
# File 'lib/a11y/lint/block_inspection.rb', line 11

def block_has_only_icon_helpers?
  return false if block_has_text_children?

  codes = block_body_codes
  return true unless codes&.any?

  codes.all? do |code|
    icon_helper?(code) || decorative_image_tag?(code)
  end
end