Skip to content

Commit

Permalink
Add train number (#2162)
Browse files Browse the repository at this point in the history
* add train number

* tests

* change language for CR
  • Loading branch information
anthonyshull authored Aug 27, 2024
1 parent 18a57eb commit c913db9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 9 additions & 1 deletion lib/dotcom_web/templates/trip_plan/_leg_summary.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
<%= "(#{@intermediate_stop_count} #{Inflex.inflect("Stop", @intermediate_stop_count)}, #{@itinerary_row.duration} min)" %>
<%= if @itinerary_row.trip do %>
<div class="fs-14">
<%= Routes.Route.direction_name(@route, @itinerary_row.trip.direction_id) %>
<%= if @itinerary_row.trip.name && @itinerary_row.trip.name != "" do %>
Train <%= @itinerary_row.trip.name %> <%= Routes.Route.direction_name(
@route,
@itinerary_row.trip.direction_id
)
|> String.downcase() %>
<% else %>
<%= Routes.Route.direction_name(@route, @itinerary_row.trip.direction_id) %>
<% end %>
<%= if @itinerary_row.trip.headsign && @itinerary_row.trip.headsign != "" do %>
towards <%= @itinerary_row.trip.headsign %>
<% end %>
Expand Down
20 changes: 16 additions & 4 deletions test/dotcom_web/views/trip_plan_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,10 @@ closest arrival to 12:00 AM, Thursday, January 1st."
vehicle_tooltip: nil,
expanded: nil,
conn: %{query_params: %{}, request_path: ""},
itinerary_row: %{duration: 2, trip: %{headsign: nil, direction_id: 0}}
itinerary_row: %{
duration: 2,
trip: %{headsign: nil, direction_id: 0, name: Faker.Name.name()}
}
}

rendered =
Expand All @@ -1739,7 +1742,10 @@ closest arrival to 12:00 AM, Thursday, January 1st."
vehicle_tooltip: nil,
expanded: nil,
conn: %{query_params: %{}, request_path: ""},
itinerary_row: %{duration: 2, trip: %{headsign: nil, direction_id: 0}}
itinerary_row: %{
duration: 2,
trip: %{headsign: nil, direction_id: 0, name: Faker.Name.name()}
}
}

rendered =
Expand All @@ -1761,7 +1767,10 @@ closest arrival to 12:00 AM, Thursday, January 1st."
vehicle_tooltip: nil,
expanded: nil,
conn: %{query_params: %{}, request_path: ""},
itinerary_row: %{duration: 2, trip: %{headsign: nil, direction_id: 0}}
itinerary_row: %{
duration: 2,
trip: %{headsign: nil, direction_id: 0, name: Faker.Name.name()}
}
}

rendered =
Expand All @@ -1783,7 +1792,10 @@ closest arrival to 12:00 AM, Thursday, January 1st."
vehicle_tooltip: nil,
expanded: true,
conn: %{query_params: %{}, request_path: ""},
itinerary_row: %{duration: 2, trip: %{headsign: nil, direction_id: 0}}
itinerary_row: %{
duration: 2,
trip: %{headsign: nil, direction_id: 0, name: Faker.Name.name()}
}
}

rendered =
Expand Down

0 comments on commit c913db9

Please sign in to comment.