Browse Source

Fix gender icon BC

mscherer 1 year ago
parent
commit
a6023d3ba1

+ 3 - 0
src/View/Helper/FormatHelper.php

@@ -184,10 +184,13 @@ class FormatHelper extends Helper {
 	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')]);
 		}
 

+ 3 - 3
tests/TestCase/View/Helper/FormatHelperTest.php

@@ -133,17 +133,17 @@ class FormatHelperTest extends TestCase {
 	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);
 	}