File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -124,13 +124,11 @@ export default class SessionService extends Service {
124
124
logoutTask = task ( async ( ) => {
125
125
await ajax ( `/api/private/session` , { method : 'DELETE' } ) ;
126
126
127
- this . savedTransition = null ;
128
127
this . isLoggedIn = false ;
129
128
130
- await this . loadUserTask . cancelAll ( { resetState : true } ) ;
131
- this . sentry . setUser ( null ) ;
132
-
133
- this . router . transitionTo ( 'index' ) ;
129
+ // We perform a proper page navigation here instead of an in-app transition to ensure
130
+ // that the Ember Data store and any other in-memory data is cleared on logout.
131
+ window . location . assign ( '/' ) ;
134
132
} ) ;
135
133
136
134
loadUserTask = dropTask ( async ( ) => {
Original file line number Diff line number Diff line change 1
1
import { click , currentURL , visit } from '@ember/test-helpers' ;
2
2
import { module , test } from 'qunit' ;
3
3
4
+ import window from 'ember-window-mock' ;
5
+ import { setupWindowMock } from 'ember-window-mock/test-support' ;
6
+
4
7
import { setupApplicationTest } from 'cargo/tests/helpers' ;
5
8
6
9
module ( 'Acceptance | Logout' , function ( hooks ) {
7
10
setupApplicationTest ( hooks ) ;
11
+ setupWindowMock ( hooks ) ;
8
12
9
13
test ( 'successful logout' , async function ( assert ) {
10
14
let user = this . server . create ( 'user' , { name : 'John Doe' } ) ;
@@ -17,7 +21,6 @@ module('Acceptance | Logout', function (hooks) {
17
21
await click ( '[data-test-user-menu] [data-test-toggle]' ) ;
18
22
await click ( '[data-test-user-menu] [data-test-logout-button]' ) ;
19
23
20
- assert . equal ( currentURL ( ) , '/' ) ;
21
- assert . dom ( '[data-test-user-menu] [data-test-toggle]' ) . doesNotExist ( ) ;
24
+ assert . equal ( window . location . pathname , '/' ) ;
22
25
} ) ;
23
26
} ) ;
You can’t perform that action at this time.
0 commit comments