@@ -112,5 +112,172 @@ describe('router-remote6-2006 in host', () => {
112112 cy . go ( 'forward' ) ;
113113 cy . verifyContent ( 'Remote6 about page' ) ;
114114 } ) ;
115+
116+ it ( 'should increment outer counter without affecting inner counter' , ( ) => {
117+ cy . clickMenuItem ( 'Remote6-ReactRouteV7' ) ;
118+
119+ // Navigate to detail page first
120+ cy . get ( '.self-remote6-detail-link' ) . should ( 'exist' ) . click ( ) ;
121+ cy . verifyContent ( 'Remote6 detail page' ) ;
122+
123+ // Verify initial state
124+ cy . verifyContent ( 'Outer Counter: 0' ) ;
125+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
126+ 'contain' ,
127+ 'Inner Counter: 0' ,
128+ ) ;
129+
130+ // Click outer increment button multiple times
131+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
132+ cy . verifyContent ( 'Outer Counter: 1' ) ;
133+
134+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
135+ cy . verifyContent ( 'Outer Counter: 2' ) ;
136+
137+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
138+ cy . verifyContent ( 'Outer Counter: 3' ) ;
139+
140+ // Inner counter should still be 0 (not affected by outer counter changes)
141+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
142+ 'contain' ,
143+ 'Inner Counter: 0' ,
144+ ) ;
145+
146+ // Increment outer counter again
147+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
148+ cy . verifyContent ( 'Outer Counter: 4' ) ;
149+
150+ // Inner counter should still be 0 (not affected)
151+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
152+ 'contain' ,
153+ 'Inner Counter: 0' ,
154+ ) ;
155+ } ) ;
156+
157+ it ( 'should increment inner counter without affecting outer counter' , ( ) => {
158+ cy . clickMenuItem ( 'Remote6-ReactRouteV7' ) ;
159+
160+ // Navigate to detail page first
161+ cy . get ( '.self-remote6-detail-link' ) . should ( 'exist' ) . click ( ) ;
162+ cy . verifyContent ( 'Remote6 detail page' ) ;
163+
164+ // Verify initial state
165+ cy . verifyContent ( 'Outer Counter: 0' ) ;
166+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
167+ 'contain' ,
168+ 'Inner Counter: 0' ,
169+ ) ;
170+
171+ // Click inner increment button
172+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
173+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
174+ 'contain' ,
175+ 'Inner Counter: 1' ,
176+ ) ;
177+
178+ // Outer counter should still be 0 (not affected)
179+ cy . verifyContent ( 'Outer Counter: 0' ) ;
180+
181+ // Increment inner counter more times
182+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
183+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
184+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
185+ 'contain' ,
186+ 'Inner Counter: 3' ,
187+ ) ;
188+
189+ // Outer counter should still be 0
190+ cy . verifyContent ( 'Outer Counter: 0' ) ;
191+
192+ // Now increment outer counter
193+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
194+ cy . verifyContent ( 'Outer Counter: 1' ) ;
195+
196+ // Inner counter should be preserved at 3 (not reset - this proves BridgeWrapper is not recreated)
197+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
198+ 'contain' ,
199+ 'Inner Counter: 3' ,
200+ ) ;
201+
202+ // Increment outer counter more times
203+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
204+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
205+ cy . verifyContent ( 'Outer Counter: 3' ) ;
206+
207+ // Inner counter should still be preserved at 3
208+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
209+ 'contain' ,
210+ 'Inner Counter: 3' ,
211+ ) ;
212+ } ) ;
213+
214+ it ( 'should handle alternating clicks between outer and inner counters' , ( ) => {
215+ cy . clickMenuItem ( 'Remote6-ReactRouteV7' ) ;
216+
217+ // Navigate to detail page first
218+ cy . get ( '.self-remote6-detail-link' ) . should ( 'exist' ) . click ( ) ;
219+ cy . verifyContent ( 'Remote6 detail page' ) ;
220+
221+ // Verify initial state
222+ cy . verifyContent ( 'Outer Counter: 0' ) ;
223+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
224+ 'contain' ,
225+ 'Inner Counter: 0' ,
226+ ) ;
227+
228+ // Click outer increment
229+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
230+ cy . verifyContent ( 'Outer Counter: 1' ) ;
231+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
232+ 'contain' ,
233+ 'Inner Counter: 0' ,
234+ ) ;
235+
236+ // Click inner increment
237+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
238+ cy . verifyContent ( 'Outer Counter: 1' ) ;
239+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
240+ 'contain' ,
241+ 'Inner Counter: 1' ,
242+ ) ;
243+
244+ // Click outer increment again
245+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
246+ cy . verifyContent ( 'Outer Counter: 2' ) ;
247+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
248+ 'contain' ,
249+ 'Inner Counter: 1' ,
250+ ) ;
251+
252+ // Click inner increment again
253+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
254+ cy . verifyContent ( 'Outer Counter: 2' ) ;
255+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
256+ 'contain' ,
257+ 'Inner Counter: 2' ,
258+ ) ;
259+
260+ // Click outer increment twice
261+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
262+ cy . get ( '[data-testid="remote6-outer-increment"]' ) . click ( ) ;
263+ cy . verifyContent ( 'Outer Counter: 4' ) ;
264+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
265+ 'contain' ,
266+ 'Inner Counter: 2' ,
267+ ) ;
268+
269+ // Click inner increment three times
270+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
271+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
272+ cy . get ( '[data-testid="remote6-inner-increment"]' ) . click ( ) ;
273+ cy . verifyContent ( 'Outer Counter: 4' ) ;
274+ cy . get ( '[data-testid="remote6-inner-counter"]' ) . should (
275+ 'contain' ,
276+ 'Inner Counter: 5' ,
277+ ) ;
278+
279+ // Final verification: both counters maintain their independent state
280+ // This proves BridgeWrapper is not recreated and both states are preserved
281+ } ) ;
115282 } ) ;
116283} ) ;
0 commit comments