File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,13 +34,21 @@ See COPYRIGHT and LICENSE files for more details.
3434 test_selector: "op-header-project-select--list" }
3535 )
3636 ) do |tree| %>
37- <% @tree.each do |node| %>
38- <%= render Header::Projects::NodeComponent.new(
39- component: tree,
40- node:,
41- current_project_id: @current_project_id,
42- favorited_ids: @favorited_ids,
43- jump: @jump
44- ) %>
37+ <% if @tree.empty? && params[:filter_mode] == "favorited" && params[:query].blank? %>
38+ <% tree.with_leaf(
39+ label: t("header.project_select_component.no_favorite_projects"),
40+ disabled: true,
41+ data: { test_selector: "op-header-project-select--no-favourites" }
42+ ) %>
43+ <% else %>
44+ <% @tree.each do |node| %>
45+ <%= render Header::Projects::NodeComponent.new(
46+ component: tree,
47+ node:,
48+ current_project_id: @current_project_id,
49+ favorited_ids: @favorited_ids,
50+ jump: @jump
51+ ) %>
52+ <% end %>
4553 <% end %>
4654<% end %>
Original file line number Diff line number Diff line change @@ -3608,6 +3608,7 @@ en:
36083608 all_projects : " All projects"
36093609 favorites : " Favorites"
36103610 leave_project : " Leave project"
3611+ no_favorite_projects : " You have no favorite projects."
36113612 title : " Projects"
36123613
36133614 toggle_switch :
Original file line number Diff line number Diff line change 3838 end
3939
4040 describe "#index" do
41+ render_views
4142 shared_let ( :parent_project ) { create ( :project , name : "Alpha Parent" ) }
4243 shared_let ( :child_project ) { create ( :project , name : "Beta Child" , parent : parent_project ) }
4344 shared_let ( :other_project ) { create ( :project , name : "Gamma Other" ) }
117118 make_request
118119 expect ( assigns ( :projects ) ) . to be_empty
119120 end
121+
122+ it "renders the no-favourites placeholder" do
123+ make_request
124+ expect ( response . body ) . to include ( "op-header-project-select--no-favourites" )
125+ end
126+
127+ context "when a query is present" do
128+ subject ( :make_request ) { get :index , params : { filter_mode : "favorited" , query : "Alpha" } }
129+
130+ it "does not render the no-favourites placeholder" do
131+ make_request
132+ expect ( response . body ) . not_to include ( "op-header-project-select--no-favourites" )
133+ end
134+ end
120135 end
121136
122137 context "when the user is anonymous" do
You can’t perform that action at this time.
0 commit comments