Created
November 10, 2014 11:26
-
-
Save oddbjornkvalsund/aa6864986323440af804 to your computer and use it in GitHub Desktop.
This file contains 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
package focusbug; | |
import javafx.scene.Parent; | |
import javafx.scene.control.TextField; | |
import org.junit.Test; | |
import org.loadui.testfx.GuiTest; | |
import static org.hamcrest.Matchers.is; | |
import static org.loadui.testfx.Assertions.verifyThat; | |
public class FocusBugTest extends GuiTest { | |
@Override | |
protected Parent getRootNode() { | |
return new FocusBug().getRootNode(); | |
} | |
@Test | |
public void testPopup() { | |
final TextField mainTextField = find("#mainTextField"); | |
focusEnterTextAndVerifyText(mainTextField); | |
click("#clickMeButton"); | |
target(findStageByTitle("Popup")); | |
final TextField popupTextField = find("#popupTextField"); | |
focusEnterTextAndVerifyText(popupTextField); | |
} | |
private void focusEnterTextAndVerifyText(TextField textField) { | |
textField.requestFocus(); | |
verifyThat(textField.isFocused(), is(true)); | |
type("Hello"); | |
verifyThat(textField.getText(), is("Hello")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment