Empty string values return invalid conversion
Closed this issue · 2 comments
One of the tests from https://github.com/ember-codemods/ember-angle-brackets-codemod/
Before ember-template-recast
(correct)
After ember-template-recast
refactor (incorrect)
Mind making a failing test for this? I think something akin to
ember-template-recast/tests/parse-result-test.js
Lines 41 to 53 in 14f1ef9
QUnit.test('adding attribute with an empty string value', function(assert) {
let template = `<Foo></Foo>`;
let ast = parse(template);
ast.body[0].attributes.push(builders.attr('@name', builders.string('')));
assert.equal(
print(ast),
stripIndent`
<Foo @name=""></Foo>`
);
});
I'm not 100% sure what the right path forward is here. Specifically, for an ElementNode
we can not easily determine the difference between <input disabled>
and <input value="">
(both are represented in the AST as AttrNode
s with an empty string as the value).
This is working now. Some changes were needed when moving from glimmer printer/parse/transform to ember-template-recast