1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-03-26 20:53:55 +02:00

fix: render default LHS board icon (#3353)

* fix: render default LHS board icon

* test: LHS renders default board icon if none set

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Paul Esch-Laurent 2022-07-13 00:59:00 -05:00 committed by GitHub
parent e1f944c9ea
commit e331eafc26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 111 additions and 1 deletions

View File

@ -1,5 +1,86 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`components/sidebarBoardItem renders default icon if no custom icon set 1`] = `
<div>
<div
class="SidebarBoardItem subitem active"
>
<div
class="octo-sidebar-icon"
>
<svg
class="BoardIcon Icon"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<g
opacity="0.8"
>
<path
clip-rule="evenodd"
d="M4 4H20V20H4V4ZM2 4C2 2.89543 2.89543 2 4 2H20C21.1046 2 22 2.89543 22 4V20C22 21.1046 21.1046 22 20 22H4C2.89543 22 2 21.1046 2 20V4ZM8 6H6V12H8V6ZM11 6H13V16H11V6ZM18 6H16V9H18V6Z"
fill="currentColor"
fill-rule="evenodd"
/>
</g>
</svg>
</div>
<div
class="octo-sidebar-title"
title="board title"
>
board title
</div>
<div
aria-label="menuwrapper"
class="MenuWrapper x"
role="button"
>
<button
class="IconButton"
type="button"
>
<i
class="CompassIcon icon-dots-horizontal OptionsIcon"
/>
</button>
</div>
</div>
<div
class="SidebarBoardItem sidebar-view-item active"
>
<svg
class="BoardIcon Icon"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<g
opacity="0.8"
>
<path
clip-rule="evenodd"
d="M4 4H20V20H4V4ZM2 4C2 2.89543 2.89543 2 4 2H20C21.1046 2 22 2.89543 22 4V20C22 21.1046 21.1046 22 20 22H4C2.89543 22 2 21.1046 2 20V4ZM8 6H6V12H8V6ZM11 6H13V16H11V6ZM18 6H16V9H18V6Z"
fill="currentColor"
fill-rule="evenodd"
/>
</g>
</svg>
<div
class="octo-sidebar-title"
title="view title"
>
view title
</div>
</div>
</div>
`;
exports[`components/sidebarBoardItem sidebar board item 1`] = `
<div>
<div

View File

@ -153,6 +153,11 @@
}
}
.octo-sidebar-icon > .Icon {
width: 19px;
vertical-align: top;
}
.Menu.noselect.left {
position: fixed;
right: calc(100% - 480px + 50px);

View File

@ -87,4 +87,28 @@ describe('components/sidebarBoardItem', () => {
const {container} = render(component)
expect(container).toMatchSnapshot()
})
test('renders default icon if no custom icon set', () => {
const mockStore = configureStore([])
const store = mockStore(state)
const noIconBoard = { ...board, icon: '' }
const component = wrapIntl(
<ReduxProvider store={store}>
<Router history={history}>
<SidebarBoardItem
categoryBoards={categoryBoards1}
board={noIconBoard}
allCategories={allCategoryBoards}
isActive={true}
showBoard={jest.fn()}
showView={jest.fn()}
onDeleteRequest={jest.fn()}
/>
</Router>
</ReduxProvider>,
)
const {container} = render(component)
expect(container).toMatchSnapshot()
})
})

View File

@ -114,7 +114,7 @@ const SidebarBoardItem = (props: Props) => {
onClick={() => props.showBoard(board.id)}
>
<div className='octo-sidebar-icon'>
{board.icon}
{board.icon || <BoardIcon/>}
</div>
<div
className='octo-sidebar-title'