Skip to content

Commit

Permalink
Serialize formatted section's text-color option to rgba expression
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshalamov committed Aug 15, 2019
1 parent c8f5258 commit f818169
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/style-spec/expression/types/formatted.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Formatted {
return this.sections.map(section => section.text).join('');
}

serialize() {
serialize(): Array<mixed> {
const serialized = ["format"];
for (const section of this.sections) {
serialized.push(section.text);
Expand All @@ -43,7 +43,7 @@ export default class Formatted {
options["font-scale"] = section.scale;
}
if (section.textColor) {
options["text-color"] = ["literal", section.textColor];
options["text-color"] = ["rgba"].concat(section.textColor.toArray());
}
serialized.push(options);
}
Expand Down
10 changes: 1 addition & 9 deletions test/integration/expression-tests/format/basic/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,7 @@
},
"d",
{
"text-color": [
"literal",
{
"a": 1,
"b": 0,
"g": 1,
"r": 0
}
]
"text-color": ["rgba", 0, 255, 0, 1]
}
]
}
Expand Down

0 comments on commit f818169

Please sign in to comment.