-
Notifications
You must be signed in to change notification settings - Fork 108
Split item menu tests #132
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
Conversation
Codecov Report
@@ Coverage Diff @@
## split-item-builder #132 +/- ##
=======================================================
+ Coverage 87.18% 94.4% +7.21%
+ Complexity 418 417 -1
=======================================================
Files 26 26
Lines 1280 1287 +7
=======================================================
+ Hits 1116 1215 +99
+ Misses 164 72 -92
Continue to review full report at Codecov.
|
|
||
$length -= $this->margin; | ||
|
||
$length = floor($style->getContentWidth() / $numberOfItems) - $this->margin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$length = $style->getDisplaysExtra()
? floor($style->getContentWidth() / $numberOfItems) - $this->margin - (mb_strlen($style->getItemExtra()) + 2)
: floor($style->getContentWidth() / $numberOfItems) - $this->margin;
array_map(function ($index, $item) use ($selected, $length, $style) { | ||
$isSelected = $selected && $index === $this->selectedItemIndex; | ||
$marker = $item->canSelect() | ||
? sprintf('%s ', $style->getMarker($isSelected)) | ||
: ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$itemExtra = $style->getDisplaysExtra() && $item->showsItemExtra()
? sprintf(' %s', $style->getItemExtra())
: '';
explode("\n", StringUtil::wordwrap(sprintf('%s%s', $marker, $item->getText()), $length)), | ||
$length, | ||
$style, | ||
$isSelected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the $itemExtra
variable too
); | ||
} | ||
|
||
private function buildCell(array $content, int $length, MenuStyle $style, bool $isSelected) : array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the string $itemExtra
argument
src/MenuItem/SplitItem.php
Outdated
|
||
return $rows; | ||
return sprintf( | ||
'%s%s%s%s%s', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one %s
'%s%s%s%s%s', | ||
$invertedColoursSetCode, | ||
$row, | ||
str_repeat(' ', $length - mb_strlen($row)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and insert this just after that line:
$itemExtra,
No description provided.