@@ -11,7 +11,7 @@ import {OverscaledTileID} from '../tile/tile_id';
1111import { fakeServer , type FakeServer } from 'nise' ;
1212
1313import { type EvaluationParameters } from './evaluation_parameters' ;
14- import { Color , type Feature , type LayerSpecification , type GeoJSONSourceSpecification , type FilterSpecification , type SourceSpecification , type StyleSpecification , type SymbolLayerSpecification , type SkySpecification } from '@maplibre/maplibre-gl-style-spec' ;
14+ import { Color , type Feature , type LayerSpecification , type GeoJSONSourceSpecification , type FilterSpecification , type SourceSpecification , type StyleSpecification , type SymbolLayerSpecification , type SkySpecification , type AllPaintProperties , type AllLayoutProperties } from '@maplibre/maplibre-gl-style-spec' ;
1515import { type GeoJSONSource } from '../source/geojson_source' ;
1616import { StubMap , sleep , waitForEvent } from '../util/test/util' ;
1717import { RTLPluginLoadedEventName } from '../source/rtl_text_plugin_status' ;
@@ -2626,7 +2626,7 @@ describe('Style.setPaintProperty', () => {
26262626 } ) ;
26272627
26282628 await style . once ( 'style.load' ) ;
2629- const value = { stops : [ [ 0 , 'red' ] , [ 10 , 'blue' ] ] } ;
2629+ const value : AllPaintProperties [ 'background-color' ] = { type : 'exponential' , stops : [ [ 0 , 'red' ] , [ 10 , 'blue' ] ] } ;
26302630 style . setPaintProperty ( 'background' , 'background-color' , value ) ;
26312631 expect ( style . getPaintProperty ( 'background' , 'background-color' ) ) . not . toBe ( value ) ;
26322632 expect ( style . _changed ) . toBeTruthy ( ) ;
@@ -2684,13 +2684,13 @@ describe('Style.getPaintProperty', () => {
26842684 } ) ;
26852685
26862686 await style . once ( 'style.load' ) ;
2687- style . setPaintProperty ( 'background' , 'background-color' , { stops : [ [ 0 , 'red' ] , [ 10 , 'blue' ] ] } ) ;
2687+ style . setPaintProperty ( 'background' , 'background-color' , { type : 'exponential' , stops : [ [ 0 , 'red' ] , [ 10 , 'blue' ] ] } ) ;
26882688 style . update ( { } as EvaluationParameters ) ;
26892689 expect ( style . _changed ) . toBeFalsy ( ) ;
26902690
2691- const value = style . getPaintProperty ( 'background' , 'background-color' ) ;
2692- value [ ' stops' ] [ 0 ] [ 0 ] = 1 ;
2693- style . setPaintProperty ( 'background' , 'background-color' , value ) ;
2691+ const value = style . getPaintProperty ( 'background' , 'background-color' ) as { type : string ; stops : [ number , string ] [ ] } ;
2692+ value . stops [ 0 ] [ 0 ] = 1 ;
2693+ style . setPaintProperty ( 'background' , 'background-color' , value as AllPaintProperties [ 'background-color' ] ) ;
26942694 expect ( style . _changed ) . toBeTruthy ( ) ;
26952695 } ) ;
26962696} ) ;
@@ -2719,7 +2719,7 @@ describe('Style.setLayoutProperty', () => {
27192719 } ) ;
27202720
27212721 await style . once ( 'style.load' ) ;
2722- const value = { stops : [ [ 0 , 'butt' ] , [ 10 , 'round' ] ] } ;
2722+ const value : AllLayoutProperties [ 'line-cap' ] = { type : 'exponential' , stops : [ [ 0 , 'butt' ] , [ 10 , 'round' ] ] } ;
27232723 style . setLayoutProperty ( 'line' , 'line-cap' , value ) ;
27242724 expect ( style . getLayoutProperty ( 'line' , 'line-cap' ) ) . not . toBe ( value ) ;
27252725 expect ( style . _changed ) . toBeTruthy ( ) ;
@@ -2758,13 +2758,13 @@ describe('Style.setLayoutProperty', () => {
27582758 const lineLayer = style . getLayer ( 'line' ) ;
27592759 const validate = vi . spyOn ( lineLayer , '_validate' ) ;
27602760
2761- style . setLayoutProperty ( 'line' , 'line-cap' , 'invalidcap' , { validate : false } ) ;
2761+ style . setLayoutProperty ( 'line' , 'line-cap' , 'invalidcap' as any , { validate : false } ) ;
27622762 expect ( validate . mock . calls [ 0 ] [ 4 ] ) . toEqual ( { validate : false } ) ;
27632763 expect ( mockConsoleError ) . not . toHaveBeenCalled ( ) ;
27642764 expect ( style . _changed ) . toBeTruthy ( ) ;
27652765 style . update ( { } as EvaluationParameters ) ;
27662766
2767- style . setLayoutProperty ( 'line' , 'line-cap' , 'differentinvalidcap' ) ;
2767+ style . setLayoutProperty ( 'line' , 'line-cap' , 'differentinvalidcap' as any ) ;
27682768 expect ( mockConsoleError ) . toHaveBeenCalledTimes ( 1 ) ;
27692769 expect ( validate . mock . calls [ 1 ] [ 4 ] ) . toEqual ( { } ) ;
27702770 } ) ;
@@ -2794,11 +2794,11 @@ describe('Style.getLayoutProperty', () => {
27942794 } ) ;
27952795
27962796 await style . once ( 'style.load' ) ;
2797- style . setLayoutProperty ( 'line' , 'line-cap' , { stops : [ [ 0 , 'butt' ] , [ 10 , 'round' ] ] } ) ;
2797+ style . setLayoutProperty ( 'line' , 'line-cap' , { type : 'exponential' , stops : [ [ 0 , 'butt' ] , [ 10 , 'round' ] ] } ) ;
27982798 style . update ( { } as EvaluationParameters ) ;
27992799 expect ( style . _changed ) . toBeFalsy ( ) ;
28002800
2801- const value = style . getLayoutProperty ( 'line' , 'line-cap' ) ;
2801+ const value : AllLayoutProperties [ 'line-cap' ] = style . getLayoutProperty ( 'line' , 'line-cap' ) ;
28022802 value . stops [ 0 ] [ 0 ] = 1 ;
28032803 style . setLayoutProperty ( 'line' , 'line-cap' , value ) ;
28042804 expect ( style . _changed ) . toBeTruthy ( ) ;
0 commit comments