Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9b64484

Browse files
author
Germain
authored
Fix NotificationBadge unsent color (#9522)
1 parent d92fdc1 commit 9b64484

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/components/views/rooms/NotificationBadge/StatelessNotificationBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function StatelessNotificationBadge({
5151
const classes = classNames({
5252
'mx_NotificationBadge': true,
5353
'mx_NotificationBadge_visible': isEmptyBadge ? true : hasUnreadCount,
54-
'mx_NotificationBadge_highlighted': color === NotificationColor.Red,
54+
'mx_NotificationBadge_highlighted': color >= NotificationColor.Red,
5555
'mx_NotificationBadge_dot': isEmptyBadge,
5656
'mx_NotificationBadge_2char': symbol?.length > 0 && symbol?.length < 3,
5757
'mx_NotificationBadge_3char': symbol?.length > 2,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
Copyright 2022 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import React from "react";
18+
import { render } from "@testing-library/react";
19+
20+
import {
21+
StatelessNotificationBadge,
22+
} from "../../../../../src/components/views/rooms/NotificationBadge/StatelessNotificationBadge";
23+
import { NotificationColor } from "../../../../../src/stores/notifications/NotificationColor";
24+
25+
describe("StatelessNotificationBadge", () => {
26+
it("is highlighted when unsent", () => {
27+
const { container } = render(
28+
<StatelessNotificationBadge
29+
symbol="!"
30+
count={0}
31+
color={NotificationColor.Unsent}
32+
/>,
33+
);
34+
expect(
35+
container.querySelector(".mx_NotificationBadge_highlighted"),
36+
).not.toBe(null);
37+
});
38+
});

0 commit comments

Comments
 (0)