mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move XML-specific part of EnterActionTest to xml-tests module
GitOrigin-RevId: f4f0375aae52b6c7b869dbf47f6a63f17d38052f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
492cf05fdd
commit
8461ecdd09
@@ -0,0 +1,113 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.formatter.xml.XmlCodeStyleSettings;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class XmlEnterActionTest extends AbstractEnterActionTestCase {
|
||||
@Override
|
||||
protected @NotNull String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData";
|
||||
}
|
||||
|
||||
public void testInXml1() {
|
||||
String path = "/codeInsight/enterAction/xml/";
|
||||
|
||||
configureByFile(path + "state0.xml");
|
||||
performAction();
|
||||
checkResultByFile(path + "state1.xml");
|
||||
}
|
||||
|
||||
public void testInXml2() {
|
||||
String path = "/codeInsight/enterAction/xml/";
|
||||
|
||||
configureByFile(path + "state2.xml");
|
||||
performAction();
|
||||
PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument());
|
||||
assertEquals(getFile().getText(), getEditor().getDocument().getText());
|
||||
//checkResultByFile(path + "state3.xml");
|
||||
}
|
||||
|
||||
public void testInXml3() {
|
||||
String path = "/codeInsight/enterAction/xml/";
|
||||
|
||||
configureByFile(path + "state4.xml");
|
||||
performAction();
|
||||
PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument());
|
||||
assertEquals(getFile().getText(), getEditor().getDocument().getText());
|
||||
// checkResultByFile(path + "state5.xml");
|
||||
}
|
||||
|
||||
public void testInXml4() {
|
||||
getCodeStyleSettings().getCustomSettings(XmlCodeStyleSettings.class).XML_ALIGN_ATTRIBUTES = true;
|
||||
String path = "/codeInsight/enterAction/xml/";
|
||||
|
||||
configureByFile(path + "before1.xml");
|
||||
performAction();
|
||||
checkResultByFile(path + "after1.xml");
|
||||
}
|
||||
|
||||
public void testIndentInXmlInfiniteLoop() {
|
||||
configureByFile("/codeInsight/enterAction/indent/XmlInfiniteLoop.xml");
|
||||
performAction();
|
||||
}
|
||||
|
||||
public void testSCR19905() {
|
||||
configureByFile("/codeInsight/enterAction/SCR19905.xml");
|
||||
performAction();
|
||||
assertEquals(getEditor().getDocument().getText(), getFile().getText());
|
||||
}
|
||||
|
||||
public void testHtml1() {
|
||||
configureByFile("/codeInsight/enterAction/html/1.html");
|
||||
performAction();
|
||||
checkResultByFile(null, "/codeInsight/enterAction/html/1_after.html", false);
|
||||
}
|
||||
|
||||
public void testHtml2() {
|
||||
configureByFile("/codeInsight/enterAction/html/2.html");
|
||||
performAction();
|
||||
checkResultByFile(null, "/codeInsight/enterAction/html/2_after.html", false);
|
||||
}
|
||||
|
||||
public void testBeginOfTag() {
|
||||
doTextTest("xml", "<a>\n" + " <b/><caret>\n" + " <b/>\n" + "</a>",
|
||||
"<a>\n" + " <b/>\n" + " <caret>\n" + " <b/>\n" + "</a>");
|
||||
}
|
||||
|
||||
public void testAssertionInXml() {
|
||||
doTextTest("xml", "<!--\n" + "TODO<caret>-->", "<!--\n" + "TODO\n" + "<caret>-->");
|
||||
}
|
||||
|
||||
public void testEnterAtTheEndOfFile() {
|
||||
doTextTest("xml", "<a>\n" + " <b><caret>", "<a>\n" + " <b>\n" + " <caret>");
|
||||
}
|
||||
|
||||
public void testEnterAfterEmptyTag() {
|
||||
doTextTest("html",
|
||||
"<form action=\"dsd\">\n" +
|
||||
" <input type=\"text\">\n" +
|
||||
" <input type=\"password\">\n" +
|
||||
" <input type=\"submit\"><caret></form>",
|
||||
"<form action=\"dsd\">\n" +
|
||||
" <input type=\"text\">\n" +
|
||||
" <input type=\"password\">\n" +
|
||||
" <input type=\"submit\">\n" +
|
||||
"</form>");
|
||||
}
|
||||
|
||||
public void testWeb6656() {
|
||||
doTextTest(
|
||||
"html",
|
||||
|
||||
"<!doctype html><caret>",
|
||||
|
||||
"<!doctype html>\n" +
|
||||
"<caret>"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test>
|
||||
<hello>
|
||||
<mytag/>
|
||||
</hello><caret>
|
||||
</test>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body><caret></body></html>
|
||||
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
<caret>
|
||||
</body></html>
|
||||
@@ -0,0 +1,4 @@
|
||||
<span jwcid="hasCallback">
|
||||
<a jwcid="cancel" href="#" id="cancel" class="submitButton secondary">
|
||||
<span key="button-cancel">Cancel (L10n)</span><caret></a>
|
||||
</span>
|
||||
@@ -0,0 +1,5 @@
|
||||
<span jwcid="hasCallback">
|
||||
<a jwcid="cancel" href="#" id="cancel" class="submitButton secondary">
|
||||
<span key="button-cancel">Cancel (L10n)</span>
|
||||
<caret></a>
|
||||
</span>
|
||||
@@ -0,0 +1,3 @@
|
||||
<root>
|
||||
<abcd><caret>
|
||||
</root>
|
||||
@@ -0,0 +1,2 @@
|
||||
<a attr1="attr"
|
||||
<caret>
|
||||
@@ -0,0 +1 @@
|
||||
<a attr1="attr"<caret>
|
||||
@@ -0,0 +1,5 @@
|
||||
<tag1>
|
||||
|
||||
<a><caret></a>
|
||||
|
||||
</tag1>
|
||||
@@ -0,0 +1,7 @@
|
||||
<tag1>
|
||||
|
||||
<a>
|
||||
<caret>
|
||||
</a>
|
||||
|
||||
</tag1>
|
||||
@@ -0,0 +1,3 @@
|
||||
<tag1>
|
||||
<a><caret>
|
||||
</tag1>
|
||||
@@ -0,0 +1,4 @@
|
||||
<tag1>
|
||||
<a>
|
||||
<caret>
|
||||
</tag1>
|
||||
@@ -0,0 +1,5 @@
|
||||
<tag1>
|
||||
|
||||
<a><<caret>/a>
|
||||
|
||||
</tag1>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test>
|
||||
<hello>
|
||||
<mytag/>
|
||||
</hello><caret>
|
||||
</test>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test>
|
||||
<hello>
|
||||
<mytag/>
|
||||
</hello>
|
||||
<caret>
|
||||
</test>
|
||||
Reference in New Issue
Block a user