Search in sources :

Example 6 with HeaderItem

use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.

the class ResourceAggregatorTest method testBundleWithPriority.

/**
 * bundle {a, b -> a}, render [x, priority(a)], should render [priority(ab), x]
 */
@Test
public void testBundleWithPriority() {
    HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
    aggregator.render(forReference(new ResourceReferenceX()));
    aggregator.render(new PriorityHeaderItem(forReference(new ResourceReferenceA())));
    assertItems(new PriorityHeaderItem(bundleAB), forReference(new ResourceReferenceX()));
}
Also used : PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) HeaderItem(org.apache.wicket.markup.head.HeaderItem) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) Test(org.junit.Test)

Example 7 with HeaderItem

use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.

the class ResourceAggregatorTest method testBundleRenderedAsDependency.

/**
 * bundle {a, b->a}, render [d->c->a], should render [ab, c, d]
 */
@Test
public void testBundleRenderedAsDependency() {
    HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
    aggregator.render(forReference(new ResourceReferenceD()));
    assertItems(bundleAB, forReference(new ResourceReferenceC()), forReference(new ResourceReferenceD()));
}
Also used : HeaderItem(org.apache.wicket.markup.head.HeaderItem) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) Test(org.junit.Test)

Example 8 with HeaderItem

use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.

the class ResourceAggregatorTest method testBundle.

/**
 * bundle {a, b->a}, render [a], should render [ab]
 */
@Test
public void testBundle() {
    HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
    aggregator.render(forReference(new ResourceReferenceA()));
    assertItems(bundleAB);
}
Also used : HeaderItem(org.apache.wicket.markup.head.HeaderItem) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) Test(org.junit.Test)

Example 9 with HeaderItem

use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.

the class ResourceAggregatorTest method testBundleRenderingOther.

/**
 * bundle {a, b->a}, render [b], should render [ab]
 */
@Test
public void testBundleRenderingOther() {
    HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
    aggregator.render(forReference(new ResourceReferenceB()));
    assertItems(bundleAB);
}
Also used : HeaderItem(org.apache.wicket.markup.head.HeaderItem) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) Test(org.junit.Test)

Example 10 with HeaderItem

use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.

the class ResourceAggregatorTest method testBundleRenderingBoth.

/**
 * bundle {a, b->a}, render [a, b], should render [ab]
 */
@Test
public void testBundleRenderingBoth() {
    HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
    aggregator.render(forReference(new ResourceReferenceA()));
    aggregator.render(forReference(new ResourceReferenceB()));
    assertItems(bundleAB);
}
Also used : HeaderItem(org.apache.wicket.markup.head.HeaderItem) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) Test(org.junit.Test)

Aggregations

HeaderItem (org.apache.wicket.markup.head.HeaderItem)22 PriorityHeaderItem (org.apache.wicket.markup.head.PriorityHeaderItem)10 Test (org.junit.Test)10 JavaScriptHeaderItem (org.apache.wicket.markup.head.JavaScriptHeaderItem)7 JavaScriptResourceReference (org.apache.wicket.request.resource.JavaScriptResourceReference)6 ResourceReference (org.apache.wicket.request.resource.ResourceReference)5 ArrayList (java.util.ArrayList)4 LinkedHashSet (java.util.LinkedHashSet)2 CssHeaderItem (org.apache.wicket.markup.head.CssHeaderItem)2 IHeaderResponse (org.apache.wicket.markup.head.IHeaderResponse)2 WicketAjaxJQueryResourceReference (org.apache.wicket.ajax.WicketAjaxJQueryResourceReference)1 IReferenceHeaderItem (org.apache.wicket.markup.head.IReferenceHeaderItem)1 IWrappedHeaderItem (org.apache.wicket.markup.head.IWrappedHeaderItem)1 JavaScriptReferenceHeaderItem (org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem)1 ResourceAggregator (org.apache.wicket.markup.head.ResourceAggregator)1 HeaderResponse (org.apache.wicket.markup.head.internal.HeaderResponse)1 DecoratingHeaderResponse (org.apache.wicket.markup.html.DecoratingHeaderResponse)1 XmlPullParser (org.apache.wicket.markup.parser.XmlPullParser)1 XmlTag (org.apache.wicket.markup.parser.XmlTag)1 PackageResourceReference (org.apache.wicket.request.resource.PackageResourceReference)1