From e5e69d9b90850eb653883f52c76e28dd870ee067 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 7 Dec 2010 11:47:24 -0800 Subject: Remove RegExp parser - RegExp parser is rearly used, feature, and one should not have RegExps in views anyways, so we are removing it BACKWARD INCOMPATIBLE CHANGE!!! --- test/ParserSpec.js | 25 ------------------------- test/ScopeSpec.js | 5 +++++ 2 files changed, 5 insertions(+), 25 deletions(-) (limited to 'test') diff --git a/test/ParserSpec.js b/test/ParserSpec.js index c26125da..c237aa40 100644 --- a/test/ParserSpec.js +++ b/test/ParserSpec.js @@ -59,14 +59,6 @@ describe('parser', function() { expect(undefined).toEqual(tokens[i].fn()); }); - it('should tokenize RegExp', function() { - var tokens = lex("/r 1/"); - var i = 0; - expect(tokens[i].index).toEqual(0); - expect(tokens[i].text).toEqual('r 1'); - expect("r 1".match(tokens[i].fn())[0]).toEqual('r 1'); - }); - it('should tokenize quoted string', function() { var str = "['\\'', \"\\\"\"]"; var tokens = lex(str); @@ -91,23 +83,6 @@ describe('parser', function() { expect(tokens[0].string).toEqual('\u00a0'); }); - it('should tokenize RegExp with options', function() { - var tokens = lex("/r/g"); - var i = 0; - expect(tokens[i].index).toEqual(0); - expect(tokens[i].text).toEqual('r'); - expect(tokens[i].flags).toEqual('g'); - expect("rr".match(tokens[i].fn()).length).toEqual(2); - }); - - it('should tokenize RegExp with escaping', function() { - var tokens = lex("/\\/\\d/"); - var i = 0; - expect(tokens[i].index).toEqual(0); - expect(tokens[i].text).toEqual('\\/\\d'); - expect("/1".match(tokens[i].fn())[0]).toEqual('/1'); - }); - it('should ignore whitespace', function() { var tokens = lex("a \t \n \r b"); expect(tokens[0].text).toEqual('a'); diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index acded34b..354ddc72 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -52,6 +52,11 @@ describe('scope/model', function(){ model.$eval('name="works"'); expect(model.name).toEqual('works'); }); + + it('should not bind regexps', function(){ + model.exp = /abc/; + expect(model.$eval('exp')).toEqual(model.exp); + }); it('should do nothing on empty string and not update view', function(){ var onEval = jasmine.createSpy('onEval'); -- cgit v1.2.3