Skip to content

Commit

Permalink
Fix gender icon BC
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Sep 24, 2024
1 parent 5b23fef commit a6023d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/View/Helper/FormatHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,13 @@ public function neighbors(array $neighbors, string $field, array $options = []):
public function genderIcon($value, array $options = [], array $attributes = []): string {
$value = (int)$value;
if ($value == static::GENDER_FEMALE) {
$attributes['class'] = 'icon-female';
$icon = $this->Icon->render('female', $options, $attributes);
} elseif ($value == static::GENDER_MALE) {
$attributes['class'] = 'icon-male';
$icon = $this->Icon->render('male', $options, $attributes);
} else {
$attributes['class'] = 'icon-inter';
$icon = $this->Icon->render('genderless', $options, $attributes + ['title' => __d('tools', 'Inter')]);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/View/Helper/FormatHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,17 @@ public function testThumbs() {
public function testGenderIcon() {
$result = $this->Format->genderIcon(0);

$expected = '<span class="bi bi-genderless" title="Inter"></span>';
$expected = '<span class="bi bi-genderless icon-inter" title="Inter"></span>';
$this->assertEquals($expected, $result);

$result = $this->Format->genderIcon(1);

$expected = '<span class="bi bi-male" title="Male"></span>';
$expected = '<span class="bi bi-male icon-male" title="Male"></span>';
$this->assertEquals($expected, $result);

$result = $this->Format->genderIcon(2);

$expected = '<span class="bi bi-female" title="Female"></span>';
$expected = '<span class="bi bi-female icon-female" title="Female"></span>';
$this->assertEquals($expected, $result);
}

Expand Down

0 comments on commit a6023d3

Please sign in to comment.