Beispiel #1
0
def test_disable():
    assert getMode() == Mode.normal, "Univisal not set up for test"
    handleInput(":disable")
    assert getMode() == Mode.disabled, "Disable does not change mode"
    # TODO: Move mode tests like this to separte test.
    assert handleInput('l') == 'l', "Disabled univisal does not return normal key"
    assert handleInput(Keys.esc.value) == ("<esc>"), \
        "Disabled univisal does not return special keys"
Beispiel #2
0
def test_enable():
    handleInput(":disable")
    assert getMode() == Mode.disabled, "Disable does not change mode"
    handleInput(":enable")
    assert getMode() == Mode.normal, "Enable does not change mode to normal"
    assert handleInput('l') == Motion.right.value, "re-enabled univisal does not return motion"
Beispiel #3
0
def test_escape():
    setMode(Mode.insert)
    assert getMode() == Mode.insert
    result = handleInput(Keys.esc.value)
    assert getMode() == Mode.normal
    assert result == Keys.nop.value
Beispiel #4
0
def test_imap_esc_followup(caplog):
    imap("jk", Keys.esc.value)
    setMode(Mode.insert)
    result = translate_keys("jkl")
    assert getMode() == Mode.normal
    assert result == Motion.right.value
Beispiel #5
0
def test_init_model():
    model.init_model()
    assert model.__outputKeys == []
    assert getMode() == Mode.normal
    # Just one test to make sure clear_pending was called.
    assert not model.expecting_search_letter
Beispiel #6
0
def test_setMode(mode):
    setMode(mode)
    assert getMode() == mode