WicketTester how to get html output for a component?

I want to check if this component has a set of CSS classes. To do this, I would like to get HTML output only for this particular component.

WicketTester can provide HTML output for the entire page displayed. What is the best way to get only component HTML / String?

+6
source share
1 answer

To do this, I would like to get HTML output for this particular component.

Instead of making your statements in HTML output, you can use TagTester to test CSS classes as follows:

WicketTester tester = new WicketTester(new WicketApplication()); tester.startPage(MyPage.class); TagTester tagTester = tester.getTagByWicketId("myWicketComponent"); Assert.assertEquals("classA classB", tagTester.getAttribute("class")); 

Try it if it works for you.

+8
source

Source: https://habr.com/ru/post/948693/


All Articles