Search in sources :

Example 31 with JSTestOptions

use of com.intellij.lang.javascript.JSTestOptions in project intellij-plugins by JetBrains.

the class FlexExtractSuperTest method testInheritanceFromSdk.

@JSTestOptions(JSTestOption.WithGumboSdk)
public void testInheritanceFromSdk() throws Exception {
    final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
    doTest(new PerformAction() {

        @Override
        public void performAction(final VirtualFile rootDir, final VirtualFile rootAfter) throws Exception {
            FlexTestUtils.modifyConfigs(myProject, editor -> {
                ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
                bc1.setName("1");
                FlexTestUtils.setSdk(bc1, sdk);
            });
            FlexExtractSuperTest.this.performAction(false, "skins.MyNewSkin1", "skins.IMySkin", DocCommentPolicy.COPY, JSExtractSuperProcessor.Mode.ExtractSuperTurnRefs, new String[] { "updateDisplayList" }, ArrayUtil.EMPTY_STRING_ARRAY);
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsRootAccess(com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess) VfsUtilCore.urlToPath(com.intellij.openapi.vfs.VfsUtilCore.urlToPath) ArrayUtil(com.intellij.util.ArrayUtil) JSExtractSuperProcessor(com.intellij.lang.javascript.refactoring.extractSuper.JSExtractSuperProcessor) JSTestOption(com.intellij.lang.javascript.JSTestOption) FlexModuleType(com.intellij.lang.javascript.flex.FlexModuleType) VirtualFile(com.intellij.openapi.vfs.VirtualFile) JSMemberInfo(com.intellij.lang.javascript.refactoring.util.JSMemberInfo) DocCommentPolicy(com.intellij.refactoring.util.DocCommentPolicy) Computable(com.intellij.openapi.util.Computable) ActionScriptCreateClassOrInterfaceFix(com.intellij.lang.javascript.validation.fixes.ActionScriptCreateClassOrInterfaceFix) BaseRefactoringProcessor(com.intellij.refactoring.BaseRefactoringProcessor) ActionManager(com.intellij.openapi.actionSystem.ActionManager) LinkedHashMap(java.util.LinkedHashMap) FlexStylesIndexableSetContributor(com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor) Map(java.util.Map) PsiElement(com.intellij.psi.PsiElement) WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) Conditions(com.intellij.openapi.util.Conditions) ModuleType(com.intellij.openapi.module.ModuleType) FlexTestUtils(com.intellij.flex.util.FlexTestUtils) DataManager(com.intellij.ide.DataManager) StringUtil(com.intellij.openapi.util.text.StringUtil) MultiFileTestCase(com.intellij.refactoring.MultiFileTestCase) FlexSchemaHandler(com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) AnAction(com.intellij.openapi.actionSystem.AnAction) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) Sdk(com.intellij.openapi.projectRoots.Sdk) TestActionEvent(com.intellij.testFramework.TestActionEvent) List(java.util.List) JSTestUtils(com.intellij.lang.javascript.JSTestUtils) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) VfsUtilCore.convertFromUrl(com.intellij.openapi.vfs.VfsUtilCore.convertFromUrl) JSTestOptions(com.intellij.lang.javascript.JSTestOptions) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) PsiDirectory(com.intellij.psi.PsiDirectory) NotNull(org.jetbrains.annotations.NotNull) PostprocessReformattingAspect(com.intellij.psi.impl.source.PostprocessReformattingAspect) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 32 with JSTestOptions

use of com.intellij.lang.javascript.JSTestOptions in project intellij-plugins by JetBrains.

the class FlexCssNavigationTest method testCssStyleReference2.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testCssStyleReference2() throws Exception {
    PsiElement[] elements = findTargetElements(getTestName(false) + ".css");
    boolean flag = false;
    for (PsiElement element : elements) {
        if (element instanceof CssSelectorSuffix) {
            flag = true;
        }
    }
    assertTrue(flag);
}
Also used : CssSelectorSuffix(com.intellij.psi.css.CssSelectorSuffix) PsiElement(com.intellij.psi.PsiElement) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 33 with JSTestOptions

use of com.intellij.lang.javascript.JSTestOptions in project intellij-plugins by JetBrains.

the class ActionScriptCompletionInTextFieldTest method testMoveMembersTargetClass.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testMoveMembersTargetClass() throws Exception {
    configureByFiles(null, BASE_PATH + getTestName(false) + "_2.js2");
    PsiFile fragment = ActionScriptMoveMembersDialog.createTargetClassField(myProject, "", ActionScriptMoveMembersDialog.getScope(myProject), myFile).getPsiFile();
    String[] included = new String[] { "Z111", "Z222" };
    String[] excluded = new String[] { "EventDispatcher", "int", "String", "uint", "Number", "public", "function", "while" };
    checkTextFieldCompletion((JSExpressionCodeFragment) fragment, included, excluded, "Z222", BASE_PATH + getTestName(false) + ".txt");
}
Also used : PsiFile(com.intellij.psi.PsiFile) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 34 with JSTestOptions

use of com.intellij.lang.javascript.JSTestOptions in project intellij-plugins by JetBrains.

the class ActionScriptCompletionInTextFieldTest method testIntroduceConstantTargetClass.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testIntroduceConstantTargetClass() throws Exception {
    configureByFiles(null, BASE_PATH + getTestName(false) + "_2.js2");
    // scope calculated same way as in constructor of JSIntroduceConstantDialog
    Module module = ModuleUtilCore.findModuleForPsiElement(myFile);
    GlobalSearchScope targetClassScope = module != null ? GlobalSearchScope.moduleWithDependenciesScope(module) : GlobalSearchScope.projectScope(myProject);
    PsiFile fragment = JSIntroduceConstantDialog.createTargetClassField(myProject, "", targetClassScope).getPsiFile();
    String[] included = new String[] { "Z111", "Z222", "com" };
    String[] excluded = new String[] { "EventDispatcher", "int", "String", "uint", "Number", "public", "function", "while" };
    checkTextFieldCompletion((JSExpressionCodeFragment) fragment, included, excluded, "Z222", BASE_PATH + getTestName(false) + ".txt");
}
Also used : GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) PsiFile(com.intellij.psi.PsiFile) Module(com.intellij.openapi.module.Module) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 35 with JSTestOptions

use of com.intellij.lang.javascript.JSTestOptions in project intellij-plugins by JetBrains.

the class ActionScriptCompletionInTextFieldTest method testComponentFromIndependentModule.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testComponentFromIndependentModule() throws Exception {
    final Module module2 = doCreateRealModule("module2");
    final VirtualFile contentRoot = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + "_module2");
    PsiTestUtil.addSourceRoot(module2, contentRoot);
    configureByFiles(null, BASE_PATH + getTestName(false) + "_2.mxml");
    PsiFile fragment = JSReferenceEditor.forClassName("", myProject, null, GlobalSearchScope.moduleScope(myModule), null, null, "").getPsiFile();
    checkTextFieldCompletion((JSExpressionCodeFragment) fragment, new String[] { "ComponentFromIndependentModule_2" }, new String[] { "C1" }, null, BASE_PATH + getTestName(false) + ".txt");
    fragment = JSReferenceEditor.forClassName("", myProject, null, GlobalSearchScope.moduleScope(module2), null, null, "").getPsiFile();
    checkTextFieldCompletion((JSExpressionCodeFragment) fragment, new String[] { "C1" }, new String[] { "ComponentFromIndependentModule_2" }, null, BASE_PATH + getTestName(false) + ".txt");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFile(com.intellij.psi.PsiFile) Module(com.intellij.openapi.module.Module) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Aggregations

JSTestOptions (com.intellij.lang.javascript.JSTestOptions)59 VirtualFile (com.intellij.openapi.vfs.VirtualFile)20 PsiFile (com.intellij.psi.PsiFile)12 PsiElement (com.intellij.psi.PsiElement)11 JSExpressionCodeFragment (com.intellij.lang.javascript.psi.JSExpressionCodeFragment)5 File (java.io.File)5 CssDocumentationProvider (com.intellij.psi.css.impl.util.CssDocumentationProvider)4 THashMap (gnu.trove.THashMap)4 GutterMark (com.intellij.codeInsight.daemon.GutterMark)3 FlexDocumentationProvider (com.intellij.javascript.flex.FlexDocumentationProvider)3 DocumentationProvider (com.intellij.lang.documentation.DocumentationProvider)3 JSDocumentationProvider (com.intellij.lang.javascript.documentation.JSDocumentationProvider)3 JSCodeStyleSettings (com.intellij.lang.javascript.formatter.JSCodeStyleSettings)3 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)3 Sdk (com.intellij.openapi.projectRoots.Sdk)3 SdkModificator (com.intellij.openapi.projectRoots.SdkModificator)3 LookupElement (com.intellij.codeInsight.lookup.LookupElement)2 RunManager (com.intellij.execution.RunManager)2 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)2 ECMA4CodeStyleSettings (com.intellij.lang.javascript.formatter.ECMA4CodeStyleSettings)2