package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import javafx.scene.input.KeyCode;

//@@author A0147980U
public class ContentAssistTests extends DoistGUITest {
    GuiRobot bot = new GuiRobot();
    @Test
    public void testCorrectSuggestionsDisplayed() {
        correctSuggestionsDisplayedWhenEnter("f", "f");
    }

    @Test
    public void testCorrectSuggestionsDisplayedWithCompleteCommandWord() {
        correctSuggestionsDisplayedWhenEnter("fin", "fin");
    }

    @Test
    public void testCorrectSingleSuggestionsDisplayedWithCompleteCommandWord() {
        correctSuggestionsDisplayedWhenEnter("find", "find");
    }

    @Test
    public void testNoSuggestionsDisplayedBecuaseOfSpace() {
        correctSuggestionsDisplayedWhenEnter("find ", "find");
    }

    @Test
    public void testNoSuggestionsDisplayedBecuaseOfNoMatch() {
        correctSuggestionsDisplayedWhenEnter("no suggesion will match me", "me");
    }

    @Test
    public void testSuggestionOnCorrectParameterKey() {
        correctSuggestionsDisplayedWhenEnter("do task \\fro", "\\fro");
    }

    @Test
    public void testSuggestionOnIncorrectParameterKey() {
        correctSuggestionsDisplayedWhenEnter("do task \\incorrect_key", "\\incorrect_key");
    }

    @Test
    public void testCompleteByTappingTap() {
        String input = "view_alia";
        commandBox.enterCommand(input);
        bot.type(KeyCode.TAB);
        assertTrue("view_alias".equals(commandBox.getCommandInput()));
    }

    @Test
    public void testCompleteKeyByTappingTap() {
        String input = "do task \\unde";
        commandBox.enterCommand(input);
        bot.type(KeyCode.TAB);
        assertTrue("do task \\under".equals(commandBox.getCommandInput()));
    }

    private void correctSuggestionsDisplayedWhenEnter(String input, String lastWord) {
        commandBox.enterCommand(input);
        assertCorrectSuggestions(lastWord);
    }
}






@@ -1320,33 +1320,33 @@
 pleteByTappingTa
-p
+b
 () %7B%0A        Str
@@ -1571,17 +1571,17 @@
 appingTa
-p
+b
 () %7B%0A   

fix typo