@@ -217,7 +217,24 @@ describe('HTML Visibility Analyzer', () => {
217217 expect ( text ) . to . not . include ( 'Manage consent preferences' ) ;
218218 } ) ;
219219
220- it ( 'should remove custom cookie modal via [class*="cookie-modal"] (e.g. Shangri-La .sl-cookie-modal)' , async ( ) => {
220+ it ( 'should remove generic cookie modal (.cookie-modal)' , async ( ) => {
221+ const html = `<html><body>
222+ <h1>Welcome</h1>
223+ <p>Main page content.</p>
224+ <div class="cookie-modal">
225+ <div>We use cookies to enhance your experience. Accept all cookies or manage your preferences.</div>
226+ </div>
227+ </body></html>` ;
228+
229+ const text = await stripTagsToText ( html , true ) ;
230+
231+ expect ( text ) . to . include ( 'Welcome' ) ;
232+ expect ( text ) . to . include ( 'Main page content.' ) ;
233+ expect ( text ) . to . not . include ( 'We use cookies' ) ;
234+ expect ( text ) . to . not . include ( 'Accept all cookies' ) ;
235+ } ) ;
236+
237+ it ( 'should remove Shangri-La custom cookie modal (.sl-cookie-modal)' , async ( ) => {
221238 const html = `<html><body>
222239 <h1>Summer Aqua Pilates</h1>
223240 <p>Experience a refreshing workout in water.</p>
@@ -242,12 +259,30 @@ describe('HTML Visibility Analyzer', () => {
242259 expect ( text ) . to . not . include ( 'Accept All' ) ;
243260 } ) ;
244261
245- it ( 'should not remove a [class*="cookie-modal"] element when content does not indicate consent' , async ( ) => {
246- // The substring selector matches the element, but the text-content gate
247- // must keep it because the copy carries none of the consent keywords.
262+ it ( 'should not strip body when scroll-lock class contains "cookie-modal" substring (Shangri-La regression)' , async ( ) => {
263+ // Regression for LLMO-7680: Shangri-La applies sl-cookie-modal-body-hidden to <body>
264+ // while the modal is open. The old substring-based selector matched <body>
265+ // itself, stripping all page content and undercounting client-side words.
266+ const html = `<html><body class="text-font dirltr SHANGRILA sl-header-shangrila sl-cookie-modal-body-hidden">
267+ <h1>Meetings & Events</h1>
268+ <p>Host your event at Boracay Resort.</p>
269+ <div class="sl-cookie-modal">
270+ <div>We use cookies to enhance your experience. Accept all cookies.</div>
271+ </div>
272+ </body></html>` ;
273+
274+ const text = await stripTagsToText ( html , true ) ;
275+
276+ expect ( text ) . to . include ( 'Meetings' ) ;
277+ expect ( text ) . to . include ( 'Host your event at Boracay Resort.' ) ;
278+ expect ( text ) . to . not . include ( 'We use cookies to enhance' ) ;
279+ expect ( text ) . to . not . include ( 'Accept all cookies' ) ;
280+ } ) ;
281+
282+ it ( 'should not remove a class-named element when content does not indicate consent' , async ( ) => {
248283 const html = `<html><body>
249284 <h1>Summer Sale</h1>
250- <div class="promo- cookie-modal">Limited time offer on swimwear this weekend.</div>
285+ <div class="cookie-modal">Limited time offer on swimwear this weekend.</div>
251286 <p>Shop the new collection now.</p>
252287 </body></html>` ;
253288
0 commit comments