Skip to content

Commit 0c9681b

Browse files
committed
Fix breadcrumb URLs
1 parent ce3e6bb commit 0c9681b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Http/Context/SharpBreadcrumb.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public function setCurrentInstanceLabel(?string $label): self
2727

2828
public function allSegments(): array
2929
{
30-
$url = sharp()->config()->get('custom_url_segment');
30+
$url = sharp()->config()->get('custom_url_segment')
31+
.'/'.sharp()->context()->globalFilterUrlSegmentValue();
3132

3233
return $this
3334
->breadcrumbItems()

tests/Http/BreadcrumbTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
});
2020

2121
it('builds the breadcrumb for an entity list', function () {
22-
$this
23-
->get(route('code16.sharp.list', ['person']))
22+
$this->get(route('code16.sharp.list', ['person']))
2423
->assertOk();
2524

2625
expect(sharp()->context()->isEntityList())->toBeTrue()
27-
->and(sharp()->context()->breadcrumb()->allSegments())->toHaveCount(1);
26+
->and(sharp()->context()->breadcrumb()->allSegments())->toHaveCount(1)
27+
->and(sharp()->context()->breadcrumb()->allSegments()[0]['url'])->toEqual(url('sharp/root/s-list/person'));
2828
});
2929

3030
it('builds the breadcrumb for a show page', function () {
@@ -46,8 +46,7 @@
4646
it('builds the breadcrumb for a single show page', function () {
4747
sharp()->config()->declareEntity(SinglePersonEntity::class);
4848

49-
$this
50-
->get(route('code16.sharp.single-show', 'single-person'))
49+
$this->get(route('code16.sharp.single-show', 'single-person'))
5150
->assertOk();
5251

5352
expect(sharp()->context())

0 commit comments

Comments
 (0)