mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-05 00:34:04 +02:00
Fix tests
This commit is contained in:
parent
040fe806c8
commit
ee4ce5033a
@ -71,6 +71,8 @@ dependencies {
|
||||
antlr("org.antlr:antlr4:$antlrVersion")
|
||||
|
||||
api(project(":vim-engine"))
|
||||
|
||||
testApi("com.squareup.okhttp3:okhttp:4.10.0")
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
@ -5,7 +5,7 @@ downloadIdeaSources=true
|
||||
instrumentPluginCode=true
|
||||
version=SNAPSHOT
|
||||
javaVersion=11
|
||||
remoteRobotVersion=0.11.10
|
||||
remoteRobotVersion=0.11.15
|
||||
antlrVersion=4.10.1
|
||||
|
||||
|
||||
|
@ -32,6 +32,7 @@ import com.intellij.openapi.keymap.ex.KeymapManagerEx;
|
||||
import com.intellij.openapi.keymap.impl.DefaultKeymap;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.maddyhome.idea.vim.api.VimInjectorKt;
|
||||
import com.maddyhome.idea.vim.api.VimKeyGroup;
|
||||
@ -88,6 +89,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
||||
|
||||
private final @NotNull VimState state = new VimState();
|
||||
|
||||
public Disposable onOffDisposable;
|
||||
|
||||
VimPlugin() {
|
||||
ApplicationConfigurationMigrator.getInstance().migrate();
|
||||
}
|
||||
@ -335,6 +338,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
||||
* execution, what theoretically may cause bugs (e.g. VIM-2540)
|
||||
*/
|
||||
private void turnOnPlugin() {
|
||||
onOffDisposable = Disposer.newDisposable(this, "IdeaVimOnOffDisposer");
|
||||
|
||||
// 1) Update state
|
||||
ApplicationManager.getApplication().invokeLater(this::updateState);
|
||||
|
||||
@ -370,6 +375,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
||||
|
||||
// Unregister vim actions in command mode
|
||||
RegisterActions.unregisterActions();
|
||||
|
||||
Disposer.dispose(onOffDisposable);
|
||||
}
|
||||
|
||||
private boolean stateUpdated = false;
|
||||
|
@ -122,9 +122,9 @@ object VimListenerManager {
|
||||
VimPlugin.getOptionService().addListener(OptionConstants.guicursorName, GuicursorChangeListener)
|
||||
VimPlugin.getOptionService().addListener(OptionConstants.iskeywordName, KeywordOptionChangeListener, true)
|
||||
|
||||
EventFacade.getInstance().addEditorFactoryListener(VimEditorFactoryListener, VimPlugin.getInstance())
|
||||
EventFacade.getInstance().addEditorFactoryListener(VimEditorFactoryListener, VimPlugin.getInstance().onOffDisposable)
|
||||
|
||||
EditorFactory.getInstance().eventMulticaster.addCaretListener(VimCaretListener, VimPlugin.getInstance())
|
||||
EditorFactory.getInstance().eventMulticaster.addCaretListener(VimCaretListener, VimPlugin.getInstance().onOffDisposable)
|
||||
}
|
||||
|
||||
fun disable() {
|
||||
@ -136,8 +136,6 @@ object VimListenerManager {
|
||||
VimPlugin.getOptionService().removeListener(OptionConstants.showcmdName, ShowCmdOptionChangeListener)
|
||||
VimPlugin.getOptionService().removeListener(OptionConstants.guicursorName, GuicursorChangeListener)
|
||||
VimPlugin.getOptionService().removeListener(OptionConstants.iskeywordName, KeywordOptionChangeListener)
|
||||
|
||||
EditorFactory.getInstance().eventMulticaster.removeCaretListener(VimCaretListener)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,14 +38,18 @@ class RegisterActionsTest : VimTestCase() {
|
||||
|
||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||
fun `test action in disabled plugin`() {
|
||||
setupChecks {
|
||||
caretShape = false
|
||||
}
|
||||
val keys = injector.parser.parseKeys("jklwB") // just random keys
|
||||
val before = "I ${c}found it in a legendary land"
|
||||
val after = "I jklwB${c}found it in a legendary land"
|
||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
|
||||
VimPlugin.setEnabled(false)
|
||||
try {
|
||||
setupChecks {
|
||||
caretShape = false
|
||||
}
|
||||
val keys = injector.parser.parseKeys("jklwB") // just random keys
|
||||
val before = "I ${c}found it in a legendary land"
|
||||
val after = "I jklwB${c}found it in a legendary land"
|
||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
|
||||
VimPlugin.setEnabled(false)
|
||||
}
|
||||
} finally {
|
||||
VimPlugin.setEnabled(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,7 @@ package ui
|
||||
import com.automation.remarks.junit.VideoRule
|
||||
import com.automation.remarks.video.annotations.Video
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.fixtures.ComponentFixture
|
||||
import com.intellij.remoterobot.fixtures.ContainerFixture
|
||||
import com.intellij.remoterobot.search.locators.byXpath
|
||||
import com.intellij.remoterobot.stepsProcessing.step
|
||||
import com.intellij.remoterobot.utils.keyboard
|
||||
import org.assertj.swing.core.MouseButton
|
||||
@ -50,7 +48,6 @@ import ui.utils.tripleClickOnRight
|
||||
import ui.utils.uiTest
|
||||
import ui.utils.vimExit
|
||||
import java.awt.Point
|
||||
import java.awt.event.KeyEvent
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
@ -136,13 +133,8 @@ class UiTests {
|
||||
createNewProjectLink.click()
|
||||
dialog("New Project") {
|
||||
findText("Java").click()
|
||||
find(
|
||||
ComponentFixture::class.java,
|
||||
byXpath("//div[@class='FrameworksTree']")
|
||||
).findText("Kotlin/JVM").click()
|
||||
runJs("robot.pressAndReleaseKey(${KeyEvent.VK_SPACE})")
|
||||
button("Next").click()
|
||||
button("Finish").click()
|
||||
checkBox("Add sample code").select()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,6 @@ private fun saveFile(url: String, folder: String, name: String): File {
|
||||
return File(folder).apply {
|
||||
mkdirs()
|
||||
}.resolve(name).apply {
|
||||
writeText(response.body()?.string() ?: "")
|
||||
writeText(response.body?.string() ?: "")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user