module MercurySelectorsHelpers
Public Instance Methods
mercury_selector_for(locator)
click to toggle source
# File lib/mercury/cucumber/support/mercury_selectors.rb, line 3 def mercury_selector_for(locator) case locator # toolbar selectors when 'the toolbar' then '.mercury-toolbar-container' when /^the "(.*?)" button$/ ".mercury-primary-toolbar .mercury-#{mercury_button_mapping_for($1)}-button" when /^the (.*?) editor (button|dropdown|palette)$/ ".mercury-editable-toolbar .mercury-#{mercury_button_mapping_for($1)}-button" when /^the (.*?) toolbar button$/ ".mercury-snippet-toolbar .mercury-#{mercury_button_mapping_for($1)}-button" when /^the (.*?) select$/ ".mercury-#{mercury_button_mapping_for($1)}-select" when /^the (.*?) palette$/ ".mercury-#{mercury_button_mapping_for($1)}-palette" # palette / select dropdown when 'the color red' then '.mercury-palette .picker:nth-child(22n)' when 'the red style' then '.mercury-select-options .red' when 'the heading 2 block' then '.mercury-select-options h2' # statusbar selectors when 'the statusbar' then '.mercury-statusbar' when 'the about the editor link' then 'a.mercury-statusbar-about' # panel selectors when 'the panel', /^the (.*?) panel$/ then '.mercury-panel' # modal window selectors when 'the modal', 'the modal window', /^the (.*?) modal$/ then '.mercury-modal' when 'the modal overlay' then '.mercury-modal-overlay' when 'the modal title' then '.mercury-modal h1.mercury-modal-title' when 'the modal close button' then '.mercury-modal h1.mercury-modal-title a' when 'the sweet snowman' then '.mercury-modal .character:nth-child(247n)' when 'the first cell in the first row' then '.mercury-modal tr:nth-child(1n) td:nth-child(1n)' when 'the third cell in the first row' then '.mercury-modal tr:nth-child(1n) td:nth-child(3n)' when 'the forth cell in the first row' then '.mercury-modal tr:nth-child(1n) td:nth-child(4n)' when 'the second cell in the second row' then '.mercury-modal tr:nth-child(2n) td:nth-child(2n)' when 'the forth cell in the second row' then '.mercury-modal tr:nth-child(2n) td:nth-child(4n)' when 'a selected cell' then '.mercury-modal td.selected' # lightview selectors when 'the lightview', 'the lightview window', /^the (.*?) lightview$/ then '.mercury-lightview' when 'the lightview overlay' then '.mercury-lightview-overlay' when 'the lightview title' then '.mercury-lightview h1.mercury-lightview-title' when 'the lightview close button' then '.mercury-lightview h1.mercury-lightview-title a' # snippet selectors when 'the snippet toolbar' then '.mercury-snippet-toolbar' when 'the snippet', 'that snippet' then "div[data-snippet=#{@snippet_id || 'snippet_42'}]" # other selectors when 'the first image' then 'img:nth-child(1n)' end end