Module: PageRight::CssHelper

Defined in:
lib/page_right/css_helper.rb

Instance Method Summary collapse

Instance Method Details

#is_css_in_page?(css, flag = true) ⇒ Boolean

Check that a css element is on the page, set flag to check that it isn’t

Returns:

  • (Boolean)


4
5
6
7
8
9
10
# File 'lib/page_right/css_helper.rb', line 4

def is_css_in_page?(css, flag=true)
  if flag
    assert page.has_css?("#{css}"), "Error: #{css} not found on page !"
  else
    assert !page.has_css?("#{css}"), "Error: #{css} found on page !"
  end
end

#is_css_in_section?(css1, css2, flag = true) ⇒ Boolean

Check that a css element is nested within another css element, set flag to check that it isn’t

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
# File 'lib/page_right/css_helper.rb', line 13

def is_css_in_section?(css1, css2, flag=true)
  within("#{css1}") do
    if flag
      assert page.has_css?("#{css2}"), "Error: #{css2} not found in #{css1} !"
    else
      assert !page.has_css?("#{css2}"), "Error: #{css2} found in #{css1} !"
    end
  end
end