Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions resources/views/livewire/card.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@props(['columnId', 'record'])
@props(['columnId', 'record', 'config' => []])

@php
$processedRecordActions = $this->getBoard()->getBoardRecordActions($record);
Expand Down Expand Up @@ -33,13 +33,13 @@
@endphp

<div
@class([
{{ $attributes->class([
'flowforge-card mb-3 bg-white dark:bg-gray-900 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden transition-all duration-200 hover:shadow-md',
'cursor-pointer' => $hasActions || $hasCardAction,
'cursor-pointer transition-all duration-100 ease-in-out hover:shadow-lg hover:border-gray-400 active:shadow-md' => $hasCardAction,
'cursor-grab hover:cursor-grabbing' => $hasPositionIdentifier,
'cursor-default' => !$hasActions && !$hasCardAction && !$hasPositionIdentifier,
])
]) }}
x-sortable-item="{{ $record['id'] }}"
data-card-id="{{ $record['id'] }}"
@if($hasPositionIdentifier)
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/column.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
@endphp

<div
@class([
{{ $attributes->class([
'flowforge-column flex-shrink-0 border border-gray-200 dark:border-gray-700 shadow-sm dark:shadow-md rounded-xl flex flex-col max-h-full overflow-hidden',
'w-[300px] min-w-[300px]' => ! $isCollapsed,
'flowforge-column-collapsed w-12 min-w-12' => $isCollapsed,
])
]) }}
{{-- SortableJS stops propagation inside its own container, so the header and
footer of a rail need their own hook to register as hovered. --}}
x-on:dragenter="dragOverColumn = @js($columnId)"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/modern/livewire/column.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@endphp

<div
class="ff-column"
{{ $attributes->class('ff-column') }}
data-column-root="{{ $columnId }}"
data-column-total="{{ $column['limitTotal'] ?? $total }}"
@if (($column['limit'] ?? null) !== null) data-column-limit="{{ $column['limit'] }}" @endif
Expand Down
19 changes: 19 additions & 0 deletions tests/Browser/ModernBoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,25 @@ function boardTraySampler(int $budgetMilliseconds): string
expect($page->script("document.querySelector('{$root}').hasAttribute('data-collapsed')"))->toBeFalse();
});

test('the add card spinner stays in its own column after a column is inserted before it', function () {
boardSeed();
$page = boardPage('/modern/test-collapsible-board');

$page->script("Livewire.find(document.querySelector('[data-column-root]').closest('[wire\\\\:id]').getAttribute('wire:id')).\$set('showAllColumns', true)");
$page->assertSee('Hidden Column');
boardHoldUpdates($page);
$page->script("document.querySelector('[data-column-root=\"in_progress\"] .ff-add-row').click()");
Pointer::on($page)->wait(400);

expect($page->script(<<<'JS'
[...document.querySelectorAll('.fi-loading-indicator')]
.filter((spinner) => spinner.getClientRects().length > 0)
.map((spinner) => spinner.closest('[data-column-root]')?.dataset.columnRoot)
JS))->toBe(['in_progress']);

boardReleaseUpdates($page);
});

test('a collapsed column widens while a card hovers it and accepts the drop', function () {
[$a] = boardSeed();
$page = boardPage('/modern/test-collapsible-board');
Expand Down
13 changes: 13 additions & 0 deletions tests/Modern/Feature/LivewireBoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Relaticle\Flowforge\Services\DecimalPosition;
use Relaticle\Flowforge\Tests\Fixtures\Modern\Task;
use Relaticle\Flowforge\Tests\Fixtures\Modern\TestBoard;
use Relaticle\Flowforge\Tests\Fixtures\TestBoard as ClassicTestBoard;

describe('board rendering', function () {
test('renders board with all columns', function () {
Expand All @@ -26,6 +27,18 @@
->assertDontSeeHtml('<x-filament');
});

test('keys every column and card so a morph never reuses another column', function (string $board, string $cardKey) {
$task = Task::factory()->todo()->create();

Livewire::test($board)
->assertSeeHtml('wire:key="column-todo"')
->assertSeeHtml('wire:key="column-in_progress"')
->assertSeeHtml("wire:key=\"{$cardKey}{$task->getKey()}\"");
})->with([
'modern' => [TestBoard::class, 'card-board-'],
'classic' => [ClassicTestBoard::class, 'card-'],
]);

test('renders board with unhidden column', function () {
Livewire::test(TestBoard::class)
->assertStatus(200)
Expand Down
Loading