Module: A11y::Lint::BlockInspection

Included in:
ErbNode, 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 image_tag 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
# 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? { |code| icon_helper_call?(code) }
end