module Capybara::Node::WhitespaceNormalizer

def normalize_spacing(text)

Returns:
  • (String) -

Parameters:
  • text (String) --
def normalize_spacing(text)
  text
    .delete(REMOVED_CHARACTERS)
    .tr(SQUEEZED_SPACES, ' ')
    .squeeze(' ')
    .sub(LEADING_SPACES, '')
    .sub(TRAILING_SPACES, '')
    .tr(NON_BREAKING_SPACE, ' ')
end

def normalize_visible_spacing(text)

Returns:
  • (String) -

Parameters:
  • text (String) --
def normalize_visible_spacing(text)
  text
    .squeeze(' ')
    .gsub(EMPTY_LINES, "\n")
    .sub(LEADING_SPACES, '')
    .sub(TRAILING_SPACES, '')
    .tr(NON_BREAKING_SPACE, ' ')
end