Skip to content

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

Merged
merged 13 commits into from
May 13, 2018
Merged

Split item menu tests #132

merged 13 commits into from
May 13, 2018

Conversation

AydinHassan
Copy link
Member

No description provided.

@codecov-io
Copy link

codecov-io commented May 13, 2018

Codecov Report

Merging #132 into split-item-builder will increase coverage by 7.21%.
The diff coverage is 100%.

Impacted file tree graph

@@                   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
Impacted Files Coverage Δ Complexity Δ
src/MenuItem/SplitItem.php 100% <100%> (+100%) 34 <10> (-1) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4c0d51...39d5df7. Read the comment docs.


$length -= $this->margin;

$length = floor($style->getContentWidth() / $numberOfItems) - $this->margin;
Copy link
Collaborator

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))
: '';
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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


return $rows;
return sprintf(
'%s%s%s%s%s',
Copy link
Collaborator

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)),
Copy link
Collaborator

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,

@AydinHassan AydinHassan merged commit 525486e into split-item-builder May 13, 2018
@AydinHassan AydinHassan deleted the split-item-menu-tests branch May 13, 2018 15:00
@AydinHassan AydinHassan added this to the 3.0 milestone May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants