Search in sources :

Example 1 with JSTestOptions

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

the class FlexCompletionTest method testNonApplicableInheritors.

@JSTestOptions({ JSTestOption.WithGumboSdk, JSTestOption.WithFlexLib, JSTestOption.WithSmartCompletion })
public void testNonApplicableInheritors() throws Exception {
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        final ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        final ModifiableFlexBuildConfiguration bc2 = editor.copyConfiguration(bc1, BuildConfigurationNature.DEFAULT);
        bc2.setName("bc 2");
        bc2.getDependencies().getModifiableEntries().clear();
    });
    LookupElement[] elements = doTest("", "as");
    assertEquals(3, elements.length);
    assertEquals("Image", elements[0].getLookupString());
    assertEquals("Base64Image", elements[1].getLookupString());
    assertEquals("ImageMap", elements[2].getLookupString());
    final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(myModule);
    manager.setActiveBuildConfiguration(manager.findConfigurationByName("bc 2"));
    elements = doTest("", "as");
    assertEquals(1, elements.length);
    assertEquals("Image", elements[0].getLookupString());
}
Also used : FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) LookupElement(com.intellij.codeInsight.lookup.LookupElement) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 2 with JSTestOptions

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

the class FlexDocumentationTest method testFlexCssSelectorMultiDocumentationInLookup.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testFlexCssSelectorMultiDocumentationInLookup() throws Exception {
    myAfterCommitRunnable = () -> FlexTestUtils.addLibrary(myModule, "TestLib", getTestDataPath() + BASE_PATH, "MyLib1.swc", "MyLib1_src.zip", null);
    String doc = testOne(new CssDocumentationProvider(), getTestName(false) + ".css");
    assertTrue(doc.indexOf("p1.MyClass") >= 0);
    assertTrue(doc.indexOf("p2.MyClass") >= 0);
}
Also used : CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 3 with JSTestOptions

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

the class FlexCompletionTest method testIgnoreClassesFromOnlySdkSources.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testIgnoreClassesFromOnlySdkSources() throws Exception {
    final String testName = getTestName(false);
    final VirtualFile srcFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + "_sdk_src/");
    final Sdk flexSdk = FlexUtils.getSdkForActiveBC(myModule);
    final SdkModificator modificator = flexSdk.getSdkModificator();
    modificator.addRoot(srcFile, OrderRootType.SOURCES);
    modificator.commitChanges();
    assertNull(doTest("_1", MXML_EXTENSION));
    assertNull(doTest("_2", MXML_EXTENSION));
    assertNull(doTest("_3", MXML_EXTENSION));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Sdk(com.intellij.openapi.projectRoots.Sdk) SdkModificator(com.intellij.openapi.projectRoots.SdkModificator) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 4 with JSTestOptions

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

the class FlexCompletionTest method testCompletionInMxml8.

@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexFacet })
public final void testCompletionInMxml8() throws Exception {
    LookupElement[] items = doTest("", MXML_EXTENSION);
    assertNotNull(items);
    assertTrue(items.length < 50);
    doTest("_3", MXML_EXTENSION);
    items = doTest("_2", MXML_EXTENSION);
    assertNotNull(items);
    for (LookupElement li : items) {
        assertTrue(!li.getLookupString().equals("arity"));
    }
}
Also used : LookupElement(com.intellij.codeInsight.lookup.LookupElement) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 5 with JSTestOptions

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

the class FlexDocumentationTest method testMxmlDoc5.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testMxmlDoc5() throws Exception {
    PsiElement element = getDocElementForLookupItem(new CssDocumentationProvider(), getTestName(false) + ".mxml");
    assertNull(element);
}
Also used : PsiElement(com.intellij.psi.PsiElement) CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) 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