mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add '=' if attribute value is missing
This commit is contained in:
@@ -1017,4 +1017,18 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testSetAttributeValue() {
|
||||
XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", XmlFileType.INSTANCE, "<fooBarGoo attr>1</fooBarGoo>", 0, true);
|
||||
final XmlTag tag = file.getDocument().getRootTag();
|
||||
final Document document = file.getViewProvider().getDocument();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tag.setAttribute("attr", "");
|
||||
assertEquals("<fooBarGoo attr=\"\">1</fooBarGoo>", tag.getText());
|
||||
assertEquals("<fooBarGoo attr=\"\">1</fooBarGoo>", document.getText());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ public class XmlAttributeImpl extends XmlElementImpl implements XmlAttribute, Hi
|
||||
}
|
||||
else {
|
||||
if (newValue != null) {
|
||||
att.addChild(newValue.getTreePrev().copyElement());
|
||||
att.addChild(newValue.copyElement());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user