withUnencryptedCookie('appearance', $cookie); } $response = $this->get(route('home')); $response->assertOk() ->assertSee('data-appearance="'.$expected.'"', false) ->assertInertia(fn (Assert $page) => $page->where('appearance', $expected)) ->assertDontSee('fonts.bunny.net', false) ->assertDontSee('Instrument Sans', false) ->assertSee('fonts/inter/InterVariable.woff2', false); preg_match('/]+>/', $response->getContent(), $matches); $this->assertSame($expected === 'dark', str_contains($matches[0], 'class="dark"')); $this->assertStringContainsString(file_get_contents(resource_path('css/theme.css')), $response->getContent()); } /** @return array */ public static function appearanceCookies(): array { return [ 'default' => [null, 'system'], 'light' => ['light', 'light'], 'dark' => ['dark', 'dark'], 'system' => ['system', 'system'], 'invalid' => ['invalid', 'system'], 'empty' => ['', 'system'], 'malformed' => ['', 'system'], ]; } public function test_theme_behaviour_and_contrast(): void { $process = new Process(['node', 'tests/Fixtures/appearance.mjs'], base_path()); $process->setTimeout(60); $process->run(); $this->assertTrue($process->isSuccessful(), $process->getOutput().$process->getErrorOutput()); $this->assertStringContainsString('Appearance behavior checks passed.', $process->getOutput()); } public function test_inter_is_bundled_with_its_license(): void { foreach (['InterVariable.woff2', 'InterVariable-Italic.woff2'] as $font) { $this->assertSame('wOF2', file_get_contents(public_path('fonts/inter/'.$font), false, null, 0, 4)); } $this->assertStringContainsString('SIL OPEN FONT LICENSE', file_get_contents(public_path('fonts/inter/LICENSE.txt'))); } }