WicketTester用于页面更新:断言语言环境更改

时间:2015-04-20 13:49:58

标签: wicket wicket-6

我正在使用AjaxLink更改站点区域设置:

@Override
public void onClick(AjaxRequestTarget target) {
    Session.get().setLocale(newLanguage.getLocale());
    // Add whole page to update instead of single components
    target.add(getPage());
}

它确实按预期工作,整个页面上的每个i18n字符串都会在保留表单内容时更新。出色。

但使用WicketTester进行测试无法解决问题。这两种方法,clickLink和executeAjaxBehavior都会触发AjaxLink,但WicketTester不检测模型值的任何更改。

@Test
public void check() {
    tester.startPage(SwitchLangPage.class);
    tester.clickLink("link", true);
    tester.assertModelValue("link:label", "English");
}

我错过了重要的事情吗?

(Wicket 6.19)

修改:Gist with a simplified panel

0 个答案:

没有答案
相关问题