File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 3737 // user pressed back button in browser
3838 if ( prevPage === url ) {
3939 nsHistory . _history . pop ( ) ;
40-
41- } else {
42- nsHistory . _history . push ( nsHistory . _current ) ;
4340 }
41+
42+ nsHistory . _history . push ( nsHistory . _current ) ;
4443 }
4544 }
4645
Original file line number Diff line number Diff line change 11describe ( 'ns.page' , function ( ) {
22
3+ beforeEach ( function ( ) {
4+ this . sinon . stub ( ns . page . history , '_current' , null ) ;
5+ this . sinon . stub ( ns . page . history , '_history' , [ ] ) ;
6+ } ) ;
7+
38 describe ( 'ns.page.go' , function ( ) {
49
510 describe ( 'redirect' , function ( ) {
@@ -226,6 +231,28 @@ describe('ns.page', function() {
226231 } ) ;
227232 } ) ;
228233
234+ describe ( 'ns.page.history.push' , function ( ) {
235+ beforeEach ( function ( ) {
236+ this . sinon . stub ( ns , 'Update' , function ( ) {
237+ return {
238+ start : function ( ) {
239+ return Vow . fulfill ( ) ;
240+ }
241+ } ;
242+ } ) ;
243+ } ) ;
244+
245+ it ( 'Должен запомнить страницу после возврата на предыдущую' , function ( ) {
246+ return ns . page . go ( '/inbox' ) . then ( function ( ) {
247+ return ns . page . go ( '/message/1' ) . then ( function ( ) {
248+ return ns . page . go ( '/inbox' ) . then ( function ( ) {
249+ expect ( ns . page . history . _history ) . to . be . eql ( [ '/message/1' ] ) ;
250+ } ) ;
251+ } ) ;
252+ } ) ;
253+ } ) ;
254+ } ) ;
255+
229256 } ) ;
230257
231258 } ) ;
You can’t perform that action at this time.
0 commit comments