use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDownloadWithDefaultTitleType.
@Test
void testDownloadWithDefaultTitleType() {
Resource mockResource = mock(Resource.class);
Style mockStyle = new MockStyle(mockResource, new MockValueMap(mockResource));
Download download = getDownloadUnderTest(DOWNLOAD_1, mockStyle);
assertNull(download.getTitleType(), "Expected title type is not correct");
Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED));
}
use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDisplayAllFileMetadata.
@Test
void testDisplayAllFileMetadata() {
Download download = getDownloadUnderTest(DOWNLOAD_1, Download.PN_DISPLAY_FILENAME, true, Download.PN_DISPLAY_FORMAT, true, Download.PN_DISPLAY_SIZE, true);
assertTrue(download.displayFilename(), "Display of filename is not enabled");
assertTrue(download.displaySize(), "Display of file size is not enabled");
assertTrue(download.displayFormat(), "Display of file format is not enabled");
Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED));
}
use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDownloadWithHiddenTitleLink.
@Test
void testDownloadWithHiddenTitleLink() {
Resource mockResource = mock(Resource.class);
MockValueMap mockValueMap = new MockValueMap(mockResource);
mockValueMap.put(Download.PN_HIDE_TITLE_LINK, true);
Style mockStyle = new MockStyle(mockResource, mockValueMap);
Download download = getDownloadUnderTest(DOWNLOAD_1, mockStyle);
assertTrue(download.hideTitleLink(), "Expected title link to be hidden");
}
use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testFullyConfiguredDownload_assetWithoutSizeProperty.
@Test
void testFullyConfiguredDownload_assetWithoutSizeProperty() {
context.load().json(TEST_BASE + TEST_CONTENT_DAM_WITHOUT_SIZE_PROP_JSON, "/content/dam/core/documents_without_size");
context.load().binaryFile(TEST_BASE + "/" + PDF_BINARY_NAME, PDF_ASSET_WITHOUT_SIZE_PROP_PATH + "/jcr:content/renditions/original");
Download download = getDownloadUnderTest(DOWNLOAD_4);
assertEquals(TITLE, download.getTitle());
assertEquals(DESCRIPTION, download.getDescription());
assertEquals(CONTEXT_PATH + PDF_ASSET_WITHOUT_SIZE_PROP_PATH + "." + DownloadServlet.SELECTOR + ".pdf", download.getUrl());
assertEquals(PDF_FILENAME, download.getFilename());
assertEquals(PDF_EXTENSION, download.getExtension());
assertEquals(PDF_FILESIZE_STRING, download.getSize());
assertEquals(PDF_FORMAT_STRING, download.getFormat());
assertEquals(COMPONENT_ACTION_TEXT, download.getActionText());
}
use of com.adobe.cq.wcm.core.components.models.Download in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDownloadWithCustomActionText.
@Test
void testDownloadWithCustomActionText() {
Download download = getDownloadUnderTest(DOWNLOAD_1, Download.PN_ACTION_TEXT, STYLE_ACTION_TEST);
assertEquals(COMPONENT_ACTION_TEXT, download.getActionText(), "Expected action text is not correct");
Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED));
}
Aggregations