use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class IncrementalUpdateEventsTest method testRemove2.
public void testRemove2() {
deleteTag(2);
putExpected(new DomEvent(myElement, false));
assertResultsAndClear();
deleteTag(2);
putExpected(new DomEvent(myElement, false));
assertResultsAndClear();
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class IncrementalUpdateEventsTest method testRemove0.
public void testRemove0() {
deleteTag(0);
putExpected(new DomEvent(myElement, false));
assertResultsAndClear();
deleteTag(0);
putExpected(new DomEvent(myElement, false));
assertResultsAndClear();
deleteTag(0);
putExpected(new DomEvent(myElement, false));
assertResultsAndClear();
deleteTag(0);
putExpected(new DomEvent(myElement, false));
assertResultsAndClear();
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class DomSimpleValuesTest method testAttributeValues.
public void testAttributeValues() throws Throwable {
final MyElement element = createElement("<a attra=\"foo\"/>");
final GenericAttributeValue<String> attributeValue = element.getAttributeValue();
assertEquals("attra", attributeValue.getXmlElementName());
assertEquals("foo", attributeValue.getValue());
final GenericAttributeValue<Integer> attr = element.getAttr();
attr.setValue(239);
assertEquals(239, (int) attr.getValue());
assertEquals("239", element.getXmlTag().getAttributeValue("attr"));
final DomElement element1 = attr;
myCallRegistry.putExpected(new DomEvent(element1, true));
myCallRegistry.assertResultsAndClear();
attr.setValue(42);
myCallRegistry.putExpected(new DomEvent(attr, false));
myCallRegistry.assertResultsAndClear();
attr.setValue(null);
assertNull(attr.getValue());
assertNull(element.getXmlTag().getAttributeValue("attr"));
assertNull(element.getXmlTag().getAttribute("attr", ""));
myCallRegistry.putExpected(new DomEvent(attr, false));
myCallRegistry.assertResultsAndClear();
assertEquals("some-attribute", element.getSomeAttribute().getXmlElementName());
assertNull(createElement("<a attra\"attr\"/>").getAttributeValue().getStringValue());
assertNull(createElement("<a attra\"\"/>").getAttributeValue().getStringValue());
assertNull(createElement("<a attra\"/>").getAttributeValue().getStringValue());
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class DomVirtualFileEventsTest method testRenameFile.
public void testRenameFile() throws Throwable {
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
final VirtualFile dir = getVirtualFile(createTempDirectory());
addSourceContentToRoots(getModule(), dir);
final VirtualFile data = dir.createChildData(this, "abc.xml");
setFileText(data, "<a/>");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
DomFileElementImpl<DomElement> fileElement = getFileElement(data);
assertEventCount(0);
assertResultsAndClear();
data.rename(this, "deaf.xml");
assertEventCount(1);
putExpected(new DomEvent(fileElement, false));
assertResultsAndClear();
assertEquals(fileElement, getFileElement(data));
assertTrue(fileElement.isValid());
fileElement = getFileElement(data);
data.rename(this, "fff.xml");
assertEventCount(1);
putExpected(new DomEvent(fileElement, false));
assertResultsAndClear();
assertNull(getFileElement(data));
assertFalse(fileElement.isValid());
}
}.execute().throwException();
}
use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.
the class SimpleValuesIncrementalUpdateTest method testAttributeChange.
public void testAttributeChange() throws Throwable {
final MyElement element = createElement("<a/>");
element.getXmlTag().setAttribute("attr", "foo");
putExpected(new DomEvent(element, false));
assertResultsAndClear();
assertTrue(element.getAttr().isValid());
element.getXmlTag().setAttribute("bttr", "foo");
element.getXmlTag().setAttribute("attr", "bar");
putExpected(new DomEvent(element, false));
putExpected(new DomEvent(element, false));
assertResultsAndClear();
assertTrue(element.getAttr().isValid());
element.getXmlTag().setAttribute("attr", null);
putExpected(new DomEvent(element, false));
assertResultsAndClear();
assertTrue(element.getAttr().isValid());
}
Aggregations