diff options
Diffstat (limited to 'test/jqLiteSpec.js')
| -rw-r--r-- | test/jqLiteSpec.js | 25 | 
1 files changed, 23 insertions, 2 deletions
| diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 09be1c1c..c4f47dcd 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -322,7 +322,7 @@ describe('jqLite', function() {      }); -    it('should emit $destroy event if an element is removed via html()', inject(function(log) { +    it('should emit $destroy event if an element is removed via html(\'\')', inject(function(log) {        var element = jqLite('<div><span>x</span></div>');        element.find('span').on('$destroy', log.fn('destroyed')); @@ -333,6 +333,17 @@ describe('jqLite', function() {      })); +    it('should emit $destroy event if an element is removed via empty()', inject(function(log) { +      var element = jqLite('<div><span>x</span></div>'); +      element.find('span').on('$destroy', log.fn('destroyed')); + +      element.empty(); + +      expect(element.html()).toBe(''); +      expect(log).toEqual('destroyed'); +    })); + +      it('should retrieve all data if called without params', function() {        var element = jqLite(a);        expect(element.data()).toEqual({}); @@ -786,7 +797,7 @@ describe('jqLite', function() {      }); -    it('should read/write value', function() { +    it('should read/write a value', function() {        var element = jqLite('<div>abc</div>');        expect(element.length).toEqual(1);        expect(element[0].innerHTML).toEqual('abc'); @@ -797,6 +808,16 @@ describe('jqLite', function() {    }); +  describe('empty', function() { +    it('should write a value', function() { +      var element = jqLite('<div>abc</div>'); +      expect(element.length).toEqual(1); +      expect(element.empty() == element).toBeTruthy(); +      expect(element.html()).toEqual(''); +    }); +  }); + +    describe('on', function() {      it('should bind to window on hashchange', function() {        if (jqLite.fn) return; // don't run in jQuery | 
