Skip to content

Commit

Permalink
Add sdk-support section for is-supported-script and unit tests to e…
Browse files Browse the repository at this point in the history
…nsure that expressions, paint and layout properties always have an SDK support section.
  • Loading branch information
Asheem Mamoowala committed Dec 12, 2019
1 parent fc8ff35 commit 0a98b3f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -3459,7 +3459,13 @@
},
"is-supported-script": {
"doc": "Returns `true` if the input string is expected to render legibly. Returns `false` if the input string contains sections that cannot be rendered without potential loss of meaning (e.g. Indic scripts that require complex text shaping, or right-to-left scripts if the the `mapbox-gl-rtl-text` plugin is not in use in Mapbox GL JS).",
"group": "String"
"group": "String",
"sdk-support": {
"basic functionality": {
"js": "0.45.0",
"android": "6.6.0"
}
}
},
"upcase": {
"doc": "Returns the input string converted to uppercase. Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.",
Expand Down
18 changes: 18 additions & 0 deletions test/unit/style-spec/spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ import * as spec from '../../../src/style-spec/style-spec';
});
});

test(`v8 Spec SDK Support section`, (t) => {
const v = 'v8';
const propObjs = [].concat(spec[v].paint).concat(spec[v].layout);
propObjs.forEach((objKey) => {
const props = spec[v][objKey];
const propKeys = Object.keys(props);
propKeys.forEach((key) => {
t.ok(props[key]["sdk-support"], `${objKey}_${key} is missing sdk support section`);
});
});

const expressions = spec[v].expression_name.values;
const expressionNames = Object.keys(expressions);
expressionNames.forEach((expr) => {
t.ok(expressions[expr]["sdk-support"], `expression_${expr} is missing sdk support section`);
});
t.end();
});
function validSchema(k, t, obj, ref, version, kind) {
const scalar = ['boolean', 'string', 'number'];
const types = Object.keys(ref).concat(['boolean', 'string', 'number',
Expand Down

0 comments on commit 0a98b3f

Please sign in to comment.