import org.junit.Test;
import org.wamblee.wicket.MyPage;
-public class JQueryBehaviorTest {
+public class JQueryHeaderContributorTest {
private WicketTester wicket;
@Before
@Test
public void testJQueryDevelopmentMode() throws Exception {
MyPage page = new MyPage();
- page.add(new JQueryBehavior());
+ page.add(new JQueryHeaderContributor());
wicket.startPage(page);
wicket.assertRenderedPage(MyPage.class);
assertTrue(wicket.getServletResponse().getDocument().contains(
- JQueryBehavior.JQUERY_DEVELOPMENT));
+ JQueryHeaderContributor.JQUERY_DEVELOPMENT));
+ //System.out.println(wicket.getServletResponse().getDocument());
}
@Test
public void testJQueryDeploymentMode() throws Exception {
wicket.destroy();
- JQueryBehavior.clear();
+ JQueryHeaderContributor.clear();
wicket = new WicketTester(new DummyWebApplication() {
@Override
public String getConfigurationType() {
}
});
MyPage page = new MyPage();
- page.add(new JQueryBehavior());
+ page.add(new JQueryHeaderContributor());
wicket.startPage(page);
wicket.assertRenderedPage(MyPage.class);
assertTrue(wicket.getServletResponse().getDocument().contains(
- JQueryBehavior.JQUERY_DEPLOYMENT));
+ JQueryHeaderContributor.JQUERY_DEPLOYMENT));
}
}
public void testCreateReadyJavascript() {
Component component = new Label("label");
component.setOutputMarkupId(true);
- String readyHandler = JQueryUtils.createReadyFunction("myfunc", component);
- assertEquals("$(function(){org.wamblee.myfunc(\"#" + component.getMarkupId() + "\");});", readyHandler);
+ String readyHandler = AbstractJQueryBehavior.createReadyFunction("myfunc", component);
+ assertEquals("jQuery(function(){org.wamblee.myfunc(\"#" + component.getMarkupId() + "\");});", readyHandler);
}
@Test(expected = IllegalStateException.class)
public void testCreateReadyJavascriptNoMarkupId() {
Component component = new Label("label");
- String readyHandler = JQueryUtils.createReadyFunction("myfunc", component);
+ String readyHandler = AbstractJQueryBehavior.createReadyFunction("myfunc", component);
}
}