2020-10-30 16:15:58 +00:00
|
|
|
/* eslint-disable no-undef */
|
2022-04-28 18:44:40 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2020-10-30 16:15:58 +00:00
|
|
|
import { getUnreadStyle } from './getUnreadStyle';
|
|
|
|
|
2021-10-01 18:12:19 +00:00
|
|
|
const testsForTheme = theme => {
|
2020-10-30 16:15:58 +00:00
|
|
|
const getUnreadStyleUtil = ({ ...props }) => getUnreadStyle({ theme, ...props });
|
|
|
|
|
2020-10-30 17:35:07 +00:00
|
|
|
test('render empty', () => {
|
|
|
|
expect(getUnreadStyleUtil({})).toEqual({});
|
|
|
|
});
|
|
|
|
|
2020-10-30 16:15:58 +00:00
|
|
|
test('render unread', () => {
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
unread: 1
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].unreadColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('render thread unread', () => {
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
tunread: [1]
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].tunreadColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('render user mention', () => {
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
unread: 1,
|
|
|
|
userMentions: 1
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].mentionMeColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('render group mention', () => {
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
unread: 1,
|
|
|
|
groupMentions: 1
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].mentionGroupColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('mentions priority', () => {
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
unread: 1,
|
|
|
|
userMentions: 1,
|
|
|
|
groupMentions: 1,
|
|
|
|
tunread: [1]
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].mentionMeColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
unread: 1,
|
|
|
|
groupMentions: 1,
|
|
|
|
tunread: [1]
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].mentionGroupColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
2021-10-01 18:12:19 +00:00
|
|
|
expect(
|
|
|
|
getUnreadStyleUtil({
|
|
|
|
unread: 1,
|
|
|
|
tunread: [1]
|
|
|
|
})
|
|
|
|
).toEqual({
|
2020-12-17 17:39:45 +00:00
|
|
|
backgroundColor: themes[theme].tunreadColor,
|
2020-10-30 16:15:58 +00:00
|
|
|
color: themes[theme].buttonText
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('getUnreadStyle light theme', () => testsForTheme('light'));
|
|
|
|
describe('getUnreadStyle dark theme', () => testsForTheme('dark'));
|
|
|
|
describe('getUnreadStyle black theme', () => testsForTheme('black'));
|