fix(widget-list): add missing translations in widget list top bar (#5471) (#5679)

This commit is contained in:
Josian Godard
2021-08-04 13:56:38 +02:00
committed by GitHub
parent d15a0220ad
commit db560cc082
6 changed files with 26 additions and 14 deletions

View File

@ -128,6 +128,7 @@ export default class ListControl extends React.Component {
clearFieldErrors: PropTypes.func.isRequired,
fieldsErrors: ImmutablePropTypes.map.isRequired,
entry: ImmutablePropTypes.map.isRequired,
t: PropTypes.func.isRequired,
};
static defaultProps = {
@ -604,7 +605,7 @@ export default class ListControl extends React.Component {
}
renderListControl() {
const { value, forID, field, classNameWrapper } = this.props;
const { value, forID, field, classNameWrapper, t } = this.props;
const { itemsCollapsed, listCollapsed } = this.state;
const items = value || List();
const label = field.get('label', field.get('name'));
@ -635,6 +636,7 @@ export default class ListControl extends React.Component {
label={labelSingular.toLowerCase()}
onCollapseToggle={this.handleCollapseAllToggle}
collapsed={selfCollapsed}
t={t}
/>
{(!selfCollapsed || !minimizeCollapsedItems) && (
<SortableList

View File

@ -587,7 +587,7 @@ describe('ListControl', () => {
expect(queryByTestId('object-control-0')).toBeNull();
fireEvent.click(getByText('Add list'));
fireEvent.click(getByText('editor.editorWidgets.list.add'));
expect(props.onChange).toHaveBeenCalledTimes(1);
expect(props.onChange).toHaveBeenCalledWith(fromJS([{}]));

View File

@ -177,7 +177,7 @@ exports[`ListControl should add to list when add button is clicked 1`] = `
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -406,7 +406,7 @@ exports[`ListControl should remove from list when remove button is clicked 1`] =
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -665,7 +665,7 @@ exports[`ListControl should remove from list when remove button is clicked 2`] =
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -905,7 +905,7 @@ exports[`ListControl should render list with fields with collapse = "false" and
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -1163,7 +1163,7 @@ exports[`ListControl should render list with fields with collapse = "false" and
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -1422,7 +1422,7 @@ exports[`ListControl should render list with fields with default collapse ("true
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -1663,7 +1663,7 @@ exports[`ListControl should render list with fields with default collapse ("true
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -1862,7 +1862,7 @@ exports[`ListControl should render list with nested object 1`] = `
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>
@ -2120,7 +2120,7 @@ exports[`ListControl should render list with nested object with collapse = false
<button
class="emotion-10 emotion-11"
>
Add list
editor.editorWidgets.list.add
<span
class="emotion-0 emotion-8 emotion-2"
>