mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[structuralsearch] Update TemplatesCompletionTest.kt
- Using typeText instead of tailText - Not testing same name templates anymore GitOrigin-RevId: 1417be42839b1628b6027b2110d3d15b7edb0f1b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8584cfdde1
commit
a9d6e08ff5
+11
-12
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.structuralsearch.plugin.ui
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.structuralsearch.PredefinedConfigurationUtil
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
|
||||
class TemplatesCompletionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
|
||||
@@ -13,21 +13,20 @@ class TemplatesCompletionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
myFixture.editor.putUserData(StructuralSearchDialog.TEST_STRUCTURAL_SEARCH_DIALOG, true)
|
||||
}
|
||||
|
||||
fun renderedLookupElementTexts(): Collection<String> {
|
||||
return myFixture.completeBasic()
|
||||
private val renderedLookupElementTexts: Collection<Pair<String, String>>
|
||||
get() = myFixture.completeBasic()
|
||||
.map { LookupElementPresentation.renderElement(it) }
|
||||
.map { it.itemText + it.tailText }
|
||||
}
|
||||
.map { "${it.itemText}" to "${it.typeText}" }
|
||||
|
||||
fun testSameName() {
|
||||
fun testCompletion() {
|
||||
prepare("all fields of<caret>")
|
||||
val customTemplate = PredefinedConfigurationUtil.createSearchTemplateInfo("all fields of a class", "",
|
||||
"", JavaFileType.INSTANCE)
|
||||
val customTemplate = PredefinedConfigurationUtil.createConfiguration("all fields of a class bis", "",
|
||||
"", "", JavaFileType.INSTANCE)
|
||||
customTemplate.isPredefined = false
|
||||
ConfigurationManager.getInstance(project).addConfiguration(customTemplate)
|
||||
val elements = renderedLookupElementTexts()
|
||||
assert("all fields of a class(java search template)" in elements)
|
||||
assert("all fields of a class(java search template, user defined)" in elements)
|
||||
val elements = renderedLookupElementTexts
|
||||
assert("All fields of a class" to "Java search template" in elements) // Predefined legacy Java configuration
|
||||
assert("all fields of a class bis" to "Java search template, user defined" in elements) // Newly created configuration
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user