Skip to content

Commit 5d38ce8

Browse files
committed
spec: tweak fj cop wording, add better comments to methods
Change-Id: I1121976674f2ed45a9838f1a8533731765844d2d Reviewed-on: https://gerrit.instructure.com/78303 Tested-by: Jenkins Reviewed-by: Landon Wilkins <lwilkins@instructure.com> Product-Review: Landon Wilkins <lwilkins@instructure.com> QA-Review: Landon Wilkins <lwilkins@instructure.com>
1 parent f2ac48d commit 5d38ce8

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

gems/rubocop-canvas/lib/rubocop_canvas/cops/specs/prefer_f_over_fj.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ def error_msg(method)
2828
alternative = SUSPECT_METHOD_NAMES[method]
2929
"Prefer `#{alternative}` instead of `#{method}`; `#{method}`"\
3030
" should only be used if you are doing jquery-fake-css selectors"\
31-
" (e.g. `:visible`). Unlike `#{alternative}`, `#{method}`"\
32-
" will not wait for the element to appear in the DOM,"\
33-
" often contributing to flickering failures."
31+
" (e.g. `:visible`)"
3432
end
3533

3634
def autocorrect(node)

spec/selenium/test_setup/common_helper_methods/custom_selenium_actions.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ def find_radio_button_by_value(value, scope = nil)
3232
fj("input[type=radio][value=#{value}]", scope)
3333
end
3434

35-
# f means "find" this is a shortcut to finding elements
35+
# find an element via css selector
36+
#
37+
# like other selenium methods, this will wait until it finds the
38+
# element on the page
3639
def f(selector, scope = nil)
3740
raise 'need to do a get to use find' unless @click_ready
3841
begin
@@ -52,7 +55,13 @@ def fln(link_text, scope = nil)
5255
end
5356
end
5457

55-
# short for find with jquery
58+
# find an element via fake-jquery-css selector
59+
#
60+
# useful for fake-jquery-css like `:visible`. if you're using
61+
# vanilla css, prefer `f` over `fj`.
62+
#
63+
# like other selenium methods, this will wait until it finds the
64+
# element on the page
5665
def fj(selector, scope = nil)
5766
raise 'need to do a get to use find' unless @click_ready
5867
begin

0 commit comments

Comments
 (0)