diff options
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/test/AngularSpec.js b/test/AngularSpec.js index da70aef7..151aac0a 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -278,6 +278,17 @@ describe('angular', function() {        expect(equals({}, {hasOwnProperty: 1})).toBe(false);        expect(equals({}, {toString: null})).toBe(false);      }); + +    it('should compare regular expressions', function() { +      expect(equals(/abc/, /abc/)).toBe(true); +      expect(equals(/abc/i, new RegExp('abc', 'i'))).toBe(true); +      expect(equals(new RegExp('abc', 'i'), new RegExp('abc', 'i'))).toBe(true); +      expect(equals(new RegExp('abc', 'i'), new RegExp('abc'))).toBe(false); +      expect(equals(/abc/i, /abc/)).toBe(false); +      expect(equals(/abc/, /def/)).toBe(false); +      expect(equals(/^abc/, /abc/)).toBe(false); +      expect(equals(/^abc/, '/^abc/')).toBe(false); +    });    });    describe('size', function() { @@ -654,6 +665,23 @@ describe('angular', function() {      });    }); + +  describe('isRegExp', function() { +    it('should return true for RegExp object', function() { +      expect(isRegExp(/^foobar$/)).toBe(true); +      expect(isRegExp(new RegExp('^foobar$/'))).toBe(true); +    }); + +    it('should return false for non RegExp objects', function() { +      expect(isRegExp([])).toBe(false); +      expect(isRegExp('')).toBe(false); +      expect(isRegExp(23)).toBe(false); +      expect(isRegExp({})).toBe(false); +      expect(isRegExp(new Date())).toBe(false); +    }); +  }); + +    describe('compile', function() {      it('should link to existing node and create scope', inject(function($rootScope, $compile) {        var template = angular.element('<div>{{greeting = "hello world"}}</div>'); | 
