From 2cb9497d02afdcfc19ea52fddcd6d1f04d81ffdb Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 12 Oct 2010 21:52:04 -0700 Subject: Fixed issue where compiler would pass in detached text node if previous markup would have removed it. --- test/CompilerSpec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index 1091337b..59c365e4 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -134,4 +134,27 @@ describe('compiler', function(){ expect(scope.$element.text()).toEqual('3'); }); + it('should allow multiple markups per text element', function(){ + markup.push(function(text, textNode, parent){ + var index = text.indexOf('---'); + if (index > -1) { + textNode.after(text.substring(index + 3)); + textNode.after("
"); + textNode.after(text.substring(0, index)); + textNode.remove(); + } + }); + markup.push(function(text, textNode, parent){ + var index = text.indexOf('==='); + if (index > -1) { + textNode.after(text.substring(index + 3)); + textNode.after("

"); + textNode.after(text.substring(0, index)); + textNode.remove(); + } + }); + var scope = compile('A---B---C===D'); + expect(sortedHtml(scope.$element)).toEqual('

A
B
C

D
'); + }); + }); -- cgit v1.2.3