Commit cc5be765 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch...

Merge branch '290709-profile-dropdown-still-says-edit-status-after-clearing-user-status' into 'master'

Profile dropdown still says "edit status" after clearing user status

See merge request gitlab-org/gitlab!49203
parents d5edc1b6 90f5e3a2
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
- if can?(current_user, :update_user_status, current_user) - if can?(current_user, :update_user_status, current_user)
%li %li
%button.btn.menu-item.js-set-status-modal-trigger{ type: 'button' } %button.btn.menu-item.js-set-status-modal-trigger{ type: 'button' }
- if current_user.status.present? - if show_status_emoji?(current_user.status) || user_status_set_to_busy?(current_user.status)
= s_('SetStatusModal|Edit status') = s_('SetStatusModal|Edit status')
- else - else
= s_('SetStatusModal|Set status') = s_('SetStatusModal|Set status')
......
---
title: Check for a status in the current user dropdown
merge_request: 49203
author:
type: fixed
...@@ -228,7 +228,7 @@ RSpec.describe 'User edit profile' do ...@@ -228,7 +228,7 @@ RSpec.describe 'User edit profile' do
end end
def open_edit_status_modal def open_edit_status_modal
open_modal 'Edit status' open_modal 'Edit status'
end end
def set_user_status_in_modal def set_user_status_in_modal
...@@ -291,6 +291,10 @@ RSpec.describe 'User edit profile' do ...@@ -291,6 +291,10 @@ RSpec.describe 'User edit profile' do
toggle_busy_status toggle_busy_status
set_user_status_in_modal set_user_status_in_modal
wait_for_requests
visit root_path(user)
open_edit_status_modal open_edit_status_modal
expect(busy_status.checked?).to eq(true) expect(busy_status.checked?).to eq(true)
...@@ -368,26 +372,37 @@ RSpec.describe 'User edit profile' do ...@@ -368,26 +372,37 @@ RSpec.describe 'User edit profile' do
expect(page).not_to have_selector '.cover-status' expect(page).not_to have_selector '.cover-status'
end end
it 'clears the user status with the "Remove status" button' do context 'Remove status button' do
user_status = create(:user_status, user: user, message: 'Eating bread', emoji: 'stuffed_flatbread') before do
user.status = UserStatus.new(message: 'Eating bread', emoji: 'stuffed_flatbread')
visit_user visit_user
wait_for_requests wait_for_requests
within('.cover-status') do open_edit_status_modal
expect(page).to have_emoji(user_status.emoji)
expect(page).to have_content user_status.message page.within "#set-user-status-modal" do
click_button 'Remove status'
end
wait_for_requests
end end
open_edit_status_modal it 'clears the user status with the "Remove status" button' do
visit_user
page.within "#set-user-status-modal" do expect(page).not_to have_selector '.cover-status'
click_button 'Remove status'
end end
visit_user it 'shows the "Set status" menu item in the user menu' do
visit root_path(user)
expect(page).not_to have_selector '.cover-status' find('.header-user-dropdown-toggle').click
page.within ".header-user" do
expect(page).to have_content('Set status')
end
end
end end
it 'displays a default emoji if only message is entered' do it 'displays a default emoji if only message is entered' do
......
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