Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Correct linkText value in headerLink property #673

Merged
merged 2 commits into from
Nov 14, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ lib.contentElementWithHeader {
}
headerLink = TEXT
headerLink {
field = header_link
htmlSpecialChars = 1
typolink {
parameter {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/ContentTypes/BaseContentTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ protected function checkHeaderFields($contentElement, $header = '', $subheader =
self::assertTrue(isset($contentElementContent['headerLink']), 'headerLink not set');
}

protected function checkHeaderFieldsLink($contentElement, $link, $urlPrefix, $target)
protected function checkHeaderFieldsLink($contentElement, $linkText, $urlPrefix, $target)
{
$contentElementHeaderFieldsLink = $contentElement['content']['headerLink'];

self::assertIsArray($contentElementHeaderFieldsLink, 'headerLink not an array');
self::assertEquals($link, $contentElementHeaderFieldsLink['linkText'], 'link mismatch');
self::assertEquals($linkText, $contentElementHeaderFieldsLink['linkText'], 'linkText mismatch');
self::assertStringStartsWith($urlPrefix, $contentElementHeaderFieldsLink['href'], 'url mismatch');
self::assertEquals($target, $contentElementHeaderFieldsLink['target'], 'target mismatch');
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/BasicListElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testBasicListContentElement()
$this->checkDefaultContentFields($contentElement, 6, 1, 'BasicList', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');
self::assertFalse(isset($contentElement['content']['bodytext']));
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/BulletsElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testBulletsContentElement()
$this->checkDefaultContentFields($contentElement, 8, 1, 'bullets', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');

self::assertEquals(1, $contentElement['content']['bulletsType']);
self::assertTrue(is_array($contentElement['content']['bodytext']));
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/HeaderElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function testHeaderContentElement()
$this->checkDefaultContentFields($contentElement, 3, 1, 'header', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/ShortcutElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testShortcutContentElement()
$this->checkDefaultContentFields($contentElement['content']['shortcut'][1], 1, 1, 'text', 0, 'SysCategory1Title,SysCategory2Title');
$this->checkAppearanceFields($contentElement['content']['shortcut'][1], 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement['content']['shortcut'][1], 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement['content']['shortcut'][1], 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement['content']['shortcut'][1], 'Page 1', '/page1?parameter=999&cHash=', '_blank');
self::assertStringContainsString('<a href="/page1?parameter=999&amp;cHash=', $contentElement['content']['shortcut'][1]['content']['bodytext']);
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/TableElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testTableContentElement()
$this->checkDefaultContentFields($contentElement, 7, 1, 'table', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&amp;cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&amp;cHash=', '_blank');

self::assertEquals('TableCaption', $contentElement['content']['tableCaption']);
self::assertEquals(1, $contentElement['content']['tableHeaderPosition']);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/TextElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testTextContentElement()
$this->checkDefaultContentFields($contentElement, 1, 1, 'text', 0, 'SysCategory1Title,SysCategory2Title');
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&amp;cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&amp;cHash=', '_blank');

// typolink parser was called on bodytext
self::assertStringContainsString('<a href="/page1?parameter=999&amp;cHash=', $contentElement['content']['bodytext']);
Expand Down
Loading