use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class ResourceAggregatorTest method assertItems.
private void assertItems(ResourceReference... references) {
List<HeaderItem> items = new ArrayList<HeaderItem>();
for (ResourceReference curReference : references) items.add(forReference(curReference));
assertItems(items);
}
use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class ResourceAggregatorTest method testTwoBundlesWithDependenciesAndPriority.
/**
* bundle {a, b->a} and {c->a, d->c->a}, render [priority(b), d], should render [priority(ab),
* cd]
*/
@Test
public void testTwoBundlesWithDependenciesAndPriority() {
HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
HeaderItem bundleCD = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "cd.js", new ResourceReferenceC(), new ResourceReferenceD());
aggregator.render(new PriorityHeaderItem(forReference(new ResourceReferenceB())));
aggregator.render(forReference(new ResourceReferenceD()));
assertItems(new PriorityHeaderItem(bundleAB), bundleCD);
}
use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class ResourceAggregatorTest method testTwoResourcesWithBundleAsDependency.
/**
* bundle {bun1 -> x, bun2 -> y}, render [bun1], should render [x, y, bun12]
*/
@Test
public void testTwoResourcesWithBundleAsDependency() {
HeaderItem bundle12 = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "bun12.js", new ResourceReferenceBun1(), new ResourceReferenceBun2());
aggregator.render(forReference(new ResourceReferenceBun1()));
assertItems(forReference(new ResourceReferenceX()), forReference(new ResourceReferenceY()), bundle12);
}
use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class ResourceAggregatorTest method testBundleWithDependencies.
/**
* bundle {c->a, d->c->a}, render [d], should render [a, cd]
*/
@Test
public void testBundleWithDependencies() {
HeaderItem bundleCD = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "cd.js", new ResourceReferenceC(), new ResourceReferenceD());
aggregator.render(forReference(new ResourceReferenceD()));
assertItems(forReference(new ResourceReferenceA()), bundleCD);
}
use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class ResourceAggregatorTest method testTwoBundlesWithDependencies.
/**
* bundle {a, b->a} and {c->a, d->c->a}, render [d], should render [ab, cd]
*/
@Test
public void testTwoBundlesWithDependencies() {
HeaderItem bundleAB = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "ab.js", new ResourceReferenceA(), new ResourceReferenceB());
HeaderItem bundleCD = Application.get().getResourceBundles().addJavaScriptBundle(Application.class, "cd.js", new ResourceReferenceC(), new ResourceReferenceD());
aggregator.render(forReference(new ResourceReferenceD()));
assertItems(bundleAB, bundleCD);
}
Aggregations