Search in sources :

Example 21 with JSTestOptions

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

the class ActionScriptResolveTest method testResolve26.

@JSTestOptions({ JSTestOption.WithIndex })
public void testResolve26() throws Exception {
    String fileText = "dynamic class Object {}\n" + "package {\n" + "\timport flash.display.Sprite;\n" + "\tpublic class DoubleInterfaceResolve extends Sprite {\n" + "\t}\n" + "}\n" + "import flash.display.Sprite;\n" + "class FooView extends Sprite {\n" + "}\n" + "\n" + "interface ItfA {\n" + "    function f():It<ref>fB;\n" + "}\n" + "interface ItfB {}";
    PsiReference ref = configureByFileText(fileText, "sample.js2");
    PsiElement resolved = ref.resolve();
    assertTrue(resolved instanceof JSClass);
}
Also used : PsiReference(com.intellij.psi.PsiReference) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) PsiElement(com.intellij.psi.PsiElement) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 22 with JSTestOptions

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

the class SwfHighlightingTest method testLineMarkersInSwf.

@JSTestOptions({ JSTestOption.WithFlexFacet, JSTestOption.WithLineMarkers })
public void testLineMarkersInSwf() throws Exception {
    final String testName = getTestName(false);
    myAfterCommitRunnable = () -> FlexTestUtils.addLibrary(myModule, "lib", getTestDataPath() + getBasePath() + "/", testName + ".swc", null, null);
    // actual test data is in library.swf; this file is here just because we need any file
    configureByFile("/" + testName + ".as");
    VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + ".swc");
    vFile = JarFileSystem.getInstance().getJarRootForLocalFile(vFile).findChild("library.swf");
    myEditor = FileEditorManager.getInstance(myProject).openTextEditor(new OpenFileDescriptor(myProject, vFile, 0), false);
    PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
    myFile = myPsiManager.findFile(vFile);
    ((EditorImpl) myEditor).setCaretActive();
    vFile = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getBasePath() + "/" + testName + ".as");
    final String verificationText = StreamUtil.convertSeparators(VfsUtilCore.loadText(vFile));
    checkHighlighting(new ExpectedHighlightingData(new DocumentImpl(verificationText), false, false, true, myFile));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ExpectedHighlightingData(com.intellij.testFramework.ExpectedHighlightingData) EditorImpl(com.intellij.openapi.editor.impl.EditorImpl) OpenFileDescriptor(com.intellij.openapi.fileEditor.OpenFileDescriptor) DocumentImpl(com.intellij.openapi.editor.impl.DocumentImpl) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 23 with JSTestOptions

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

the class FlexAutoImportsTest method testWrapImportStatement.

@JSTestOptions({ JSTestOption.WithFlexSdk })
public void testWrapImportStatement() throws Throwable {
    CodeStyleSettings currentSettings = CodeStyleSettingsManager.getSettings(myFixture.getProject());
    int m = currentSettings.getDefaultRightMargin();
    currentSettings.setDefaultRightMargin(20);
    try {
        JSTestUtils.addClassesToProject(myFixture, true, "wwwwww.wwwwwwwwwwwww.wwwwwwwww.Wwwwwwwwwwwwwwwwwwww");
        launchImportIntention(AS_FILE_EXTENSION, "wwwwww.wwwwwwwwwwwww.wwwwwwwww.Wwwwwwwwwwwwwwwwwwww");
    } finally {
        currentSettings.setDefaultRightMargin(m);
    }
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 24 with JSTestOptions

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

the class FlexOptimizeImportsTest method testAmbiguous3.

@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk })
public void testAmbiguous3() throws Throwable {
    final CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(getProject());
    XmlCodeStyleSettings xmlSettings = styleSettings.getCustomSettings(XmlCodeStyleSettings.class);
    int aroundCDataBefore = xmlSettings.XML_WHITE_SPACE_AROUND_CDATA;
    xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = XmlCodeStyleSettings.WS_AROUND_CDATA_NEW_LINES;
    JSTestUtils.addClassesToProject(myFixture, true, "com.a.ClassB", "com.b.ClassB");
    runOptimizeAction(MXML_FILE_EXTENSION);
    xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = aroundCDataBefore;
}
Also used : JSCodeStyleSettings(com.intellij.lang.javascript.formatter.JSCodeStyleSettings) XmlCodeStyleSettings(com.intellij.psi.formatter.xml.XmlCodeStyleSettings) ECMA4CodeStyleSettings(com.intellij.lang.javascript.formatter.ECMA4CodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) XmlCodeStyleSettings(com.intellij.psi.formatter.xml.XmlCodeStyleSettings) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 25 with JSTestOptions

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

the class FlexOptimizeImportsTest method testNoSemicolons.

@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk })
public void testNoSemicolons() throws Throwable {
    JSTestUtils.addClassesToProject(myFixture, true, "foo.MyClass", "foo.MyClass2", "bar.MyClass3");
    final JSCodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings().getCustomSettings(ECMA4CodeStyleSettings.class);
    boolean b = codeStyleSettings.USE_SEMICOLON_AFTER_STATEMENT;
    codeStyleSettings.USE_SEMICOLON_AFTER_STATEMENT = false;
    try {
        runOptimizeAction(AS_FILE_EXTENSION);
    } finally {
        codeStyleSettings.USE_SEMICOLON_AFTER_STATEMENT = b;
    }
}
Also used : JSCodeStyleSettings(com.intellij.lang.javascript.formatter.JSCodeStyleSettings) 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