mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(flags): align board flag rendering (#1142)
* fix(flags): align board flag rendering * ci: run react doctor on changed pr files
This commit is contained in:
@@ -19,6 +19,30 @@ describe('board-flags', () => {
|
||||
x: 0,
|
||||
y: 0,
|
||||
});
|
||||
expect(getBoardFlagDefinition('pol', 'MZ')).toMatchObject({
|
||||
code: 'MZ',
|
||||
label: 'Task Force Z',
|
||||
x: 64,
|
||||
y: 24,
|
||||
});
|
||||
expect(getBoardFlagDefinition('pol', 'NB')).toMatchObject({
|
||||
code: 'NB',
|
||||
label: 'National Bolshevik',
|
||||
x: 0,
|
||||
y: 36,
|
||||
});
|
||||
expect(getBoardFlagDefinition('pol', 'RE')).toMatchObject({
|
||||
code: 'RE',
|
||||
label: 'Republican',
|
||||
x: 0,
|
||||
y: 48,
|
||||
});
|
||||
expect(getBoardFlagDefinition('pol', 'TM')).toMatchObject({
|
||||
code: 'TM',
|
||||
label: 'Templar',
|
||||
x: 16,
|
||||
y: 48,
|
||||
});
|
||||
expect(getBoardFlagDefinition('pol', 'WP')).toMatchObject({ code: 'WP', x: 64, y: 48 });
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
getCommentFlagPublishOptionsForDirectory,
|
||||
getCommentFlagPublishOptionsFromSelection,
|
||||
getCommentFlagRequestFromSelection,
|
||||
hasCommentFlagsForDirectory,
|
||||
} from '../comment-flag-selection';
|
||||
|
||||
describe('comment-flag-selection', () => {
|
||||
@@ -11,6 +12,11 @@ describe('comment-flag-selection', () => {
|
||||
expect(getCommentFlagOptionsForDirectory({ features: {}, title: '/mu/ - Music' })).toEqual([]);
|
||||
});
|
||||
|
||||
it('detects flag-capable directories from directory metadata', () => {
|
||||
expect(hasCommentFlagsForDirectory({ features: {}, title: '/mu/ - Music' })).toBe(false);
|
||||
expect(hasCommentFlagsForDirectory({ features: { hasFlags: true }, title: '/pol/ - Politically Incorrect' })).toBe(true);
|
||||
});
|
||||
|
||||
it('uses geographic location as the default for country flag boards', () => {
|
||||
expect(
|
||||
getCommentFlagOptionsForDirectory({
|
||||
@@ -59,6 +65,14 @@ describe('comment-flag-selection', () => {
|
||||
{ label: 'Confederate', value: 'pol:CF' },
|
||||
{ label: 'Communist', value: 'pol:CM' },
|
||||
]);
|
||||
expect(options.slice(-6)).toEqual([
|
||||
{ label: 'Republican', value: 'pol:RE' },
|
||||
{ label: 'Task Force Z', value: 'pol:MZ' },
|
||||
{ label: 'Templar', value: 'pol:TM' },
|
||||
{ label: 'Tree Hugger', value: 'pol:TR' },
|
||||
{ label: 'United Nations', value: 'pol:UN' },
|
||||
{ label: 'White Supremacist', value: 'pol:WP' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('matches the 4chan /mlp/ flag default', () => {
|
||||
|
||||
Reference in New Issue
Block a user