fix(animations): always quote string map key values in AOT code (#13602)

This commit is contained in:
Matias Niemelä
2016-12-20 18:17:58 -08:00
committed by Chuck Jazdzewski
parent c0f750af4e
commit f49ab56160
3 changed files with 16 additions and 5 deletions

View File

@ -113,6 +113,14 @@ export function main() {
expect(emitStmt(o.literalMap([['someKey', o.literal(1)]]).toStmt())).toEqual(`{someKey: 1};`);
});
it('should apply quotes to each entry within a map produced with literalMap when true', () => {
expect(
emitStmt(
o.literalMap([['a', o.literal('a')], ['*', o.literal('star')]], null, true).toStmt())
.replace(/\s+/gm, ''))
.toEqual(`{'a':'a','*':'star'};`);
});
it('should support blank literals', () => {
expect(emitStmt(o.literal(null).toStmt())).toEqual('(null as any);');
expect(emitStmt(o.literal(undefined).toStmt())).toEqual('(undefined as any);');