Skip to content

Commit

Permalink
use spec in expression test
Browse files Browse the repository at this point in the history
  • Loading branch information
birkskyum committed Nov 17, 2024
1 parent e56dada commit cdc0307
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/expression/expression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,15 +645,7 @@ describe('projection expression', () => {
})

test('step array', () => {
const response = createExpression(['step', ['zoom'], ['literal', ['vertical-perspective', 'mercator', 0.5]], 10, 'mercator'], {
type: 'projectionDefinition',
transition: false,
'property-type': 'data-constant',
expression: {
interpolated: true,
parameters: ['zoom']
}
});
const response = createExpression(['step', ['zoom'], ['literal', ['vertical-perspective', 'mercator', 0.5]], 10, 'mercator'], v8.projection.type as StylePropertySpecification);

if (response.result === 'success') {
expect(response.value.evaluate({zoom: 5})).toStrictEqual(['vertical-perspective', 'mercator', 0.5]);
Expand All @@ -665,15 +657,7 @@ describe('projection expression', () => {
})

test('interpolate', () => {
const response = createExpression(['interpolate', ['linear'], ['zoom'], 8, 'vertical-perspective', 10, 'mercator'], {
type: 'projectionDefinition',
transition: false,
'property-type': 'data-constant',
expression: {
interpolated: true,
parameters: ['zoom']
}
});
const response = createExpression(['interpolate', ['linear'], ['zoom'], 8, 'vertical-perspective', 10, 'mercator'], v8.projection.type as StylePropertySpecification);

if (response.result === 'success') {
expect(response.value.evaluate({zoom: 5})).toBe('vertical-perspective');
Expand Down
1 change: 1 addition & 0 deletions src/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -4580,6 +4580,7 @@
"doc": "The projection definition type. Can be specified as a string, a transition state, or an expression.",
"default": "mercator",
"property-type": "data-constant",
"transition": false,
"expression": {
"interpolated": true,
"parameters": [
Expand Down

0 comments on commit cdc0307

Please sign in to comment.