File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
main/java/com/vaadin/flow/internal
test/java/com/vaadin/flow/internal Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -456,7 +456,10 @@ protected void prepareForResync() {
456
456
stateNode .hasBeenAttached = false ;
457
457
stateNode .hasBeenDetached = false ;
458
458
});
459
- visitNodeTreeBottomUp (sn -> sn .fireAttachListeners (true ));
459
+ visitNodeTreeBottomUp (sn -> {
460
+ sn .hasBeenAttached = true ;
461
+ sn .fireAttachListeners (true );
462
+ });
460
463
}
461
464
462
465
/**
Original file line number Diff line number Diff line change @@ -725,9 +725,13 @@ public void prepareForResync_nodeHasAttachAndDetachListeners_treeIsDirtyAndListe
725
725
tree .collectChanges (c -> {
726
726
});
727
727
Assert .assertEquals (0 , tree .collectDirtyNodes ().size ());
728
+ Assert .assertTrue (node2 .isClientSideInitialized ());
729
+ Assert .assertTrue (node2 .isAttached ());
728
730
729
731
tree .getRootNode ().prepareForResync ();
730
732
733
+ Assert .assertFalse (node2 .isClientSideInitialized ());
734
+ Assert .assertTrue (node2 .isAttached ());
731
735
Assert .assertEquals (1 , attachCount .get ());
732
736
Assert .assertEquals (1 , detachCount .get ());
733
737
@@ -743,6 +747,16 @@ public void prepareForResync_nodeHasAttachAndDetachListeners_treeIsDirtyAndListe
743
747
Assert .assertTrue (
744
748
remaining .hasFeature (PushConfigurationParametersMap .class ));
745
749
750
+ tree .collectChanges (change -> {
751
+ });
752
+ Assert .assertTrue (node2 .isClientSideInitialized ());
753
+
754
+ // Make sure detach listener is called when a resynced node is
755
+ // eventually detached
756
+ // In practice checks that node2.hasBeenAttached = true
757
+ node2 .setParent (null );
758
+ Assert .assertEquals ("Detach listener was not called on final detach" , 2 ,
759
+ detachCount .get ());
746
760
}
747
761
748
762
@ Test
You can’t perform that action at this time.
0 commit comments