File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ const filterStories = () => {
105105 const storyTitle = element
106106 . querySelector ( "td:first-child" )
107107 . innerText . toLowerCase ( ) ;
108- if ( storyTitle . includes ( searchTerm ) ) {
108+ if ( storyTitle . includes ( searchTerm ) || element . id . replace ( / \D / g , '' ) . includes ( searchTerm ) ) {
109109 cl . remove ( "hidden" ) ;
110110 } else {
111111 cl . add ( "hidden" ) ;
Original file line number Diff line number Diff line change 33 < h1 class ="dashboard-title "> <%= render partial : "shared/project_title" , locals : { allow_edit : true , project : @project } %> </ h1 >
44
55 < div class ="search-field ">
6- <%= label_tag 'title_contains' , "Filter by title" %>
6+ <%= label_tag 'title_contains' , "Filter by title or ID " %>
77 <%= search_field_tag 'title_contains' , nil , onkeyup : "filterStories()" %>
88 </ div >
99 </ div >
2828 < tr class ="project-table__row project-table__row--story " id ="<%= dom_id ( story ) %> " >
2929 < td class ="project-table__cell ">
3030 < input type ="checkbox " name ="stories[] " value ="<%= story . id %> ">
31- <%= link_to story . title , [ story . project , story ] %>
31+ <%= link_to " #{ story . id } - #{ story . title } " , [ story . project , story ] %>
3232 < button class ="copy-link btn-clipboard " data-clipboard-text ="<%= project_story_url ( @project , story ) %> " title ='Copy story '> < i class ="fa fa-link "> </ i > < span class = "popup "> Copied to clipboard</ span > </ button >
3333 </ td >
3434 < td class ="project-table__cell "> <%= story . estimate_for ( current_user ) &.best_case_points %> </ td >
Original file line number Diff line number Diff line change 318318
319319 expect ( page ) . not_to have_selector ( ".project-table.sorting" )
320320 end
321+
322+ it "filter stories by title or ID" , js : true do
323+ story4 = FactoryBot . create ( :story , project : project , title : "Deprecation warning XYZ" )
324+ story5 = FactoryBot . create ( :story , project : project , title : "Dangerous query method" )
325+
326+ visit project_path ( id : project . id )
327+
328+ fill_in "title_contains" , with : "XYZ"
329+
330+ within ( "#stories" ) do
331+ expect ( find ( "td:nth-child(1)" ) ) . to have_text story4 . title
332+ expect ( all ( "#stories > tr" ) . count ) . to eq ( 1 )
333+ end
334+
335+ fill_in "title_contains" , with : story5 . id
336+
337+ within ( "#stories" ) do
338+ expect ( find ( "td:nth-child(1)" ) ) . to have_text story5 . title
339+ expect ( all ( "#stories > tr" ) . count ) . to eq ( 1 )
340+ end
341+ end
321342end
You can’t perform that action at this time.
0 commit comments