Skip to content

Commit

Permalink
test(#586): can reuse previous concat parts
Browse files Browse the repository at this point in the history
- Test proving that when you reuse parts from previous concat statement in new concat statement you will get "Maximum callstack size exceeded"
  • Loading branch information
MichalBryxi authored and dcyriller committed Nov 10, 2021
1 parent 0136500 commit 286a44a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/parse-result.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ describe('ember-template-recast', function () {
expect(print(ast)).toEqual(`<img src="{{this.something}}">`);
});

test('can reuse previous concat parts', function () {
let template = `<img src="foo {{bar}} baz">`;
let original = parse(template);
let element = original.body[0] as AST.ElementNode;
let attribute = element.attributes[0] as AST.AttrNode;
let concat = attribute.value as AST.ConcatStatement;

let ast = builders.concat([concat.parts[0], concat.parts[1]]);

expect(print(ast)).toEqual(`<img src="foo {{bar}}">`);
});

test('changing an element to a void element does not print closing tag', function () {
let template = `<div data-foo="{{something}}"></div>`;

Expand Down

0 comments on commit 286a44a

Please sign in to comment.