Search in sources :

Example 21 with ContentFragment

use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ContentFragmentImplTest method structuredVariation.

@Test
void structuredVariation() {
    ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_VARIATION);
    assertContentFragment(fragment, VARIATION_NAME, TITLE, DESCRIPTION, STRUCTURED_TYPE, STRUCTURED_NAME, ASSOCIATED_CONTENT, MAIN, SECOND_STRUCTURED);
    Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_STRUCTURED_VARIATION));
}
Also used : DAMContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.DAMContentFragment) ContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment) Test(org.junit.jupiter.api.Test)

Example 22 with ContentFragment

use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ContentFragmentImplTest method textOnlyVariation.

@Test
void textOnlyVariation() {
    ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY_VARIATION);
    assertContentFragment(fragment, VARIATION_NAME, TITLE, DESCRIPTION, TEXT_ONLY_TYPE, TEXT_ONLY_NAME, ASSOCIATED_CONTENT, MAIN, SECOND_TEXT_ONLY);
    Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_TEXT_ONLY_VARIATION));
}
Also used : DAMContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.DAMContentFragment) ContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment) Test(org.junit.jupiter.api.Test)

Example 23 with ContentFragment

use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ContentFragmentImplTest method getParagraphsOfMultiDisplayModeIsNull.

@Test
void getParagraphsOfMultiDisplayModeIsNull() {
    // Structure CF has displayMode=multi which should not return paragraphs
    ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED);
    assertNull(fragment.getParagraphs());
}
Also used : DAMContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.DAMContentFragment) ContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment) Test(org.junit.jupiter.api.Test)

Example 24 with ContentFragment

use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ContentFragmentImplTest method structuredSingleElement.

@Test
void structuredSingleElement() {
    ContentFragment fragment = getModelInstanceUnderTest(CF_STRUCTURED_SINGLE_ELEMENT);
    assertContentFragment(fragment, TITLE, DESCRIPTION, STRUCTURED_TYPE, STRUCTURED_NAME, ASSOCIATED_CONTENT, SECOND_STRUCTURED);
    Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(TEST_BASE, CF_STRUCTURED_SINGLE_ELEMENT));
}
Also used : DAMContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.DAMContentFragment) ContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment) Test(org.junit.jupiter.api.Test)

Example 25 with ContentFragment

use of com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ContentFragmentImplTest method textOnlyWithVariationGetEditorJSON.

@Test
void textOnlyWithVariationGetEditorJSON() {
    ContentFragment fragment = getModelInstanceUnderTest(CF_TEXT_ONLY_VARIATION);
    String expectedJSON = "{\"title\":\"Test Content Fragment\",\"path\":\"/content/dam/contentfragments/text-only\"," + "\"variation\":\"teaser\",\"associatedContent\":[{\"title\":\"Test Collection\"" + ",\"path\":\"/content/dam/collections/X/X7v6pJAcy5qtkUdXdIxR/test\"}]}";
    assertEquals(fragment.getEditorJSON(), expectedJSON);
}
Also used : DAMContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.DAMContentFragment) ContentFragment(com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment) Test(org.junit.jupiter.api.Test)

Aggregations

ContentFragment (com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragment)26 DAMContentFragment (com.adobe.cq.wcm.core.components.models.contentfragment.DAMContentFragment)26 Test (org.junit.jupiter.api.Test)26 Resource (org.apache.sling.api.resource.Resource)3 ComponentExporter (com.adobe.cq.export.json.ComponentExporter)1 StringReader (java.io.StringReader)1