File tree Expand file tree Collapse file tree
packages/zui-player/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,18 @@ export class BrowserTab extends DomainModel<Attrs> {
3838 if ( this . history . location . pathname === pathname ) {
3939 this . history . replace ( pathname )
4040 } else {
41+ // Whenever a tab is created it constructs itself with a root entry "/".
42+ // This can mess up the tab history back button, allowing the user to
43+ // get back to this "root" url which does not contain forward/back buttons.
44+ // Instead, this if statement resets the entries and index for this tab
45+ // if the only url in the entries array is "/", making it the
46+ // first entry in the history the first pathname given to browerTab.load()
47+ if ( this . history . length == 1 && this . history . location . pathname === "/" ) {
48+ this . history . entries = [ ]
49+ this . history . index = - 1
50+ }
4151 this . history . push ( pathname )
52+ console . log ( this . history )
4253 }
4354 }
4455
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ test.describe('Query tests', () => {
1515 await app . shutdown ( ) ;
1616 } ) ;
1717
18+ test ( 'session initializes with the back button disabled' , async ( ) => {
19+ const backButton = app . locate ( 'button' , 'Go Back' ) ;
20+ await expect ( backButton ) . toBeDisabled ( ) ;
21+ } ) ;
22+
1823 test ( 'session queries are the default and ordered properly in history' , async ( ) => {
1924 await app . query ( '1' ) ;
2025 await app . query ( '2' ) ;
You can’t perform that action at this time.
0 commit comments