diff --git a/app/Http/Controllers/ToolController.php b/app/Http/Controllers/ToolController.php index 8d6782c..610ea5c 100644 --- a/app/Http/Controllers/ToolController.php +++ b/app/Http/Controllers/ToolController.php @@ -69,6 +69,12 @@ public function index(): View 'route' => 'tools.code-editor', 'icon' => 'editor', ], + [ + 'name' => 'Diff Checker', + 'description' => 'Compare two texts and highlight differences', + 'route' => 'tools.diff', + 'icon' => 'diff', + ], ]; return view('home', compact('tools')); @@ -123,4 +129,9 @@ public function codeEditor(): View { return view('tools.code-editor'); } + + public function diff(): View + { + return view('tools.diff'); + } } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 7de13c3..c5a5039 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -84,6 +84,11 @@ @break + @case('diff') + + + + @break @endswitch
diff --git a/resources/views/tools/diff.blade.php b/resources/views/tools/diff.blade.php new file mode 100644 index 0000000..3b2869c --- /dev/null +++ b/resources/views/tools/diff.blade.php @@ -0,0 +1,336 @@ +@extends('layouts.app') + +@section('title', 'Diff Checker - Compare Text Online | Dev Tools') +@section('meta_description', 'Free online diff checker. Compare two texts side by side, highlight differences, and see additions, deletions, and changes. Perfect for code review.') +@section('meta_keywords', 'diff checker, text compare, diff tool, compare files, code diff, text difference, online diff') + +@push('schema') + +@endpush + +@section('content') +
+
+
+

Diff Checker

+

Compare two texts and highlight differences

+
+ ← Back +
+ + +
+
+
+ + +
+ +
+ +
+
+ + +
+ +
+
+ + +
+
+ + + +
+ +
+ + + +
+
+ + +
+
+ added +
+
+ removed +
+
+ unchanged +
+
+ + +
+
+
+ Original +
+
+ Modified +
+
+
+
+ +
+ +
+ +
+ +
+
+
+
+ + +
+ + + +

Enter text in both fields and click Compare to see differences

+
+
+@endsection + +@push('scripts') + +@endpush diff --git a/routes/web.php b/routes/web.php index ebacbfc..7b2bf98 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,6 +16,7 @@ Route::get('/hash', [ToolController::class, 'hash'])->name('hash'); Route::get('/url', [ToolController::class, 'url'])->name('url'); Route::get('/code-editor', [ToolController::class, 'codeEditor'])->name('code-editor'); + Route::get('/diff', [ToolController::class, 'diff'])->name('diff'); }); // Static Pages @@ -36,6 +37,7 @@ ['loc' => route('tools.hash'), 'priority' => '0.8', 'changefreq' => 'monthly'], ['loc' => route('tools.url'), 'priority' => '0.8', 'changefreq' => 'monthly'], ['loc' => route('tools.code-editor'), 'priority' => '0.9', 'changefreq' => 'monthly'], + ['loc' => route('tools.diff'), 'priority' => '0.8', 'changefreq' => 'monthly'], ['loc' => route('about'), 'priority' => '0.5', 'changefreq' => 'monthly'], ['loc' => route('privacy'), 'priority' => '0.3', 'changefreq' => 'yearly'], ]; diff --git a/tests/Feature/WebRoutesTest.php b/tests/Feature/WebRoutesTest.php index 5acbe3a..22b8f1e 100644 --- a/tests/Feature/WebRoutesTest.php +++ b/tests/Feature/WebRoutesTest.php @@ -28,6 +28,7 @@ public function test_home_page_displays_all_tools(): void $response->assertSee('Hash Generator'); $response->assertSee('URL Encoder'); $response->assertSee('Code Editor'); + $response->assertSee('Diff Checker'); } public function test_home_page_has_tool_links(): void @@ -44,6 +45,7 @@ public function test_home_page_has_tool_links(): void $response->assertSee('href="' . route('tools.hash') . '"', false); $response->assertSee('href="' . route('tools.url') . '"', false); $response->assertSee('href="' . route('tools.code-editor') . '"', false); + $response->assertSee('href="' . route('tools.diff') . '"', false); } public function test_csv_tool_page_loads(): void @@ -230,9 +232,28 @@ public function test_code_editor_has_required_elements(): void $response->assertSee('monaco-container'); } + public function test_diff_tool_page_loads(): void + { + $response = $this->get('/tools/diff'); + + $response->assertStatus(200); + $response->assertSee('Diff Checker'); + $response->assertSee('Compare two texts'); + } + + public function test_diff_tool_has_required_elements(): void + { + $response = $this->get('/tools/diff'); + + $response->assertStatus(200); + $response->assertSee('Original Text'); + $response->assertSee('Modified Text'); + $response->assertSee('Compare'); + } + public function test_all_pages_have_navigation(): void { - $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor']; + $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor', '/tools/diff']; foreach ($pages as $page) { $response = $this->get($page); @@ -244,7 +265,7 @@ public function test_all_pages_have_navigation(): void public function test_all_pages_have_theme_toggle(): void { - $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor']; + $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/code-editor', '/tools/diff']; foreach ($pages as $page) { $response = $this->get($page); @@ -257,7 +278,7 @@ public function test_all_pages_have_theme_toggle(): void public function test_all_pages_load_vite_assets(): void { // Code editor uses standalone template without Vite - $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url']; + $pages = ['/', '/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/diff']; foreach ($pages as $page) { $response = $this->get($page); @@ -270,7 +291,7 @@ public function test_all_pages_load_vite_assets(): void public function test_all_tool_pages_have_back_link(): void { // Code editor uses standalone template with home link instead of back - $toolPages = ['/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url']; + $toolPages = ['/tools/csv', '/tools/yaml', '/tools/markdown', '/tools/sql', '/tools/base64', '/tools/uuid', '/tools/hash', '/tools/url', '/tools/diff']; foreach ($toolPages as $page) { $response = $this->get($page);