Search in sources :

Example 41 with JSTestOptions

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

the class FlexNavigationTest method testMonkeyPatching.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testMonkeyPatching() throws Exception {
    final String testName = getTestName(false);
    myAfterCommitRunnable = () -> {
        final VirtualFile sdkSrc = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + BASE_PATH + testName + "_sdk_src");
        final SdkModificator sdkModificator = FlexTestUtils.getFlexSdkModificator(myModule);
        sdkModificator.addRoot(sdkSrc, OrderRootType.SOURCES);
        sdkModificator.commitChanges();
    };
    configureByFiles(BASE_PATH + testName, BASE_PATH + testName + "/" + testName + ".as", BASE_PATH + testName + "/mx/events/FlexEvent.as");
    final VirtualFile expectedFile = LocalFileSystem.getInstance().findFileByPath(ModuleRootManager.getInstance(myModule).getSourceRoots()[0].getPath() + "/mx/events/FlexEvent.as");
    assert expectedFile != null;
    final PsiReference reference = TargetElementUtil.findReference(myEditor);
    assertNotNull(reference);
    final Collection<PsiElement> candidates = TargetElementUtil.getInstance().getTargetCandidates(reference);
    assertEquals(1, candidates.size());
    doCheck(candidates.iterator().next(), expectedFile, expectedFile, null);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SdkModificator(com.intellij.openapi.projectRoots.SdkModificator) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 42 with JSTestOptions

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

the class FlexNavigationTest method testLibraryClass2.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testLibraryClass2() throws Exception {
    final String libWithAsDocSwc = "TestLib3.swc";
    myAfterCommitRunnable = () -> {
        FlexTestUtils.addLibrary(myModule, "Lib", getTestDataPath() + BASE_PATH, "TestLib1.swc", null, null);
        FlexTestUtils.addLibrary(myModule, "LibWithAsdoc", getTestDataPath() + BASE_PATH, libWithAsDocSwc, null, "TestLibAsdoc.zip");
    };
    final VirtualFile forAsdoc = getFile(libWithAsDocSwc + "!/library.swf");
    doTest("LibraryClass.as", null, forAsdoc);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 43 with JSTestOptions

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

the class FlexNavigationTest method testIncludes.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testIncludes() throws Exception {
    VirtualFile vFile = configureByFiles(null, BASE_PATH + "Includes.css", BASE_PATH + "Includes.as", BASE_PATH + "Includes1.as");
    VirtualFile file = vFile.getParent().findChild("Includes1.as");
    doTest(file, file, null);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 44 with JSTestOptions

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

the class FlexDocumentationTest method testExternalDoc1.

@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk })
public void testExternalDoc1() throws Exception {
    String fullName = BASE_PATH + getTestName(false);
    final String[] files = { fullName + ".mxml" };
    VirtualFile swc = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + BASE_PATH + "CustomSdk.swc");
    swc = JarFileSystem.getInstance().getJarRootForLocalFile(swc);
    VirtualFile asdoc = HttpFileSystem.getInstance().findFileByPath("livedocs.adobe.com/flex/3/langref");
    FlexTestUtils.setupCustomSdk(myModule, swc, null, asdoc);
    doTest(files, getTestName(false), false, Check.Url);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 45 with JSTestOptions

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

the class FlexDocumentationTest method testFlexCssSelector.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testFlexCssSelector() throws Exception {
    DocumentationProvider cssDocumentationProvider = new CssDocumentationProvider();
    PsiElement docElement = getDocElementForLookupItem(cssDocumentationProvider, getTestName(false) + ".css");
    assertInstanceOf(docElement, JSClass.class);
}
Also used : PsiElement(com.intellij.psi.PsiElement) CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) FlexDocumentationProvider(com.intellij.javascript.flex.FlexDocumentationProvider) DocumentationProvider(com.intellij.lang.documentation.DocumentationProvider) JSDocumentationProvider(com.intellij.lang.javascript.documentation.JSDocumentationProvider) 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