diff options
| author | Misko Hevery | 2011-02-19 20:13:50 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-02-19 20:39:46 -0800 | 
| commit | 5a3c9190dc0ed037ffca73db61404ff0f3ef2675 (patch) | |
| tree | a8b742052afb612ff02d9adad74df2c366651d79 /test/jqLiteSpec.js | |
| parent | e160944bfa1fd89f99571522040ca9b41280215d (diff) | |
| download | angular.js-5a3c9190dc0ed037ffca73db61404ff0f3ef2675.tar.bz2 | |
correct hashchange event registration on window
Diffstat (limited to 'test/jqLiteSpec.js')
| -rw-r--r-- | test/jqLiteSpec.js | 29 | 
1 files changed, 29 insertions, 0 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index e42e9f14..346017f1 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -224,6 +224,35 @@ describe('jqLite', function(){    });    describe('bind', function(){ +    it('should bind to window on hashchange', function(){ +      if (jqLite.fn) return; // don't run in jQuery +      var eventFn; +      var window = { +          document: {}, +          location: {}, +          alert: noop, +          setInterval: noop, +          length:10, // pretend you are an array +          addEventListener: function(type, fn){ +            expect(type).toEqual('hashchange'); +            eventFn = fn; +          }, +          removeEventListener: noop, +          attachEvent: function(type, fn){ +            expect(type).toEqual('onhashchange'); +            eventFn = fn; +          }, +          detachEvent: noop +      }; +      var log; +      var jWindow = jqLite(window).bind('hashchange', function(){ +        log = 'works!'; +      }); +      eventFn({}); +      expect(log).toEqual('works!'); +      dealoc(jWindow); +    }); +      it('should bind to all elements and return functions', function(){        var selected = jqLite([a, b]);        var log = '';  | 
