blob: 6514397412858093f1f6792fdde1426dd0639276 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package com.vaadin.tests.layouts;
import static org.junit.Assert.assertEquals;
import org.junit.Assume;
import org.junit.Test;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.VerticalLayoutElement;
import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.SingleBrowserTest;
public class VerticalLayoutRemoveComponentTest extends SingleBrowserTest {
@Test
public void testRemoveOnlyNecessaryComponentsFromDom() {
Assume.assumeFalse("PhantomJS has issues with this test",
BrowserUtil.isPhantomJS(getDesiredCapabilities()));
openTestURL();
String script = "document.mutationEventCount = 0;"
+ "var observer = new MutationObserver(function(mutations) {"
+ "mutations.forEach(function(mutation) { document.mutationEventCount += mutation.removedNodes.length; });"
+ "});"
+ "observer.observe(arguments[0], { childList: true });";
executeScript(script,
$(VerticalLayoutElement.class).id("targetLayout"));
$(ButtonElement.class).first().click();
Long mutationEvents = (Long) executeScript(
"return document.mutationEventCount;");
assertEquals("Parent should only have one mutation event (remove slot)",
1, mutationEvents.intValue());
}
}
|