forked from fa/breadcrumb-the-shire
feat(js): enforce global lifecycle hard-cuts and helpdesk list adapter
This commit is contained in:
@@ -21,6 +21,19 @@ final class FrontendJsContractsTest extends TestCase
|
||||
$this->assertSame([], $violations, "window.alert usage found in frontend JS scope:\n" . implode("\n", $violations));
|
||||
}
|
||||
|
||||
public function testFrontendJsDoesNotUseDomReadyAutoInitPatterns(): void
|
||||
{
|
||||
$violations = $this->findPatternMatchesInFiles('web/js', '/DOMContentLoaded|document\.readyState/', ['js']);
|
||||
foreach ($this->moduleJsDirectories() as $moduleJsDir) {
|
||||
$violations = array_merge($violations, $this->findPatternMatchesInFiles($moduleJsDir, '/DOMContentLoaded|document\.readyState/', ['js']));
|
||||
}
|
||||
|
||||
$violations = array_values(array_unique($violations));
|
||||
sort($violations);
|
||||
|
||||
$this->assertSame([], $violations, "DOM-ready auto-init pattern found in frontend JS scope:\n" . implode("\n", $violations));
|
||||
}
|
||||
|
||||
public function testHelpdeskRuntimeComponentsDoNotAutoInitialize(): void
|
||||
{
|
||||
foreach ($this->helpdeskRuntimeComponentFiles() as $file) {
|
||||
|
||||
Reference in New Issue
Block a user