reviewed epic 5 & 6 stories

This commit is contained in:
Naser Mansour
2025-12-21 00:16:16 +02:00
parent ad2d9604b8
commit b2977c00d6
14 changed files with 4292 additions and 313 deletions
+84 -2
View File
@@ -16,6 +16,12 @@ So that **I can read legal updates and articles from the firm**.
- **Follows pattern:** Public content display
- **Touch points:** Navigation, homepage
### Assumptions
- Post model exists with `published()` scope (from Story 5.1)
- Post model has locale-aware `title`, `body`, and `excerpt` accessors (from Story 5.1)
- Bilingual infrastructure is in place (from Epic 1)
- Base navigation includes link to posts section (from Epic 1)
## Acceptance Criteria
### Posts Listing Page
@@ -173,6 +179,82 @@ new class extends Component {
}
```
## Testing Requirements
### Feature Tests
```php
use App\Models\Post;
use Livewire\Volt\Volt;
test('posts listing page shows only published posts', function () {
Post::factory()->create(['status' => 'published', 'title_en' => 'Published Post']);
Post::factory()->create(['status' => 'draft', 'title_en' => 'Draft Post']);
$this->get(route('posts.index'))
->assertOk()
->assertSee('Published Post')
->assertDontSee('Draft Post');
});
test('posts displayed in reverse chronological order', function () {
$older = Post::factory()->create(['status' => 'published', 'created_at' => now()->subDays(5)]);
$newer = Post::factory()->create(['status' => 'published', 'created_at' => now()]);
$this->get(route('posts.index'))
->assertOk()
->assertSeeInOrder([$newer->title, $older->title]);
});
test('posts listing page paginates results', function () {
Post::factory()->count(15)->create(['status' => 'published']);
$this->get(route('posts.index'))
->assertOk()
->assertSee('Next'); // pagination link
});
test('individual post page shows full content', function () {
$post = Post::factory()->create(['status' => 'published']);
$this->get(route('posts.show', $post))
->assertOk()
->assertSee($post->title)
->assertSee($post->body);
});
test('individual post page returns 404 for unpublished posts', function () {
$post = Post::factory()->create(['status' => 'draft']);
$this->get(route('posts.show', $post))
->assertNotFound();
});
test('individual post page returns 404 for non-existent posts', function () {
$this->get(route('posts.show', 999))
->assertNotFound();
});
```
### Language/RTL Tests
- [ ] Arabic content displays correctly with RTL direction
- [ ] English content displays correctly with LTR direction
- [ ] Date formatting respects locale (`translatedFormat`)
- [ ] Back link text displays in current language
### Responsive Tests
- [ ] Mobile layout renders correctly (single column, touch-friendly)
- [ ] Tablet layout renders correctly
- [ ] Typography remains readable at all breakpoints
### Key Test Scenarios
| Scenario | Expected Result |
|----------|-----------------|
| Visit /posts as guest | Shows published posts list |
| Visit /posts with no posts | Shows "no posts" message |
| Visit /posts/{id} for published post | Shows full post content |
| Visit /posts/{id} for draft post | Returns 404 |
| Switch language on posts page | Content displays in selected language |
## Definition of Done
- [ ] Posts listing page works
@@ -189,8 +271,8 @@ new class extends Component {
## Dependencies
- **Story 5.1:** Post creation
- **Epic 1:** Base UI, navigation
- **Story 5.1:** Post creation (provides Post model with `published()` scope, `title`, `body`, `excerpt` accessors - see Database Schema and Post Model sections)
- **Epic 1:** Base UI, navigation, bilingual infrastructure
## Estimation