@@ -1547,4 +1547,57 @@ describe('Ionic History', function() {
1547
1547
1548
1548
} ) ) ;
1549
1549
1550
+ it ( 'should not remove backView references from Views in the same history stack' , inject ( function ( $state , $ionicHistory ) {
1551
+
1552
+ var tab1Container = { } ;
1553
+ var tab2Container = { } ;
1554
+ ionicHistory . registerHistory ( tab1Container ) ;
1555
+ ionicHistory . registerHistory ( tab2Container ) ;
1556
+
1557
+ // register tab1, view1
1558
+ $state . go ( 'tabs.tab1view1' ) ;
1559
+ rootScope . $apply ( ) ;
1560
+ var tab1view1Reg = ionicHistory . register ( tab1Container , false ) ;
1561
+
1562
+ // register tab2, view1
1563
+ $state . go ( 'tabs.tab2view1' ) ;
1564
+ rootScope . $apply ( ) ;
1565
+ var tab2view1Reg = ionicHistory . register ( tab2Container , false ) ;
1566
+
1567
+ // register tab2, view2
1568
+ $state . go ( 'tabs.tab2view2' ) ;
1569
+ rootScope . $apply ( ) ;
1570
+ var tab2view2Reg = ionicHistory . register ( tab2Container , false ) ;
1571
+ var tab2view2 = ionicHistory . getViewById ( tab2view2Reg . viewId ) ;
1572
+ expect ( tab2view2 . backViewId ) . toEqual ( tab2view1Reg . viewId ) ;
1573
+
1574
+ // go back to tab2, view1
1575
+ $state . go ( 'tabs.tab2view1' ) ;
1576
+ rootScope . $apply ( ) ;
1577
+ tab2view1Reg = ionicHistory . register ( tab2Container , false ) ;
1578
+
1579
+ // register tab1, view1
1580
+ $state . go ( 'tabs.tab1view1' ) ;
1581
+ rootScope . $apply ( ) ;
1582
+ tab1view1Reg = ionicHistory . register ( tab1Container , false ) ;
1583
+
1584
+ // go to tab1, view 2
1585
+ // register tab1, view2
1586
+ $state . go ( 'tabs.tab1view2' ) ;
1587
+ rootScope . $apply ( ) ;
1588
+ var tab1view2Reg = ionicHistory . register ( tab1Container , false ) ;
1589
+ currentView = ionicHistory . currentView ( ) ;
1590
+ expect ( currentView . backViewId ) . toEqual ( tab1view1Reg . viewId ) ;
1591
+
1592
+ // register tab2, view1
1593
+ $state . go ( 'tabs.tab2view1' ) ;
1594
+ rootScope . $apply ( ) ;
1595
+ tab2view1Reg = ionicHistory . register ( tab2Container , false ) ;
1596
+ currentView = ionicHistory . currentView ( ) ;
1597
+ expect ( currentView . backViewId ) . toEqual ( tab1view2Reg . viewId ) ;
1598
+ expect ( tab2view2 . historyId ) . toEqual ( currentView . historyId ) ;
1599
+ expect ( tab2view2 . backViewId ) . toEqual ( currentView . viewId ) ;
1600
+
1601
+ } ) ) ;
1602
+
1550
1603
} ) ;
0 commit comments