use of org.xml.sax.Attributes in project acs-aem-commons by Adobe-Consulting-Services.
the class VersionedClientlibsTransformerFactoryTest method testJavaScriptClientLibraryWithRelativePath.
@Test
public void testJavaScriptClientLibraryWithRelativePath() throws Exception {
when(htmlLibraryManager.getLibrary(eq(LibraryType.JS), eq(PATH))).thenReturn(htmlLibrary);
final AttributesImpl in = new AttributesImpl();
in.addAttribute("", "src", "", "CDATA", "relative/script.js");
in.addAttribute("", "type", "", "CDATA", "text/javascript");
transformer.startElement(null, "script", null, in);
ArgumentCaptor<Attributes> attributesCaptor = ArgumentCaptor.forClass(Attributes.class);
verify(handler, only()).startElement(isNull(String.class), eq("script"), isNull(String.class), attributesCaptor.capture());
assertEquals("relative/script.js", attributesCaptor.getValue().getValue(0));
}
use of org.xml.sax.Attributes in project acs-aem-commons by Adobe-Consulting-Services.
the class VersionedClientlibsTransformerFactoryTest method testJavaScriptClientLibrary.
@Test
public void testJavaScriptClientLibrary() throws Exception {
when(htmlLibraryManager.getLibrary(eq(LibraryType.JS), eq(PATH))).thenReturn(htmlLibrary);
final AttributesImpl in = new AttributesImpl();
in.addAttribute("", "src", "", "CDATA", PATH + ".js");
in.addAttribute("", "type", "", "CDATA", "text/javascript");
transformer.startElement(null, "script", null, in);
ArgumentCaptor<Attributes> attributesCaptor = ArgumentCaptor.forClass(Attributes.class);
verify(handler, only()).startElement(isNull(String.class), eq("script"), isNull(String.class), attributesCaptor.capture());
assertEquals(PATH + "." + FAKE_STREAM_CHECKSUM + ".js", attributesCaptor.getValue().getValue(0));
}
use of org.xml.sax.Attributes in project acs-aem-commons by Adobe-Consulting-Services.
the class VersionedClientlibsTransformerFactoryTest method testJavaScriptClientLibraryWithDomainedPath.
@Test
public void testJavaScriptClientLibraryWithDomainedPath() throws Exception {
when(htmlLibraryManager.getLibrary(eq(LibraryType.JS), eq(PATH))).thenReturn(htmlLibrary);
final AttributesImpl in = new AttributesImpl();
in.addAttribute("", "src", "", "CDATA", "http://www.example.com/same/scheme/script.js");
in.addAttribute("", "type", "", "CDATA", "text/javascript");
transformer.startElement(null, "script", null, in);
ArgumentCaptor<Attributes> attributesCaptor = ArgumentCaptor.forClass(Attributes.class);
verify(handler, only()).startElement(isNull(String.class), eq("script"), isNull(String.class), attributesCaptor.capture());
assertEquals("http://www.example.com/same/scheme/script.js", attributesCaptor.getValue().getValue(0));
}
use of org.xml.sax.Attributes in project acs-aem-commons by Adobe-Consulting-Services.
the class VersionedClientlibsTransformerFactoryTest method testCSSClientLibraryWithRelAttributeValueDiffersFromStylesheet.
@Test
public void testCSSClientLibraryWithRelAttributeValueDiffersFromStylesheet() throws Exception {
when(htmlLibraryManager.getLibrary(eq(LibraryType.CSS), eq(PATH))).thenReturn(htmlLibrary);
final AttributesImpl in = new AttributesImpl();
in.addAttribute("", "href", "", "CDATA", PATH + ".css");
in.addAttribute("", "type", "", "CDATA", "text/css");
in.addAttribute("", "rel", "", "CDATA", "preload");
transformer.startElement(null, "link", null, in);
ArgumentCaptor<Attributes> attributesCaptor = ArgumentCaptor.forClass(Attributes.class);
verify(handler, only()).startElement(isNull(String.class), eq("link"), isNull(String.class), attributesCaptor.capture());
assertEquals(PATH + "." + FAKE_STREAM_CHECKSUM + ".css", attributesCaptor.getValue().getValue(0));
}
use of org.xml.sax.Attributes in project acs-aem-commons by Adobe-Consulting-Services.
the class VersionedClientlibsTransformerFactoryTest method testMinifiedCSSClientLibrary.
@Test
public void testMinifiedCSSClientLibrary() throws Exception {
when(htmlLibraryManager.getLibrary(eq(LibraryType.CSS), eq(PATH))).thenReturn(htmlLibrary);
final AttributesImpl in = new AttributesImpl();
in.addAttribute("", "href", "", "CDATA", PATH + ".min.css");
in.addAttribute("", "type", "", "CDATA", "text/css");
in.addAttribute("", "rel", "", "CDATA", "stylesheet");
transformer.startElement(null, "link", null, in);
ArgumentCaptor<Attributes> attributesCaptor = ArgumentCaptor.forClass(Attributes.class);
verify(handler, only()).startElement(isNull(String.class), eq("link"), isNull(String.class), attributesCaptor.capture());
assertEquals(PATH + ".min." + FAKE_STREAM_CHECKSUM + ".css", attributesCaptor.getValue().getValue(0));
}
Aggregations