IDEA-86299 Support for geb

- add completion/resolving for members of TestNG tests
This commit is contained in:
Alexander Zolotov
2013-08-19 16:49:21 +04:00
parent acd9ec720e
commit 1fa6eba515
4 changed files with 58 additions and 0 deletions
+1
View File
@@ -97,6 +97,7 @@
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebModuleMemberContributor"/>
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebJUnitTestMemberContributor"/>
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebTestNGTestMemberContributor"/>
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebBrowserMemberContributor"/>
<membersContributor implementation="org.jetbrains.plugins.groovy.gant.GantMemberContributor"/>
@@ -0,0 +1,45 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.geb;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiType;
import com.intellij.psi.ResolveState;
import com.intellij.psi.scope.PsiScopeProcessor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
/**
* @author zolotov
*/
public class GebTestNGTestMemberContributor extends NonCodeMembersContributor {
@Override
protected String getParentClassName() {
return "geb.testng.GebTest";
}
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
PsiClass aClass,
PsiScopeProcessor processor,
PsiElement place,
ResolveState state) {
GebUtil.contributeMembersInsideTest(processor, place, state);
}
}
@@ -43,6 +43,18 @@ class FooTest extends geb.junit4.GebReportingTest {
<caret>
}
}
""")
TestUtils.checkCompletionContains(myFixture, "\$()", "to()", "go()", "currentWindow", "verifyAt()", "title")
}
void testTestNGTestMemberCompletion() {
myFixture.configureByText("FooTest.groovy", """
class FooTest extends geb.testng.GebReportingTest {
def testFoo() {
<caret>
}
}
""")
TestUtils.checkCompletionContains(myFixture, "\$()", "to()", "go()", "currentWindow", "verifyAt()", "title")
Binary file not shown.