FIX: Ensure do-not-disturb icon updates correctly (#28253)

`currentUser.do_not_disturb_until` is a string, so we need to parse it before comparing to the current timestamp
This commit is contained in:
David Taylor
2024-08-06 19:13:13 +01:00
committed by GitHub
parent fe307ea2f0
commit 66de6a43a8
4 changed files with 24 additions and 2 deletions

View File

@@ -300,5 +300,20 @@ RSpec.describe "Glimmer Header", type: :system do
expect(page).not_to have_css("header.d-header .auth-buttons .login-button") # No header buttons
expect(page).to have_css("header.d-header .title-wrapper .topic-link") # Title is shown in header
end
it "shows and hides do-not-disturb icon" do
sign_in current_user
visit "/"
header = find(".d-header")
expect(header).not_to have_css(".do-not-disturb-background")
current_user.publish_do_not_disturb(ends_at: 1.hour.from_now)
expect(header).to have_css(".d-header .do-not-disturb-background")
current_user.publish_do_not_disturb(ends_at: 1.second.from_now)
expect(header).not_to have_css(".d-header .do-not-disturb-background")
end
end
end