use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class SimpleValuesIncrementalUpdateTest method testAttributeValueChangeAsXmlElementChange.
public void testAttributeValueChangeAsXmlElementChange() throws Throwable {
final MyElement element = createElement("<a attr=\"foo\"/>");
final GenericAttributeValue<String> attr = element.getAttr();
attr.getXmlAttributeValue().getFirstChild().replace(createTag("<a attr=\"bar\"/>").getAttribute("attr", null).getValueElement().getFirstChild());
putExpected(new DomEvent(element, false));
assertResultsAndClear();
assertTrue(attr.isValid());
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class TreeIncrementalUpdateTest method testCustomChildrenEvents.
public void testCustomChildrenEvents() throws Throwable {
final Sepulka element = createElement("<a><foo/><bar/></a>", Sepulka.class);
final List<MyElement> list = element.getCustomChildren();
final XmlTag tag = element.getXmlTag();
WriteCommandAction.runWriteCommandAction(null, () -> {
tag.getSubTags()[0].delete();
tag.getSubTags()[0].delete();
});
tag.add(createTag("<goo/>"));
putExpected(new DomEvent(element, false));
putExpected(new DomEvent(element, false));
putExpected(new DomEvent(element, false));
assertResultsAndClear();
assertEquals(1, element.getCustomChildren().size());
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class TreeIncrementalUpdateTest method testAddFixedElementCanDefineIt.
public void testAddFixedElementCanDefineIt() throws Throwable {
final MyElement element = createElement("<a></a>");
final MyElement child = element.getChild();
element.getXmlTag().add(createTag("<child/>"));
final XmlTag[] subTags = element.getXmlTag().getSubTags();
assertTrue(child.equals(element.getChild()));
assertTrue(element.getChild().equals(child));
assertCached(element.getChild(), subTags[0]);
putExpected(new DomEvent(element, false));
assertResultsAndClear();
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class TreeIncrementalUpdateTest method testAddFixedElement.
public void testAddFixedElement() throws Throwable {
final MyElement element = createPhysicalElement("<a>" + "<child/>" + "<child><child/></child>" + "<child/></a>");
final MyElement child = element.getChild();
final MyElement child2 = element.getChild2();
final XmlTag leafTag = child2.getChild().getXmlTag();
new WriteCommandAction(getProject()) {
@Override
protected void run(@NotNull Result result) throws Throwable {
element.getXmlTag().addAfter(createTag("<child/>"), child.getXmlTag());
}
}.execute();
assertNoCache(leafTag);
final XmlTag[] subTags = element.getXmlTag().getSubTags();
assertFalse(child2.isValid());
assertEquals(child, element.getChild());
assertFalse(child2.equals(element.getChild2()));
assertCached(child, subTags[0]);
assertNoCache(subTags[2]);
assertNoCache(subTags[3]);
putExpected(new DomEvent(element, false));
putExpected(new DomEvent(element, false));
assertResultsAndClear();
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class TreeIncrementalUpdateTest method testRootTagAppearsLater.
public void testRootTagAppearsLater() throws Throwable {
final XmlFile file = createXmlFile("");
final DomFileElementImpl<MyElement> fileElement = getDomManager().getFileElement(file, MyElement.class, "root");
myCallRegistry.clear();
assertNull(fileElement.getRootElement().getXmlTag());
file.getDocument().replace(createXmlFile("<root/>").getDocument());
final XmlTag rootTag = fileElement.getRootTag();
assertEquals(rootTag, file.getDocument().getRootTag());
putExpected(new DomEvent(fileElement.getRootElement(), false));
assertResultsAndClear();
}
Aggregations