diff --git a/src/test/java/seedu/address/ui/CommandBoxUiTest.java b/src/test/java/seedu/address/ui/CommandBoxUiTest.java index 14e31d6bdf4..023faf31e0b 100644 --- a/src/test/java/seedu/address/ui/CommandBoxUiTest.java +++ b/src/test/java/seedu/address/ui/CommandBoxUiTest.java @@ -2,6 +2,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static seedu.address.ui.CommandBox.ERROR_STYLE_CLASS; import java.util.ArrayList; import java.util.Arrays; @@ -73,4 +75,15 @@ public void commandNavigationWorks_success() { robot.type(KeyCode.DOWN); } } + @Test + public void setStyleToIndicateCommandFailure_addsErrorStyleClass() { + FxRobot robot = new FxRobot(); + + assertNotNull(robot.lookup("#commandTextField"), "Command box should be present."); + robot.clickOn("#commandTextField"); + robot.write("UNKNOWN COMMMAND"); + robot.type(KeyCode.ENTER); + assertTrue(robot.lookup("#commandTextField").query().getStyleClass().contains(ERROR_STYLE_CLASS)); + } + }