0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/plugins/chat/spec/models/user_option_spec.rb
Kris 0284e0a2a5
A11Y: live announcements and optional sounds for chat messages (#41213)
This introduces two new chat settings in user preferences, grouped in a
new accessibility section.

The first "announce new messages to screen readers", defaults on, and
uses an aria live region to politely announce messages as they're
posted. There's some grouping (user sent 3 messages) and throttling
involved here in cases where many messages are sent, and attachments are
also referenced.

The second "Play a sound for every new message while chat is in the
foreground" is default off, and provides an optional secondary approach
if the announcement of messages proves to be too noisy. This plays a
sound for each message (throttled slightly to avoid floods), and leans
on our existing chat sounds.

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/3c4e6173-3b2d-463d-9040-050311f91d63"
/>
2026-07-02 12:48:58 -04:00

29 lines
870 B
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe UserOption do
describe "#chat_separate_sidebar_mode" do
it "is present" do
expect(described_class.new.chat_separate_sidebar_mode).to eq("default")
end
end
describe "#show_thread_title_prompts" do
it "is present" do
expect(described_class.new.show_thread_title_prompts).to eq(true)
end
end
describe "#chat_announce_new_messages" do
it "defaults to true" do
expect(described_class.new.chat_announce_new_messages).to eq(true)
end
end
describe "#chat_new_message_sound" do
it "defaults to false" do
expect(described_class.new.chat_new_message_sound).to eq(false)
end
end
describe "#chat_quick_reaction_type" do
it "is present with frequent as default" do
expect(described_class.new.chat_quick_reaction_type).to eq("frequent")
end
end
end