File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -3215,6 +3215,7 @@ class Style extends Evented<MapEvents> {
32153215 metadata : this . stylesheet . metadata ,
32163216 fragment : this . stylesheet . fragment ,
32173217 iconsets : this . stylesheet . iconsets ,
3218+ featuresets : this . stylesheet . featuresets ,
32183219 imports : this . _serializeImports ( ) ,
32193220 schema : this . stylesheet . schema ,
32203221 camera : this . stylesheet . camera ,
Original file line number Diff line number Diff line change @@ -3339,7 +3339,8 @@ test('Style#serialize', async () => {
33393339 sources : { 'mapbox-dem' : { type : 'raster-dem' , tiles : [ 'http://example.com/{z}/{x}/{y}.png' ] } } ,
33403340 terrain : { source : 'mapbox-dem' , exaggeration : 1.5 } ,
33413341 projection : { name : 'globe' } ,
3342- transition : { duration : 900 , delay : 200 }
3342+ transition : { duration : 900 , delay : 200 } ,
3343+ featuresets : { 'test-featureset' : { selectors : [ { layer : 'background' } ] } }
33433344 } ) ;
33443345
33453346 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -3359,6 +3360,7 @@ test('Style#serialize', async () => {
33593360 expect ( serialized . terrain ) . toBeFalsy ( ) ;
33603361 expect ( serialized . projection ) . toBeFalsy ( ) ;
33613362 expect ( serialized . transition ) . toBeFalsy ( ) ;
3363+ expect ( serialized . featuresets ) . toBeFalsy ( ) ;
33623364 expect ( serialized . sources ) . toEqual ( { } ) ;
33633365
33643366 resolve ( ) ;
Original file line number Diff line number Diff line change @@ -174,4 +174,22 @@ describe('Map#getStyle', () => {
174174 map . setStyle ( style , { diff : false } ) ;
175175 expect ( map . style && map . style !== previousStyle ) . toBeTruthy ( ) ;
176176 } ) ;
177+
178+ test ( 'returns the style with featuresets' , async ( ) => {
179+ const style = createStyle ( ) ;
180+ style [ 'featuresets' ] = {
181+ 'my-featureset' : {
182+ 'selectors' : [ { 'layer' : 'background' } ]
183+ }
184+ } ;
185+ style [ 'layers' ] = [ { 'id' : 'background' , 'type' : 'background' } ] ;
186+ const map = createMap ( { style} ) ;
187+
188+ await waitFor ( map , 'load' ) ;
189+ expect ( map . getStyle ( ) . featuresets ) . toEqual ( {
190+ 'my-featureset' : {
191+ 'selectors' : [ { 'layer' : 'background' } ]
192+ }
193+ } ) ;
194+ } ) ;
177195} ) ;
You can’t perform that action at this time.
0 commit comments