diff --git a/Gemfile b/Gemfile
index a60622184a..29a2a595aa 100644
--- a/Gemfile
+++ b/Gemfile
@@ -34,3 +34,7 @@ gem 'capybara-chromedriver-logger', git: 'https://github.com/codevise/capybara-c
# See https://github.com/charkost/prosopite/pull/79
gem 'prosopite', git: 'https://github.com/tf/prosopite', branch: 'location-backtrace-cleaner'
+
+# See https://github.com/rack/rackup/issues/22
+# Remove once https://github.com/puma/puma/pull/3532 is merged
+gem 'rackup', '1.0.0', require: false
diff --git a/entry_types/scrolled/config/locales/new/caption_settings.de.yml b/entry_types/scrolled/config/locales/new/caption_settings.de.yml
new file mode 100644
index 0000000000..f833467147
--- /dev/null
+++ b/entry_types/scrolled/config/locales/new/caption_settings.de.yml
@@ -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)"
diff --git a/entry_types/scrolled/config/locales/new/caption_settings.en.yml b/entry_types/scrolled/config/locales/new/caption_settings.en.yml
new file mode 100644
index 0000000000..d69604f15d
--- /dev/null
+++ b/entry_types/scrolled/config/locales/new/caption_settings.en.yml
@@ -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)"
diff --git a/entry_types/scrolled/package/spec/editor/models/ScrolledEntry-spec.js b/entry_types/scrolled/package/spec/editor/models/ScrolledEntry-spec.js
index 699e18f633..2524d041c2 100644
--- a/entry_types/scrolled/package/spec/editor/models/ScrolledEntry-spec.js
+++ b/entry_types/scrolled/package/spec/editor/models/ScrolledEntry-spec.js
@@ -2915,13 +2915,13 @@ describe('ScrolledEntry', () => {
);
const contentElement = entry.contentElements.get(5);
- const [values, translationKeys] = entry.getContentElementVariants({contentElement});
+ const [values, texts] = entry.getContentElementVariants({contentElement});
expect(values).toEqual([]);
- expect(translationKeys).toEqual([]);
+ expect(texts).toEqual([]);
});
- it('selects typography rules based on content element type name', () => {
+ it('selects property scopes based on content element type name', () => {
editor.contentElementTypes.register('someElement', {});
const entry = factories.entry(
@@ -3046,6 +3046,129 @@ describe('ScrolledEntry', () => {
});
});
+ describe('getComponentVariants', () => {
+ it('returns empty arrays by default', () => {
+ const entry = factories.entry(
+ ScrolledEntry,
+ {},
+ {
+ entryTypeSeed: normalizeSeed()
+ }
+ );
+
+ const [values, texts] = entry.getComponentVariants({name: 'figureCaption'});
+
+ expect(values).toEqual([]);
+ expect(texts).toEqual([]);
+ });
+
+ it('selects property scopes based on name', () => {
+ const entry = factories.entry(
+ ScrolledEntry,
+ {},
+ {
+ entryTypeSeed: normalizeSeed({
+ themeOptions: {
+ properties: {
+ 'figureCaption-blue': {
+ surface_color: 'blue'
+ },
+ 'figureCaption-green': {
+ surface_color: 'green'
+ }
+ }
+ }
+ })
+ }
+ );
+
+ const [values] = entry.getComponentVariants({name: 'figureCaption'});
+
+ expect(values).toEqual(['blue', 'green']);
+ });
+
+ describe('with shared translations', () => {
+ const commonPrefix = 'pageflow_scrolled.editor.component_variants'
+
+ useFakeTranslations({
+ [`${commonPrefix}.figureCaption-blue`]: 'Blue',
+ [`${commonPrefix}.figureCaption-green`]: 'Green'
+ });
+
+ it('returns translated display names', () => {
+ const entry = factories.entry(
+ ScrolledEntry,
+ {
+ metadata: {theme_name: 'custom'}
+ },
+ {
+ entryTypeSeed: normalizeSeed({
+ themeOptions: {
+ properties: {
+ 'figureCaption-blue': {
+ surface_color: 'blue'
+ },
+ 'figureCaption-green': {
+ surface_color: 'green'
+ }
+ }
+ }
+ })
+ }
+ );
+
+ const [, texts] = entry.getComponentVariants({name: 'figureCaption'});
+
+ expect(texts).toEqual([
+ 'Blue',
+ 'Green'
+ ]);
+ });
+ });
+
+ describe('with theme specific translations', () => {
+ const commonPrefix = 'pageflow_scrolled.editor.component_variants'
+ const themePrefix = `pageflow_scrolled.editor.themes.custom`
+
+ useFakeTranslations({
+ [`${commonPrefix}.figureCaption-blue`]: 'Blue',
+ [`${commonPrefix}.figureCaption-green`]: 'Green',
+ [`${themePrefix}.component_variants.figureCaption-blue`]: 'Custom Blue',
+ [`${themePrefix}.component_variants.figureCaption-green`]: 'Custom Green'
+ });
+
+ it('prefers theme specific translations', () => {
+ const entry = factories.entry(
+ ScrolledEntry,
+ {
+ metadata: {theme_name: 'custom'}
+ },
+ {
+ entryTypeSeed: normalizeSeed({
+ themeOptions: {
+ properties: {
+ 'figureCaption-blue': {
+ surface_color: 'blue'
+ },
+ 'figureCaption-green': {
+ surface_color: 'green'
+ }
+ }
+ }
+ })
+ }
+ );
+
+ const [, texts] = entry.getComponentVariants({name: 'figureCaption'});
+
+ expect(texts).toEqual([
+ 'Custom Blue',
+ 'Custom Green'
+ ]);
+ });
+ });
+ });
+
describe('supportsSectionWidths', () => {
it('returns false by default', () => {
const entry = factories.entry(
diff --git a/entry_types/scrolled/package/spec/frontend/ContentElementFigure-spec.js b/entry_types/scrolled/package/spec/frontend/ContentElementFigure-spec.js
new file mode 100644
index 0000000000..2b2c68c62a
--- /dev/null
+++ b/entry_types/scrolled/package/spec/frontend/ContentElementFigure-spec.js
@@ -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(
+