diff options
| author | Pete Bacon Darwin | 2013-01-09 22:23:50 +0000 | 
|---|---|---|
| committer | Igor Minar | 2013-01-17 00:28:44 -0800 | 
| commit | 49f9e4cef13e68ff85b3c160cf8fac6e7cd042a3 (patch) | |
| tree | 64e5e434ff29aaa6366ca1e7c0ddcda7f7367113 /test | |
| parent | 7e746015ea7dec3e9eb81bc4678fa9b6a83bc47c (diff) | |
| download | angular.js-49f9e4cef13e68ff85b3c160cf8fac6e7cd042a3.tar.bz2 | |
fix($compile): do not wrap empty root text nodes in spans
Closes #1059
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/compileSpec.js | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 927a4ef7..363b4329 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -125,6 +125,19 @@ describe('$compile', function() {        expect(element.find('span').text()).toEqual('A<a>B</a>C');      })); + +    it('should not wrap root whitespace text nodes in spans', function() { +      element = jqLite( +        '<div>   <div>A</div>\n  '+ // The spaces and newlines here should not get wrapped +        '<div>B</div>C\t\n  '+  // The "C", tabs and spaces here will be wrapped +        '</div>'); +      $compile(element.contents())($rootScope); +      var spans = element.find('span'); +      expect(spans.length).toEqual(1); +      expect(spans.text().indexOf('C')).toEqual(0); +    }); + +      describe('multiple directives per element', function() {        it('should allow multiple directives per element', inject(function($compile, $rootScope, log){          element = $compile( | 
