Bläddra i källkod

Correct the place where attach events are fired (#16348)

Change-Id: Ib0679cf893edda3206b858938c0684a242500cfb
tags/7.6.0.alpha7
Matti Tahvonen 9 år sedan
förälder
incheckning
a0637c8feb

+ 2
- 2
server/src/com/vaadin/server/AbstractClientConnector.java Visa fil

@@ -610,11 +610,11 @@ public abstract class AbstractClientConnector implements ClientConnector,

getUI().getConnectorTracker().registerConnector(this);

fireEvent(new AttachEvent(this));

for (ClientConnector connector : getAllChildrenIterable(this)) {
connector.attach();
}

fireEvent(new AttachEvent(this));
}

/**

+ 27
- 14
server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java Visa fil

@@ -58,7 +58,15 @@ public class AttachDetachListenersTest {

@Test
public void attachListeners_setSessionLast() {
setupAttachListeners();
attachListener.attach(eventEquals(new AttachEvent(component)));
attachListener.attach(eventEquals(new AttachEvent(content)));
attachListener.attach(eventEquals(new AttachEvent(ui)));

control.replay();

ui.addAttachListener(attachListener);
content.addAttachListener(attachListener);
component.addAttachListener(attachListener);

ui.setContent(content);
content.addComponent(component);
@@ -69,7 +77,15 @@ public class AttachDetachListenersTest {

@Test
public void attachListeners_setSessionFirst() {
setupAttachListeners();
attachListener.attach(eventEquals(new AttachEvent(ui)));
attachListener.attach(eventEquals(new AttachEvent(content)));
attachListener.attach(eventEquals(new AttachEvent(component)));

control.replay();

ui.addAttachListener(attachListener);
content.addAttachListener(attachListener);
component.addAttachListener(attachListener);

ui.setSession(session);
ui.setContent(content);
@@ -80,7 +96,15 @@ public class AttachDetachListenersTest {

@Test
public void attachListeners_setSessionBetween() {
setupAttachListeners();
attachListener.attach(eventEquals(new AttachEvent(content)));
attachListener.attach(eventEquals(new AttachEvent(ui)));
attachListener.attach(eventEquals(new AttachEvent(component)));

control.replay();

ui.addAttachListener(attachListener);
content.addAttachListener(attachListener);
component.addAttachListener(attachListener);

ui.setContent(content);
ui.setSession(session);
@@ -168,15 +192,4 @@ public class AttachDetachListenersTest {
ui.setSession(session);
}

private void setupAttachListeners() {
attachListener.attach(eventEquals(new AttachEvent(ui)));
attachListener.attach(eventEquals(new AttachEvent(content)));
attachListener.attach(eventEquals(new AttachEvent(component)));

control.replay();

ui.addAttachListener(attachListener);
content.addAttachListener(attachListener);
component.addAttachListener(attachListener);
}
}

Laddar…
Avbryt
Spara