mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(compiler): quote non identifiers in map keys. (#18788)
PR Close #18788
This commit is contained in:
committed by
Miško Hevery
parent
c1a4621c8f
commit
2fbc92fd2e
@@ -169,10 +169,11 @@ describe('TypeScriptNodeEmitter', () => {
|
||||
expect(emitStmt(o.literalMap([
|
||||
{key: 'someKey', value: o.literal(1), quoted: false},
|
||||
{key: 'a', value: o.literal('a'), quoted: false},
|
||||
{key: '*', value: o.literal('star'), quoted: true},
|
||||
{key: 'b', value: o.literal('b'), quoted: true},
|
||||
{key: '*', value: o.literal('star'), quoted: false},
|
||||
]).toStmt())
|
||||
.replace(/\s+/gm, ''))
|
||||
.toEqual(`({someKey:1,a:"a","*":"star"});`);
|
||||
.toEqual(`({someKey:1,a:"a","b":"b","*":"star"});`);
|
||||
});
|
||||
|
||||
it('should support blank literals', () => {
|
||||
|
||||
Reference in New Issue
Block a user