From 1dae2498d4580701539a5ffdcaeec62c66bc4616 Mon Sep 17 00:00:00 2001 From: Nicolas Peltier Date: Sat, 29 Aug 2020 00:04:15 +0200 Subject: [PATCH] GH-24 [flex] get the colors working this component will not be done in one PR :-) got fore & back ground colors working ( no dialog yet) on docs by: - making responsive configuration more complex (with an instanciation of it for docs in content, - added a FlexModel.getId, even if we might want to move this to some abstract model later, - fixed a few bad resource types here & there --- ...dx.domtagging.internal.IDTaggerImpl.config | 5 ++ ...obe.dx.domtagging.internal.IDTagger.config | 1 - ...dx.domtagging.internal.IDTaggerImpl.config | 1 + apps/docs/app/pom.xml | 4 +- .../conf/dx-docs/_sling_configs/.content.xml | 4 ++ .../.content.xml | 4 ++ .../.content.xml | 5 ++ .../breakpoints/.content.xml | 7 +++ .../breakpoints/1/.content.xml | 8 ++++ .../breakpoints/2/.content.xml | 9 ++++ .../breakpoints/3/.content.xml | 8 ++++ .../base-page/policies/.content.xml | 2 +- .../policies/.content.xml | 2 +- .../jcr_root/content/dx-docs/us/.content.xml | 2 +- .../dx/structure/components/flex/color.html | 46 +++++++++++++++++++ .../dx/structure/components/flex/flex.html | 10 ++-- .../structure/components/parlite/parlite.html | 3 +- apps/structure/core/pom.xml | 5 ++ .../adobe/dx/structure/flex/FlexModel.java | 25 ++++++++-- bundles/core/pom.xml | 6 +++ .../internal/DxBindingsValueProvider.java | 5 +- .../dx/domtagging/internal/IDTaggerImpl.java | 2 +- .../com/adobe/dx/responsive/Breakpoint.java | 40 ++++++++++++++++ .../responsive/ResponsiveConfiguration.java | 18 +++++++- .../internal/ResponsiveProperties.java | 11 +++-- .../com/adobe/dx/responsive/package-info.java | 2 +- .../internal/ResponsivePropertiesTest.java | 15 ++++-- 27 files changed, 221 insertions(+), 29 deletions(-) create mode 100644 apps/docs/app/jcr_root/apps/dx-docs/configs/config.author/com.adobe.dx.domtagging.internal.IDTaggerImpl.config delete mode 100644 apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTagger.config create mode 100644 apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTaggerImpl.config create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/.content.xml create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.admin.rendercondition.RenderConditionConfiguration/.content.xml create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/.content.xml create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/.content.xml create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/1/.content.xml create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/2/.content.xml create mode 100644 apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/3/.content.xml create mode 100644 apps/structure/app/jcr_root/apps/dx/structure/components/flex/color.html create mode 100644 bundles/core/src/main/java/com/adobe/dx/responsive/Breakpoint.java diff --git a/apps/docs/app/jcr_root/apps/dx-docs/configs/config.author/com.adobe.dx.domtagging.internal.IDTaggerImpl.config b/apps/docs/app/jcr_root/apps/dx-docs/configs/config.author/com.adobe.dx.domtagging.internal.IDTaggerImpl.config new file mode 100644 index 00000000..938f6ad2 --- /dev/null +++ b/apps/docs/app/jcr_root/apps/dx-docs/configs/config.author/com.adobe.dx.domtagging.internal.IDTaggerImpl.config @@ -0,0 +1,5 @@ +acceptedTypes=["dx/structure/.*","dx-docs/components/.*"] +tagOnPublication=B"true" +tagOnModification=B"true" +referenceTypes=["cq/experience-fragments/editor/components/experiencefragment"] +shouldRewriteComponentHash=B"true" \ No newline at end of file diff --git a/apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTagger.config b/apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTagger.config deleted file mode 100644 index cdb858dc..00000000 --- a/apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTagger.config +++ /dev/null @@ -1 +0,0 @@ -acceptedTypes=["dx/components/structure/.*","dx-docs/components/.*"] \ No newline at end of file diff --git a/apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTaggerImpl.config b/apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTaggerImpl.config new file mode 100644 index 00000000..eaab9b0f --- /dev/null +++ b/apps/docs/app/jcr_root/apps/dx-docs/configs/config/com.adobe.dx.domtagging.internal.IDTaggerImpl.config @@ -0,0 +1 @@ +acceptedTypes=["dx/structure/.*","dx-docs/components/.*"] diff --git a/apps/docs/app/pom.xml b/apps/docs/app/pom.xml index 760c7938..2b3753be 100644 --- a/apps/docs/app/pom.xml +++ b/apps/docs/app/pom.xml @@ -140,7 +140,7 @@ com.adobe.dx structure - 0.0.6 + 0.0.7-SNAPSHOT zip @@ -152,7 +152,7 @@ com.adobe.dx core - 0.0.12 + 0.0.13-SNAPSHOT com.adobe.dx diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/.content.xml new file mode 100644 index 00000000..54084a82 --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.admin.rendercondition.RenderConditionConfiguration/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.admin.rendercondition.RenderConditionConfiguration/.content.xml new file mode 100644 index 00000000..6678e0f8 --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.admin.rendercondition.RenderConditionConfiguration/.content.xml @@ -0,0 +1,4 @@ + + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/.content.xml new file mode 100644 index 00000000..284bcfcd --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/.content.xml @@ -0,0 +1,5 @@ + + + + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/.content.xml new file mode 100644 index 00000000..a091e2d8 --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/.content.xml @@ -0,0 +1,7 @@ + + + <_x0031_/> + <_x0032_/> + <_x0033_/> + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/1/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/1/.content.xml new file mode 100644 index 00000000..076ffd6c --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/1/.content.xml @@ -0,0 +1,8 @@ + + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/2/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/2/.content.xml new file mode 100644 index 00000000..edca07f8 --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/2/.content.xml @@ -0,0 +1,9 @@ + + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/3/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/3/.content.xml new file mode 100644 index 00000000..5a6017e1 --- /dev/null +++ b/apps/docs/content/jcr_root/conf/dx-docs/_sling_configs/com.adobe.dx.responsive.ResponsiveConfiguration/breakpoints/3/.content.xml @@ -0,0 +1,8 @@ + + diff --git a/apps/docs/content/jcr_root/conf/dx-docs/settings/wcm/template-types/base-page/policies/.content.xml b/apps/docs/content/jcr_root/conf/dx-docs/settings/wcm/template-types/base-page/policies/.content.xml index 9a8db6ce..ebc00441 100755 --- a/apps/docs/content/jcr_root/conf/dx-docs/settings/wcm/template-types/base-page/policies/.content.xml +++ b/apps/docs/content/jcr_root/conf/dx-docs/settings/wcm/template-types/base-page/policies/.content.xml @@ -2,7 +2,7 @@ + sling:resourceType="dx/structure/components/flex"/> diff --git a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/color.html b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/color.html new file mode 100644 index 00000000..da688ba2 --- /dev/null +++ b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/color.html @@ -0,0 +1,46 @@ + + + \ No newline at end of file diff --git a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html index 5f898e57..6ce8249b 100644 --- a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html +++ b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html @@ -13,6 +13,10 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/--> -
${model.hello}
- -Sup \ No newline at end of file + + +
+
+
\ No newline at end of file diff --git a/apps/structure/app/jcr_root/apps/dx/structure/components/parlite/parlite.html b/apps/structure/app/jcr_root/apps/dx/structure/components/parlite/parlite.html index 39cf5b1d..250abda7 100644 --- a/apps/structure/app/jcr_root/apps/dx/structure/components/parlite/parlite.html +++ b/apps/structure/app/jcr_root/apps/dx/structure/components/parlite/parlite.html @@ -1,4 +1,4 @@ -< -
testing 0.0.10 + + com.adobe.dx + core + 0.0.13-SNAPSHOT + diff --git a/apps/structure/core/src/main/java/com/adobe/dx/structure/flex/FlexModel.java b/apps/structure/core/src/main/java/com/adobe/dx/structure/flex/FlexModel.java index d6c199a3..b929142e 100644 --- a/apps/structure/core/src/main/java/com/adobe/dx/structure/flex/FlexModel.java +++ b/apps/structure/core/src/main/java/com/adobe/dx/structure/flex/FlexModel.java @@ -16,21 +16,38 @@ package com.adobe.dx.structure.flex; +import com.adobe.dx.domtagging.IDTagger; + +import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.OSGiService; import org.apache.sling.models.annotations.injectorspecific.SlingObject; import org.apache.sling.models.annotations.DefaultInjectionStrategy; -@Model(adaptables = { SlingHttpServletRequest.class, - Resource.class }, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) +@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) public class FlexModel { @SlingObject - protected Resource resource; + protected SlingHttpServletRequest request; + + @OSGiService + protected IDTagger idTagger; + + String id; public String getHello() { return "Hello"; } + public boolean isStyleNeeded() { + return true; + } + + public String getId() { + if (StringUtils.isBlank(id) && idTagger != null) { + id = idTagger.computeComponentId(request, null); + } + return id; + } } diff --git a/bundles/core/pom.xml b/bundles/core/pom.xml index 9563e291..bed7fc74 100644 --- a/bundles/core/pom.xml +++ b/bundles/core/pom.xml @@ -116,6 +116,12 @@ Bundle-DocURL: org.jetbrains annotations + + org.apache.sling + org.apache.sling.api + 2.18.4 + test + com.adobe.dx testing diff --git a/bundles/core/src/main/java/com/adobe/dx/bindings/internal/DxBindingsValueProvider.java b/bundles/core/src/main/java/com/adobe/dx/bindings/internal/DxBindingsValueProvider.java index 6ace9341..b34ab9e0 100644 --- a/bundles/core/src/main/java/com/adobe/dx/bindings/internal/DxBindingsValueProvider.java +++ b/bundles/core/src/main/java/com/adobe/dx/bindings/internal/DxBindingsValueProvider.java @@ -50,7 +50,9 @@ public class DxBindingsValueProvider implements BindingsValuesProvider { private static final String POLICY_KEY = "dxPolicy"; - private static final String RESP_PROPS_KEY = "respProperties"; + private static final String RESP_PROPS_KEY = "resprops"; + + private static final String BP_KEY = "breakpoints"; @Override public void addBindings(@NotNull Bindings bindings) { @@ -66,6 +68,7 @@ public void addBindings(@NotNull Bindings bindings) { ResponsiveConfiguration configuration = resource .adaptTo(ConfigurationBuilder.class) .as(ResponsiveConfiguration.class); + bindings.put(BP_KEY, configuration.breakpoints()); bindings.put(RESP_PROPS_KEY, new ResponsiveProperties(configuration, dxPolicy)); } } diff --git a/bundles/core/src/main/java/com/adobe/dx/domtagging/internal/IDTaggerImpl.java b/bundles/core/src/main/java/com/adobe/dx/domtagging/internal/IDTaggerImpl.java index 068b3c34..44759501 100644 --- a/bundles/core/src/main/java/com/adobe/dx/domtagging/internal/IDTaggerImpl.java +++ b/bundles/core/src/main/java/com/adobe/dx/domtagging/internal/IDTaggerImpl.java @@ -426,7 +426,7 @@ public Resource next() { + "for resource types that should be tagged with an id" ) @SuppressWarnings("squid:S00100") - String[] acceptedTypes() default { "dx/components/structure/.*" }; + String[] acceptedTypes() default { "dx/structure/components/.*" }; @AttributeDefinition( name = "Reference type", diff --git a/bundles/core/src/main/java/com/adobe/dx/responsive/Breakpoint.java b/bundles/core/src/main/java/com/adobe/dx/responsive/Breakpoint.java new file mode 100644 index 00000000..d365f2f6 --- /dev/null +++ b/bundles/core/src/main/java/com/adobe/dx/responsive/Breakpoint.java @@ -0,0 +1,40 @@ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Copyright 2020 Adobe + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +package com.adobe.dx.responsive; + +import org.apache.sling.caconfig.annotation.Configuration; +import org.apache.sling.caconfig.annotation.Property; + +@Configuration(collection = true) +public @interface Breakpoint { + @Property(label = "name") + String getLabel(); + + @Property(label = "property suffix", description = "suffix to append to a property to get the responsive version of it") + String propertySuffix(); + + @Property(label = "map key", description = "key from where a value will be available") + String key(); + + @Property(label = "media Query", description = "media query that defines this breakpoint") + String mediaQuery(); + + @Property(label = "start", description = "screen width from which this breakpoint is set") + int start(); + + @Property(label = "end", description = "screen width to which this breakpoint is set") + int end(); +} diff --git a/bundles/core/src/main/java/com/adobe/dx/responsive/ResponsiveConfiguration.java b/bundles/core/src/main/java/com/adobe/dx/responsive/ResponsiveConfiguration.java index 8e5d9763..4887aa28 100644 --- a/bundles/core/src/main/java/com/adobe/dx/responsive/ResponsiveConfiguration.java +++ b/bundles/core/src/main/java/com/adobe/dx/responsive/ResponsiveConfiguration.java @@ -1,9 +1,23 @@ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Copyright 2020 Adobe + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ package com.adobe.dx.responsive; import org.apache.sling.caconfig.annotation.Configuration; @Configuration(label="Responsive Configuration", description = "sets the responsive behaviour") public @interface ResponsiveConfiguration { - - String[] breakpoints() default {"Mobile", "Tablet", "Desktop"}; + Breakpoint[] breakpoints(); } diff --git a/bundles/core/src/main/java/com/adobe/dx/responsive/internal/ResponsiveProperties.java b/bundles/core/src/main/java/com/adobe/dx/responsive/internal/ResponsiveProperties.java index 699b273d..d15da27a 100644 --- a/bundles/core/src/main/java/com/adobe/dx/responsive/internal/ResponsiveProperties.java +++ b/bundles/core/src/main/java/com/adobe/dx/responsive/internal/ResponsiveProperties.java @@ -16,6 +16,7 @@ package com.adobe.dx.responsive.internal; +import com.adobe.dx.responsive.Breakpoint; import com.adobe.dx.responsive.ResponsiveConfiguration; import java.util.Collection; @@ -34,11 +35,11 @@ */ public class ResponsiveProperties implements Map { - private final String[] breakpoints; + private final Breakpoint[] breakpoints; private ValueMap properties; public ResponsiveProperties(final ResponsiveConfiguration configuration, ValueMap properties) { - this.breakpoints = configuration.breakpoints(); + breakpoints = configuration.breakpoints(); this.properties = properties; } @@ -47,11 +48,11 @@ public Object get(Object key) { if (key != null) { boolean empty = true; LinkedHashMap breakpointValues = new LinkedHashMap<>(); - for (String breakpoint : breakpoints) { - String respKey = key + breakpoint; + for (Breakpoint breakpoint : breakpoints) { + String respKey = key + breakpoint.propertySuffix(); String value = properties.get(respKey, String.class); empty &= StringUtils.isBlank(value); - breakpointValues.put(breakpoint.toLowerCase(), value); + breakpointValues.put(breakpoint.key(), value); } if (!empty) { return breakpointValues; diff --git a/bundles/core/src/main/java/com/adobe/dx/responsive/package-info.java b/bundles/core/src/main/java/com/adobe/dx/responsive/package-info.java index 633aa3d3..0a1b62dc 100644 --- a/bundles/core/src/main/java/com/adobe/dx/responsive/package-info.java +++ b/bundles/core/src/main/java/com/adobe/dx/responsive/package-info.java @@ -13,7 +13,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - @Version("0.1.0") + @Version("0.2.0") package com.adobe.dx.responsive; import org.osgi.annotation.versioning.Version; diff --git a/bundles/core/src/test/java/com/adobe/dx/responsive/internal/ResponsivePropertiesTest.java b/bundles/core/src/test/java/com/adobe/dx/responsive/internal/ResponsivePropertiesTest.java index e62b873b..6f5f20d6 100644 --- a/bundles/core/src/test/java/com/adobe/dx/responsive/internal/ResponsivePropertiesTest.java +++ b/bundles/core/src/test/java/com/adobe/dx/responsive/internal/ResponsivePropertiesTest.java @@ -17,6 +17,7 @@ import static org.junit.jupiter.api.Assertions.*; +import com.adobe.dx.responsive.Breakpoint; import com.adobe.dx.responsive.ResponsiveConfiguration; import com.adobe.dx.testing.AbstractTest; @@ -37,17 +38,23 @@ public class ResponsivePropertiesTest extends AbstractTest { - public final static String[] BREAKPOINTS = new String[] {"Mobile", "Tablet", "Desktop"}; ResponsiveConfiguration configuration; public static ResponsiveConfiguration initResponsiveConfiguration(AemContext context) { - context.create().resource(CONTENT_ROOT, "sling:configRef", CONF_ROOT); + context.build().resource(CONF_ROOT + "/sling:configs/" + ResponsiveConfiguration.class.getName() + "/breakpoints") + .siblingsMode() + .resource("1","propertySuffix", "Mobile", "key", "mobile") + .resource("2", "propertySuffix", "Tablet", "key", "tablet") + .resource("3", "propertySuffix", "Desktop", "key", "desktop"); MockContextAwareConfig.registerAnnotationClasses(context, ResponsiveConfiguration.class); - MockContextAwareConfig.writeConfiguration(context, CONTENT_ROOT, ResponsiveConfiguration.class,"breakpoints", BREAKPOINTS); - return context.resourceResolver() + MockContextAwareConfig.registerAnnotationClasses(context, Breakpoint.class); + context.create().resource(CONTENT_ROOT, "sling:configRef", CONF_ROOT); + ResponsiveConfiguration configuration = context.resourceResolver() .getResource(CONTENT_ROOT) .adaptTo(ConfigurationBuilder.class) .as(ResponsiveConfiguration.class); + assertEquals( 3, configuration.breakpoints().length, "we should have 3 breakpoints configured"); + return configuration; } @BeforeEach