mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[html] Remove Java test dependency
#IJPL-191726 GitOrigin-RevId: 7f6f2618350b417e9c2660af615859c5facb8761
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5538eab15e
commit
776493b276
@@ -54,7 +54,6 @@ jvm_library(
|
||||
"//platform/editor-ui-api:editor-ui",
|
||||
"//platform/projectModel-api:projectModel",
|
||||
"//xml/impl",
|
||||
"//java/testFramework",
|
||||
"//platform/testFramework",
|
||||
"//platform/testFramework:testFramework_test_lib",
|
||||
"//spellchecker",
|
||||
@@ -64,6 +63,10 @@ jvm_library(
|
||||
"//platform/core-ui",
|
||||
"//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark",
|
||||
"//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark_test_lib",
|
||||
"//platform/analysis-impl",
|
||||
"//platform/lang-impl",
|
||||
"//xml/xml-parser:parser",
|
||||
"//platform/refactoring",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -14,12 +14,15 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.editor.ui" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.xml.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.spellchecker" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.xml.psi" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.xml.tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis.impl" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang.impl" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.xml.parser" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.refactoring" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>ReportingXmlHighlightVisitorProblems.xhtml</file>
|
||||
<line>2</line>
|
||||
<description>Attribute cl is not allowed here #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
<div>
|
||||
<div cl="aaa"/>
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<div <error descr="Attribute cl is not allowed here">cl</error>="aaa"/>
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<a href="toDir/B.html"/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
<a href="../A.html">anchor</a>
|
||||
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<a href="B.html"/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
<a href="A.html">anchor</a>
|
||||
+10
-3
@@ -3,13 +3,13 @@ package com.intellij.htmltools.codeInsight.daemon;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitorBasedInspection;
|
||||
import com.intellij.javaee.ExternalResourceManagerEx;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.testFramework.JavaInspectionTestCase;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import com.intellij.xml.util.XmlUtil;
|
||||
|
||||
/**
|
||||
* @author Maxim.Mossienko
|
||||
*/
|
||||
public class GlobalHtmlHighlightingTest extends JavaInspectionTestCase {
|
||||
public class GlobalHtmlHighlightingTest extends BasePlatformTestCase {
|
||||
private String myOldDoctype;
|
||||
|
||||
@Override
|
||||
@@ -18,6 +18,7 @@ public class GlobalHtmlHighlightingTest extends JavaInspectionTestCase {
|
||||
final ExternalResourceManagerEx manager = ExternalResourceManagerEx.getInstanceEx();
|
||||
myOldDoctype = manager.getDefaultHtmlDoctype(getProject());
|
||||
manager.setDefaultHtmlDoctype(XmlUtil.XHTML_URI, getProject());
|
||||
myFixture.enableInspections(new XmlHighlightVisitorBasedInspection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,11 +35,17 @@ public class GlobalHtmlHighlightingTest extends JavaInspectionTestCase {
|
||||
}
|
||||
|
||||
public void testReportingXmlHighlightVisitorProblems() {
|
||||
doTest(getTestName(true), new XmlHighlightVisitorBasedInspection());
|
||||
myFixture.configureByFile(getBasePath() + getTestName(false) + ".xhtml");
|
||||
myFixture.testHighlighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTestDataPath() {
|
||||
return PathManager.getCommunityHomePath() + "/plugins/htmltools/testData/inspections";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "xmlHighlightVisitor/";
|
||||
}
|
||||
}
|
||||
+11
-19
@@ -1,12 +1,11 @@
|
||||
package com.intellij.htmltools.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.htmltools.codeInspection.htmlInspections.HtmlDeprecatedTagInspection;
|
||||
import com.intellij.htmltools.codeInspection.htmlInspections.HtmlPresentationalElementInspection;
|
||||
import com.intellij.javaee.ExternalResourceManagerEx;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
|
||||
import com.intellij.xml.analysis.XmlAnalysisBundle;
|
||||
import com.intellij.xml.util.XmlUtil;
|
||||
@@ -14,17 +13,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HtmlDeprecatedTagsReplaceTest extends LightQuickFixTestCase {
|
||||
public class HtmlDeprecatedTagsReplaceTest extends BasePlatformTestCase {
|
||||
static final String BASE_PATH = "/deprecatedTag";
|
||||
|
||||
@Override
|
||||
protected LocalInspectionTool @NotNull [] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[] {
|
||||
new HtmlDeprecatedTagInspection(),
|
||||
new HtmlPresentationalElementInspection()
|
||||
};
|
||||
}
|
||||
|
||||
private String myOldDoctype;
|
||||
|
||||
@Override
|
||||
@@ -33,6 +24,7 @@ public class HtmlDeprecatedTagsReplaceTest extends LightQuickFixTestCase {
|
||||
final ExternalResourceManagerEx manager = ExternalResourceManagerEx.getInstanceEx();
|
||||
myOldDoctype = manager.getDefaultHtmlDoctype(getProject());
|
||||
manager.setDefaultHtmlDoctype(XmlUtil.XHTML_URI, getProject());
|
||||
myFixture.enableInspections(new HtmlDeprecatedTagInspection(), new HtmlPresentationalElementInspection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,29 +52,29 @@ public class HtmlDeprecatedTagsReplaceTest extends LightQuickFixTestCase {
|
||||
}
|
||||
|
||||
public void testXml() {
|
||||
configureByFile(BASE_PATH + "/html_deptag5.xml");
|
||||
final List<IntentionAction> list = getAvailableActions();
|
||||
myFixture.configureByFile(BASE_PATH + "/html_deptag5.xml");
|
||||
final List<IntentionAction> list = myFixture.getAvailableIntentions();
|
||||
final IntentionAction action = CodeInsightTestUtil.findIntentionByText(list, "Replace font tag with CSS");
|
||||
assertNull(action);
|
||||
}
|
||||
|
||||
public void testFitMenu() {
|
||||
configureByFile(BASE_PATH + "/html_deptag5.xhtml");
|
||||
final List<IntentionAction> list = getAvailableActions();
|
||||
myFixture.configureByFile(BASE_PATH + "/html_deptag5.xhtml");
|
||||
final List<IntentionAction> list = myFixture.getAvailableIntentions();
|
||||
final IntentionAction action = CodeInsightTestUtil.findIntentionByText(list, "Replace menu tag with ul tag");
|
||||
assertNull(action);
|
||||
}
|
||||
|
||||
public void testSwitchToHtml5QuickFix() {
|
||||
configureByFile(BASE_PATH + '/' + getTestName(false) + ".html");
|
||||
final List<IntentionAction> list = getAvailableActions();
|
||||
myFixture.configureByFile(BASE_PATH + '/' + getTestName(false) + ".html");
|
||||
final List<IntentionAction> list = myFixture.getAvailableIntentions();
|
||||
final IntentionAction action = CodeInsightTestUtil.findIntentionByText(list, XmlAnalysisBundle.message("html.quickfix.switch.to.html5"));
|
||||
assertNotNull(action);
|
||||
}
|
||||
|
||||
public void testSwitchToHtml5QuickFix1() {
|
||||
configureByFile(BASE_PATH + '/' + getTestName(false) + ".html");
|
||||
final List<IntentionAction> list = getAvailableActions();
|
||||
myFixture.configureByFile(BASE_PATH + '/' + getTestName(false) + ".html");
|
||||
final List<IntentionAction> list = myFixture.getAvailableIntentions();
|
||||
final IntentionAction action = CodeInsightTestUtil.findIntentionByText(list, XmlAnalysisBundle.message("html.quickfix.switch.to.html5"));
|
||||
assertNull(action);
|
||||
}
|
||||
|
||||
+24
-21
@@ -1,9 +1,7 @@
|
||||
package com.intellij.htmltools.codeInspection;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.htmlInspections.RequiredAttributesInspection;
|
||||
import com.intellij.htmltools.HtmlToolsBundle;
|
||||
import com.intellij.htmltools.codeInspection.htmlInspections.HtmlRequiredAltAttributeInspection;
|
||||
@@ -13,28 +11,26 @@ import com.intellij.htmltools.codeInspection.htmlInspections.HtmlRequiredTitleEl
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.formatter.xml.HtmlCodeStyleSettings;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
|
||||
import com.intellij.xml.psi.XmlPsiBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HtmlInsertRequiredAttributeTest extends LightQuickFixTestCase {
|
||||
|
||||
public class HtmlInsertRequiredAttributeTest extends BasePlatformTestCase {
|
||||
public static final String BASE_PATH = "/insertRequiredAttribute";
|
||||
|
||||
@Override
|
||||
protected LocalInspectionTool @NotNull [] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[]{
|
||||
new RequiredAttributesInspection(),
|
||||
new HtmlRequiredAltAttributeInspection(),
|
||||
new HtmlRequiredLangAttributeInspection(),
|
||||
new HtmlRequiredTitleElementInspection(),
|
||||
new HtmlRequiredSummaryAttributeInspection()
|
||||
};
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.enableInspections(new RequiredAttributesInspection(),
|
||||
new HtmlRequiredAltAttributeInspection(),
|
||||
new HtmlRequiredLangAttributeInspection(),
|
||||
new HtmlRequiredTitleElementInspection(),
|
||||
new HtmlRequiredSummaryAttributeInspection());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return BASE_PATH;
|
||||
@@ -47,7 +43,7 @@ public class HtmlInsertRequiredAttributeTest extends LightQuickFixTestCase {
|
||||
}
|
||||
|
||||
public void testInsertDefaultAttribute() {
|
||||
doSingleTest(getTestName(false) + ".html");
|
||||
doSingleTest();
|
||||
}
|
||||
|
||||
public void testDefaultWithChangedQuote() {
|
||||
@@ -55,13 +51,20 @@ public class HtmlInsertRequiredAttributeTest extends LightQuickFixTestCase {
|
||||
final CodeStyleSettings.QuoteStyle oldQuote = settings.HTML_QUOTE_STYLE;
|
||||
try {
|
||||
settings.HTML_QUOTE_STYLE = CodeStyleSettings.QuoteStyle.Single;
|
||||
doSingleTest(getTestName(false) + ".html");
|
||||
doSingleTest();
|
||||
}
|
||||
finally {
|
||||
settings.HTML_QUOTE_STYLE = oldQuote;
|
||||
}
|
||||
}
|
||||
|
||||
private void doSingleTest() {
|
||||
myFixture.configureByFile(BASE_PATH + "/before" + getTestName(false) + ".html");
|
||||
var intention = myFixture.findSingleIntention("Insert required attribute 'src'");
|
||||
myFixture.launchAction(intention);
|
||||
myFixture.checkResultByFile(BASE_PATH + "/after" + getTestName(false) + ".html");
|
||||
}
|
||||
|
||||
public void testInsertRequiredAltInput() {
|
||||
checkInspection("insertRequiredAltInput_before.html", "insertRequiredAltInput_after.html", "alt",
|
||||
XmlPsiBundle.message("xml.quickfix.insert.required.attribute.text", "alt"));
|
||||
@@ -141,17 +144,17 @@ public class HtmlInsertRequiredAttributeTest extends LightQuickFixTestCase {
|
||||
}
|
||||
|
||||
private void checkInspection(String fileNameBefore, String fileNameAfter, String folder, String intention) {
|
||||
configureByFile(BASE_PATH + "/" + folder + "/" + fileNameBefore);
|
||||
final List<IntentionAction> list = getAvailableActions();
|
||||
myFixture.configureByFile(BASE_PATH + "/" + folder + "/" + fileNameBefore);
|
||||
final List<IntentionAction> list = myFixture.getAvailableIntentions();
|
||||
final IntentionAction action = CodeInsightTestUtil.findIntentionByPartialText(list, intention);
|
||||
assertNotNull(action);
|
||||
invoke(action);
|
||||
checkResultByFile(BASE_PATH + "/" + folder + "/" + fileNameAfter);
|
||||
myFixture.launchAction(action);
|
||||
myFixture.checkResultByFile(BASE_PATH + "/" + folder + "/" + fileNameAfter);
|
||||
}
|
||||
|
||||
private void checkInspectionDoesNotExist(String fileNameBefore, String intention, String folder) {
|
||||
configureByFile(BASE_PATH + "/" + folder + "/" + fileNameBefore);
|
||||
final List<IntentionAction> list = getAvailableActions();
|
||||
myFixture.configureByFile(BASE_PATH + "/" + folder + "/" + fileNameBefore);
|
||||
final List<IntentionAction> list = myFixture.getAvailableIntentions();
|
||||
final IntentionAction action = CodeInsightTestUtil.findIntentionByPartialText(list, intention);
|
||||
assertNull(action);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
package com.intellij.refactoring;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesProcessor;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
|
||||
public class MoveHtmlFileTest extends MoveFileTestCase {
|
||||
@Override
|
||||
protected @NotNull String getTestDataPath() {
|
||||
return PathManager.getCommunityHomePath() + "/plugins/htmltools/testData/refactoring/move/";
|
||||
public class MoveHtmlFileTest extends BasePlatformTestCase {
|
||||
public void testHtml() {
|
||||
myFixture.configureByText("A.html", """
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<a href="B.html"/>
|
||||
</body>
|
||||
</html>
|
||||
""");
|
||||
var b = myFixture.addFileToProject("B.html", """
|
||||
<a href="A.html">anchor</a>
|
||||
""");
|
||||
var targetDir = WriteAction.compute(() -> myFixture.getFile().getContainingDirectory().createSubdirectory("toDir"));
|
||||
new MoveFilesOrDirectoriesProcessor(
|
||||
getProject(), new PsiElement[]{b}, targetDir, false, false, null, null
|
||||
).run();
|
||||
myFixture.checkResult("""
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<a href="toDir/B.html"/>
|
||||
</body>
|
||||
</html>
|
||||
""");
|
||||
}
|
||||
|
||||
public void testHtml() { doTest("toDir", "B.html"); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user