Commit 2fb7392e authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '14547_todo-click' into 'master'

Make entire todo row clickable

Fixes #14547 

I had some issues with timeouts when searching for the selector to click on, so I ended up using `execute_script`. Please let me know if you think there's a better solution

See merge request !3456
parents fa9d140f f79687ea
......@@ -6,10 +6,12 @@ class @Todos
clearListeners: ->
$('.done-todo').off('click')
$('.js-todos-mark-all').off('click')
$('.todo').off('click')
initBtnListeners: ->
$('.done-todo').on('click', @doneClicked)
$('.js-todos-mark-all').on('click', @allDoneClicked)
$('.todo').on('click', @goToTodoUrl)
doneClicked: (e) =>
e.preventDefault()
......@@ -54,3 +56,6 @@ class @Todos
updateBadges: (data) ->
$('.todos-pending .badge, .todos-pending-count').text data.count
$('.todos-done .badge').text data.done_count
goToTodoUrl: ->
Turbolinks.visit($(this).data('url'))
......@@ -13,6 +13,12 @@
}
}
.todo {
&:hover {
cursor: pointer;
}
}
.todo-item {
.todo-title {
@include str-truncated(calc(100% - 174px));
......
%li{class: "todo todo-#{todo.done? ? 'done' : 'pending'}", id: dom_id(todo) }
%li{class: "todo todo-#{todo.done? ? 'done' : 'pending'}", id: dom_id(todo), data:{url: todo_target_path(todo)} }
.todo-item.todo-block
= image_tag avatar_icon(todo.author_email, 40), class: 'avatar s40', alt:''
......
......@@ -36,3 +36,8 @@ Feature: Dashboard Todos
Scenario: I filter by action
Given I filter by "Mentioned"
Then I should not see todos related to "Assignments" in the list
@javascript
Scenario: I click on a todo row
Given I click on the todo
Then I should be directed to the corresponding page
......@@ -88,6 +88,14 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
should_not_see_todo "John Doe assigned you issue ##{issue.iid}"
end
step 'I click on the todo' do
find('.todo:nth-child(1)').click
end
step 'I should be directed to the corresponding page' do
page.should have_css('.identifier', text: 'Merge Request !1')
end
def should_see_todo(position, title, body, pending = true)
page.within(".todo:nth-child(#{position})") do
expect(page).to have_content title
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment