tracks/features/support/tracks_id_helper.rb

47 lines
1.2 KiB
Ruby
Raw Normal View History

module TracksIdHelper
def toggle_context_container_xpath(context)
"//a[@id='toggle_c#{context.id}']"
end
def toggle_project_container_xpath(project)
"//a[@id='toggle_p#{project.id}']"
end
def context_container_xpath(context)
"//div[@id='c#{context.id}']"
end
def project_container_xpath(project)
2013-04-19 20:00:32 +02:00
id = project.nil? ? "without_project_container" : "p#{project.id}"
"//div[@id='#{id}']"
end
2013-04-19 20:00:32 +02:00
def deferred_container_xpath
"//div[@id='deferred_pending_container']"
end
def todo_line_xpath(todo)
"//div[@id='line_todo_#{todo.id}']"
end
def todo_in_container_xpath(todo, container_type)
2013-04-19 20:00:32 +02:00
id = "//div[@id=\"wrong\"]"
id = context_container_xpath(todo.context) if container_type == :context
id = project_container_xpath(todo.project) if container_type == :project
return "#{id}//div[@id='line_todo_#{todo.id}']"
end
def todo_in_context_container_xpath(todo, context)
2013-04-19 20:00:32 +02:00
"#{context_container_xpath(context)}#{todo_line_xpath(todo)}"
end
def todo_in_project_container_xpath(todo, project)
2013-04-19 20:00:32 +02:00
"#{project_container_xpath(project)}#{todo_line_xpath(todo)}"
end
def todo_in_deferred_container_xpath(todo)
2013-04-19 20:00:32 +02:00
"#{deferred_container_xpath}#{todo_line_xpath(todo)}"
end
end