Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
adjust tests
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed May 11, 2023
commit 4a89b7ea222d1f7c49dede74e11b88776482f389
18 changes: 9 additions & 9 deletions apps/theming/tests/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public function dataGetCapabilities() {
'slogan' => 'slogan',
'color' => '#FFFFFF',
'color-text' => '#000000',
'color-element' => '#aaaaaa',
'color-element-bright' => '#aaaaaa',
'color-element' => '#b3b3b3',
'color-element-bright' => '#b3b3b3',
'color-element-dark' => '#FFFFFF',
'logo' => 'http://absolute/logo',
'background' => 'http://absolute/background',
Expand Down Expand Up @@ -109,9 +109,9 @@ public function dataGetCapabilities() {
'slogan' => 'slogan3',
'color' => '#000000',
'color-text' => '#ffffff',
'color-element' => '#000000',
'color-element-bright' => '#000000',
'color-element-dark' => '#8c8c8c',
'color-element' => '#4d4d4d',
'color-element-bright' => '#4d4d4d',
'color-element-dark' => '#4d4d4d',
'logo' => 'http://localhost/logo5',
'background' => '#000000',
'background-plain' => true,
Expand All @@ -125,9 +125,9 @@ public function dataGetCapabilities() {
'slogan' => 'slogan3',
'color' => '#000000',
'color-text' => '#ffffff',
'color-element' => '#000000',
'color-element-bright' => '#000000',
'color-element-dark' => '#8c8c8c',
'color-element' => '#4d4d4d',
'color-element-bright' => '#4d4d4d',
'color-element-dark' => '#4d4d4d',
'logo' => 'http://localhost/logo5',
'background' => '#000000',
'background-plain' => true,
Expand Down Expand Up @@ -178,7 +178,7 @@ public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $l
$this->util->expects($this->exactly(3))
->method('elementColor')
->with($color)
->willReturnCallback(static function (string $color, bool $brightBackground = true) use ($util) {
->willReturnCallback(static function (string $color, ?bool $brightBackground = null) use ($util) {
return $util->elementColor($color, $brightBackground);
});

Expand Down
29 changes: 22 additions & 7 deletions apps/theming/tests/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,34 @@ public function testInvertTextColorEmpty() {
$this->util->invertTextColor('');
}

public function testElementColorDefault() {
public function testElementColorDefaultBlack() {
$elementColor = $this->util->elementColor("#000000");
$this->assertEquals('#000000', $elementColor);
$this->assertEquals('#4d4d4d', $elementColor);
}

public function testElementColorDefaultWhite() {
$elementColor = $this->util->elementColor("#ffffff");
$this->assertEquals('#b3b3b3', $elementColor);
}

public function testElementColorOnDarkBackground() {
public function testElementColorBlackOnDarkBackground() {
$elementColor = $this->util->elementColor("#000000", false);
$this->assertEquals('#8c8c8c', $elementColor);
$this->assertEquals('#4d4d4d', $elementColor);
}

public function testElementColorBlackOnBrightBackground() {
$elementColor = $this->util->elementColor("#000000", true);
$this->assertEquals('#000000', $elementColor);
}

public function testElementColorWhiteOnBrightBackground() {
$elementColor = $this->util->elementColor('#ffffff', true);
$this->assertEquals('#b3b3b3', $elementColor);
}

public function testElementColorOnBrightBackground() {
$elementColor = $this->util->elementColor('#ffffff');
$this->assertEquals('#aaaaaa', $elementColor);
public function testElementColorWhiteOnDarkBackground() {
$elementColor = $this->util->elementColor('#ffffff', false);
$this->assertEquals('#ffffff', $elementColor);
}

public function testGenerateRadioButtonWhite() {
Expand Down