-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2168 from tf/text-inline-rights-backdrop
Figrure caption variants and text inline rights backdrops
- Loading branch information
Showing
45 changed files
with
825 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
entry_types/scrolled/config/locales/new/caption_settings.de.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
de: | ||
pageflow_scrolled: | ||
editor: | ||
content_element_text_inline_file_rights_attributes: | ||
showTextInlineFileRightsBackdrop: | ||
label: "Abblendung hinter Rechteangabe" | ||
inline_help: "Lesbarkeit des Texts auf unruhigen Hintergründen sicherstellen." | ||
inline_help_disabled: "Steht nur zur Verfügung, wenn Rechteangaben am Element angezeigt werden." | ||
common_content_element_attributes: | ||
captionVariant: | ||
label: Beschriftungsvariante | ||
inline_help: Ändere die Darstellung der Beschriftung unterhalb des Element. | ||
inline_help_disabled: Füge eine Beschriftung unterhalb des Elements hinzu, um zwischen Varianten zu wählen. | ||
blank: "(Standard)" |
14 changes: 14 additions & 0 deletions
14
entry_types/scrolled/config/locales/new/caption_settings.en.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
en: | ||
pageflow_scrolled: | ||
editor: | ||
content_element_text_inline_file_rights_attributes: | ||
showTextInlineFileRightsBackdrop: | ||
label: "Backdrop behind inline file rights" | ||
inline_help: "Improve readability on busy backgrounds." | ||
inline_help_disabled: "Only available when rights texts are displayed at the element." | ||
common_content_element_attributes: | ||
captionVariant: | ||
label: Caption Variant | ||
inline_help: Switch between different looks of the caption below the element. | ||
inline_help_disabled: Add a caption below the element to switch between different looks. | ||
blank: "(Default)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
entry_types/scrolled/package/spec/frontend/ContentElementFigure-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import React from 'react'; | ||
import '@testing-library/jest-dom/extend-expect' | ||
|
||
import {renderInContentElement} from 'support'; | ||
|
||
import {ContentElementFigure} from 'frontend/ContentElementFigure'; | ||
|
||
describe('ContentElementFigure', () => { | ||
it('just renders children by default', () => { | ||
const {queryByTestId} = | ||
renderInContentElement( | ||
<ContentElementFigure configuration={{}}><div data-testid="content" /></ContentElementFigure>, | ||
{ | ||
seed: {} | ||
} | ||
); | ||
|
||
expect(queryByTestId('content')).not.toBeNull(); | ||
}); | ||
|
||
it('applies variant scope', () => { | ||
const configuration = { | ||
caption: [{ | ||
type: 'paragraph', | ||
children: [{ text: 'Some caption text' }], | ||
}], | ||
captionVariant: 'invert' | ||
}; | ||
|
||
const {container} = | ||
renderInContentElement( | ||
<ContentElementFigure configuration={configuration} />, | ||
{ | ||
seed: {} | ||
} | ||
); | ||
|
||
expect(container.querySelector('figcaption')).toHaveClass('scope-figureCaption-invert'); | ||
}); | ||
|
||
it('sets hasCaption to true in transient state on mount', () => { | ||
const configuration = { | ||
caption: [{ | ||
type: 'paragraph', | ||
children: [{ text: 'Some caption text' }], | ||
}], | ||
captionVariant: 'invert' | ||
}; | ||
const setTransientState = jest.fn(); | ||
|
||
renderInContentElement( | ||
<ContentElementFigure configuration={configuration} />, | ||
{ | ||
seed: {}, | ||
editorState: {isEditable: true, setTransientState} | ||
} | ||
); | ||
|
||
expect(setTransientState).toHaveBeenCalledWith({hasCaption: true}) | ||
}); | ||
|
||
it('sets hasCaption to false in transient state on unmount', () => { | ||
const configuration = { | ||
caption: [{ | ||
type: 'paragraph', | ||
children: [{ text: 'Some caption text' }], | ||
}], | ||
captionVariant: 'invert' | ||
}; | ||
const setTransientState = jest.fn(); | ||
|
||
const {unmount} = renderInContentElement( | ||
<ContentElementFigure configuration={configuration} />, | ||
{ | ||
seed: {}, | ||
editorState: {isEditable: true, setTransientState} | ||
} | ||
); | ||
unmount(); | ||
|
||
expect(setTransientState).toHaveBeenCalledWith({hasCaption: false}) | ||
}); | ||
|
||
it('does not render transient state component outside of editor', () => { | ||
const configuration = { | ||
caption: [{ | ||
type: 'paragraph', | ||
children: [{ text: 'Some caption text' }], | ||
}], | ||
captionVariant: 'invert' | ||
}; | ||
const setTransientState = jest.fn(); | ||
|
||
renderInContentElement( | ||
<ContentElementFigure configuration={configuration} />, | ||
{ | ||
seed: {}, | ||
editorState: {isEditable: false, setTransientState} | ||
} | ||
); | ||
|
||
expect(setTransientState).not.toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.