@@ -100,7 +100,7 @@ describe('browser', function() {
100
100
beforeEach ( function ( ) {
101
101
scripts = [ ] ;
102
102
removedScripts = [ ] ;
103
- sniffer = { history : true , hashchange : true } ;
103
+ sniffer = { history : true } ;
104
104
fakeWindow = new MockWindow ( ) ;
105
105
fakeDocument = new MockDocument ( ) ;
106
106
@@ -597,7 +597,7 @@ describe('browser', function() {
597
597
var currentHref ;
598
598
599
599
beforeEach ( function ( ) {
600
- sniffer = { history : true , hashchange : true } ;
600
+ sniffer = { history : true } ;
601
601
currentHref = fakeWindow . location . href ;
602
602
} ) ;
603
603
@@ -683,9 +683,8 @@ describe('browser', function() {
683
683
expect ( callback ) . toHaveBeenCalledOnce ( ) ;
684
684
} ) ;
685
685
686
- it ( 'should forward only popstate event when both history and hashchange supported' , function ( ) {
686
+ it ( 'should forward only popstate event when history supported' , function ( ) {
687
687
sniffer . history = true ;
688
- sniffer . hashchange = true ;
689
688
browser . onUrlChange ( callback ) ;
690
689
fakeWindow . location . href = 'http://server/new' ;
691
690
@@ -697,9 +696,8 @@ describe('browser', function() {
697
696
expect ( callback ) . toHaveBeenCalledOnce ( ) ;
698
697
} ) ;
699
698
700
- it ( 'should forward hashchange event with new url when only hashchange supported' , function ( ) {
699
+ it ( 'should forward hashchange event with new url when history not supported' , function ( ) {
701
700
sniffer . history = false ;
702
- sniffer . hashchange = true ;
703
701
browser . onUrlChange ( callback ) ;
704
702
fakeWindow . location . href = 'http://server/new' ;
705
703
@@ -711,56 +709,8 @@ describe('browser', function() {
711
709
expect ( callback ) . toHaveBeenCalledOnce ( ) ;
712
710
} ) ;
713
711
714
- it ( 'should use polling when neither history nor hashchange supported ' , function ( ) {
712
+ it ( 'should not fire urlChange if changed by browser.url method ' , function ( ) {
715
713
sniffer . history = false ;
716
- sniffer . hashchange = false ;
717
- browser . onUrlChange ( callback ) ;
718
-
719
- fakeWindow . location . href = 'http://server.new' ;
720
- fakeWindow . setTimeout . flush ( ) ;
721
- expect ( callback ) . toHaveBeenCalledWith ( 'http://server.new' , null ) ;
722
-
723
- callback . reset ( ) ;
724
-
725
- fakeWindow . fire ( 'popstate' ) ;
726
- fakeWindow . fire ( 'hashchange' ) ;
727
- expect ( callback ) . not . toHaveBeenCalled ( ) ;
728
- } ) ;
729
-
730
- describe ( 'after an initial location change by browser.url method when neither history nor hashchange supported' , function ( ) {
731
- beforeEach ( function ( ) {
732
- sniffer . history = false ;
733
- sniffer . hashchange = false ;
734
- browser . url ( "http://server/#current" ) ;
735
- } ) ;
736
-
737
- it ( 'should fire callback with the correct URL on location change outside of angular' , function ( ) {
738
- browser . onUrlChange ( callback ) ;
739
-
740
- fakeWindow . location . href = 'http://server/#new' ;
741
- fakeWindow . setTimeout . flush ( ) ;
742
- expect ( callback ) . toHaveBeenCalledWith ( 'http://server/#new' , null ) ;
743
-
744
- fakeWindow . fire ( 'popstate' ) ;
745
- fakeWindow . fire ( 'hashchange' ) ;
746
- expect ( callback ) . toHaveBeenCalledOnce ( ) ;
747
- } ) ;
748
-
749
- } ) ;
750
-
751
- it ( 'should not fire urlChange if changed by browser.url method (polling)' , function ( ) {
752
- sniffer . history = false ;
753
- sniffer . hashchange = false ;
754
- browser . onUrlChange ( callback ) ;
755
- browser . url ( 'http://new.com' ) ;
756
-
757
- fakeWindow . setTimeout . flush ( ) ;
758
- expect ( callback ) . not . toHaveBeenCalled ( ) ;
759
- } ) ;
760
-
761
- it ( 'should not fire urlChange if changed by browser.url method (hashchange)' , function ( ) {
762
- sniffer . history = false ;
763
- sniffer . hashchange = true ;
764
714
browser . onUrlChange ( callback ) ;
765
715
browser . url ( 'http://new.com' ) ;
766
716
0 commit comments