From acd57f7a055a0a89acef419dacec8c162812212a Mon Sep 17 00:00:00 2001 From: Ryan Mark Date: Fri, 4 Sep 2026 12:50:04 -0700 Subject: [PATCH 1/4] Find a scoped + + ; + `); + + let emitted = virtualImportUrlsOf(output).map(decodeURIComponent).join(''); + + // Soft, so one run shows both halves of the loss rather than stopping at + // the first: the stylesheet was not emitted, and addInfo() never ran + // either, so the class was never collected and the CSS could not have + // matched the element anyway. + expect.soft(emitted).toContain('.scoped'); + expect + .soft(templateContentsOf(output).join('')) + .toMatch(/class="scoped_\w+"/); + }); + + it('leaves a preceding global + + ; + `); + + let template = templateContentsOf(output).join(''); + + // The global block is deliberately not scoped, so it ships as written. + expect(template).toContain('.global { color: red; }'); + // The scoped one is extracted to a stylesheet, so its tag is removed. + expect(template).not.toContain('.scoped'); + }); + + it('refuses a second + + ; + `); + + // Supporting several blocks is a larger question; until it is answered, + // an error beats emitting the first and silently discarding the second. + await expect(build()).rejects.toThrow( + /Only one ", + ] + `); + expect(virtualImportUrlsOf(output)).toMatchInlineSnapshot(` + [ + "./e65d154a1___css-68ede36d709bfa7f8a2994e1702ef010.ember-scoped.css?css=%0A%20%20%20%20%20%20%20%20%20%20.scoped%20%7B%20color%3A%20blue%3B%20%7D%0A%20%20%20%20%20%20%20%20", + ] + `); }); - it('leaves a preceding global ; `); - let template = templateContentsOf(output).join(''); - - // The global block is deliberately not scoped, so it ships as written. - expect(template).toContain('.global { color: red; }'); - // The scoped one is extracted to a stylesheet, so its tag is removed. - expect(template).not.toContain('.scoped'); - }); - - it('refuses a second - - ; - `); - - // Supporting several blocks is a larger question; until it is answered, - // an error beats emitting the first and silently discarding the second. - await expect(build()).rejects.toThrow( + await expect(build).rejects.toThrow( /Only one