@@ -101,25 +101,60 @@ test.describe('<mapml-viewer> localization tests', () => {
101101 'lmExtentSettings'
102102 ] ;
103103
104+ const layerNames = [ 'dfLayer' , 'dfExtent' ] ;
105+
104106 for ( const [ language , locale ] of locales ) {
105- // select the current map
107+ // select the current map and layer menu
106108 const map = await page . getByTestId ( language ) ;
107-
108- // check all setting buttons
109109 const layerMenu = await map . locator (
110110 '.leaflet-control-layers.leaflet-control'
111111 ) ;
112+
113+ // check all setting buttons
112114 const buttons = await layerMenu . locator ( '.mapml-button' ) ;
113115 const buttonCount = await buttons . count ( ) ;
114- expect ( buttonCount ) . toBe ( buttonNames . length ) ;
115- for ( let i = 0 ; i < buttonCount ; i ++ ) {
116+ expect ( buttonCount ) . toBeGreaterThan ( buttonNames . length ) ;
117+ for ( let i = 0 ; i < buttonNames . length ; i ++ ) {
116118 const button = buttons . nth ( i ) ;
117119 const text = await button . getAttribute ( 'title' ) ;
118120 expect ( text ) . toBeTruthy ( ) ;
119- expect ( text . startsWith ( locale [ buttonNames [ i ] ] ) ) . toBe ( true ) ;
121+ expect ( text ) . toBe ( locale [ buttonNames [ i ] ] ) ;
120122 }
121123
122- // check opacity and default layer/extent names
124+ // check layer opacity
125+ const layerOpacity = await layerMenu . locator (
126+ '.mapml-layer-item-opacity.mapml-control-layers'
127+ ) ;
128+ const layerOpacityText = await layerOpacity . nth ( 1 ) . textContent ( ) ;
129+ expect ( layerOpacityText ) . toBeTruthy ( ) ;
130+ expect ( layerOpacityText ) . toBe ( locale . lcOpacity ) ;
131+
132+ // check extent opacity
133+ const extentOpacity = await layerMenu . locator (
134+ '.mapml-layer-item-details.mapml-control-layers'
135+ ) ;
136+ const extentOpacityText = await extentOpacity . textContent ( ) ;
137+ expect ( extentOpacityText ) . toBeTruthy ( ) ;
138+ expect ( extentOpacityText ) . toBe ( locale . lcOpacity ) ;
139+
140+ // check default layer/extent names
141+ const layers = await layerMenu . locator ( '.mapml-layer-item-toggle' ) ;
142+ const layerCount = await layers . count ( ) ;
143+ expect ( layerCount ) . toBeGreaterThan ( layerNames . length ) ;
144+ for ( let i = 0 ; i < layerNames . length ; i ++ ) {
145+ const layer = layers . nth ( i ) ;
146+ const layerName = await layer . textContent ( ) ;
147+ expect ( layerName ) . toBeTruthy ( ) ;
148+ expect ( layerName ) . toBe ( locale [ layerNames [ i ] ] ) ;
149+ }
150+
151+ // check layer style
152+ const style = await layerMenu . locator (
153+ '.mapml-layer-item-style.mapml-control-layers summary'
154+ ) ;
155+ const styleText = await style . textContent ( ) ;
156+ expect ( styleText ) . toBeTruthy ( ) ;
157+ expect ( styleText ) . toBe ( locale . lmStyle ) ;
123158 }
124159 } ) ;
125160
0 commit comments