Created
November 21, 2012 07:11
-
-
Save lfryc/4123535 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RunAsClient | |
| @WarpTest | |
| @RunWith(Arquillian.class) | |
| public class TestFocusValidationAware { | |
| ... | |
| @Test | |
| public void testGlobalMessageIsIgnored() { | |
| Warp | |
| .given(new Activity() { | |
| public void do() { | |
| guardHttp(submitButton).click(); | |
| } | |
| }) | |
| .when(JsfViewFilter.class) | |
| .then(new Inspect() { | |
| @BeforePhase(Phase.RENDER_RESPONSE) | |
| public void addGlobalMessage() { | |
| FacesContext context = FacesContext.getCurrentInstance(); | |
| context.addMessage(null, new FacesMessage("global message")); | |
| } | |
| @AfterPhase(Phase.RENDER_RESPONSE) | |
| public void verifyGlobalMessageIsIgnored() { | |
| FacesContext context = FacesContext.getCurrentInstance(); | |
| AbstractFocus component = bean.getComponent(); | |
| FocusRendererBase renderer = bean.getRenderer(); | |
| String candidates = renderer.getFocusCandidatesAsString(context, component); | |
| assertEquals("form", candidates); | |
| } | |
| }); | |
| assertEquals(input3, getFocusedElement()); | |
| } | |
| @Test | |
| public void testGlobalMessageIsIgnored_alternativeSyntax() { | |
| Warp.given(submitButton).click(); | |
| Warp.when(JsfViewFilter.class); | |
| Warp.then(new Inspect() { | |
| @BeforePhase(Phase.RENDER_RESPONSE) | |
| public void addGlobalMessage() { | |
| FacesContext context = FacesContext.getCurrentInstance(); | |
| context.addMessage(null, new FacesMessage("global message")); | |
| } | |
| @AfterPhase(Phase.RENDER_RESPONSE) | |
| public void verifyGlobalMessageIsIgnored() { | |
| FacesContext context = FacesContext.getCurrentInstance(); | |
| AbstractFocus component = bean.getComponent(); | |
| FocusRendererBase renderer = bean.getRenderer(); | |
| String candidates = renderer.getFocusCandidatesAsString(context, component); | |
| assertEquals("form", candidates); | |
| } | |
| }); | |
| assertEquals(input3, getFocusedElement()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment