Skip to content

Commit

Permalink
Merge pull request #983 from UN-OCHA/release-versions/v1.8.4
Browse files Browse the repository at this point in the history
release versions/v1.8.4
  • Loading branch information
berliner authored Apr 24, 2024
2 parents 269d599 + 1c1e51e commit 5bec24c
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 53 deletions.
92 changes: 44 additions & 48 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion html/modules/custom/hpc_common/hpc_common.theme.inc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ function hpc_common_preprocess_hpc_sparkline(&$vars) {
$baseline_value = $vars['baseline_value'];

$wrapper_attributes = new Attribute();
$wrapper_attributes->addClass('hpc-pie-chart-wrapper');
$wrapper_attributes->setAttribute('data-values', implode(',', $data));
$wrapper_attributes->setAttribute('data-tooltips', implode('|', $tooltips));
if ($baseline_value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function getAbbreviation($string) {
$words = explode(' ', $string);
$abbreviation = implode('', array_map(function ($word) {
return $word[0];
}, $words));
}, array_filter($words)));
return strtoupper($abbreviation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% if hide_value == false %}
{{ formatted_value }}
{% endif %}
<div {{ wrapper_attributes.addClass(classes) }}>
<div {{ wrapper_attributes.addClass(wrapper_classes) }}>
<svg viewBox="0 0 32 32">
<circle r="16" cx="16" cy="16" style="stroke-dasharray: {{ pie_value }} 100" />
</svg>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{%
set wrapper_classes = [
'hpc-sparkline',
'sparkline',
]
%}

{{ attach_library('hpc_common/sparkline') }}

<span class="sparkline" {{ wrapper_attributes.addClass(classes) }}></span>
<span {{ wrapper_attributes.addClass(wrapper_classes) }}></span>
46 changes: 46 additions & 0 deletions html/modules/custom/hpc_common/tests/src/Unit/StringHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,52 @@ public function testMakeCamelCase($string, $initial_lower_case, $result) {
$this->assertEquals($result, $this->stringHelper->makeCamelCase($string, $initial_lower_case));
}

/**
* Data provider for testCamelCaseToUnderscoreCase.
*/
public function camelCaseToUnderscoreCaseDataProvider() {
return [
['camelCase', 'camel_case'],
['camelCaseCase', 'camel_case_case'],
['CamelCaseCase', 'camel_case_case'],
['CCC', 'ccc'],
['CaCaCa', 'ca_ca_ca'],
];
}

/**
* Test making string camel case.
*
* @group StringHelper
* @dataProvider camelCaseToUnderscoreCaseDataProvider
*/
public function testCamelCaseToUnderscoreCase($string, $result) {
$this->assertEquals($result, StringHelper::camelCaseToUnderscoreCase($string));
}

/**
* Data provider for testGetAbbreviation.
*/
public function getAbbreviationDataProvider() {
return [
['camelCase', 'camelCase'],
['camel Case Case', 'CCC'],
['Camel Case Case', 'CCC'],
['Camel Case Case', 'CCC'],
['Content Security Policy', 'CSP'],
];
}

/**
* Test making string camel case.
*
* @group StringHelper
* @dataProvider getAbbreviationDataProvider
*/
public function testGetAbbreviation($string, $result) {
$this->assertEquals($result, StringHelper::getAbbreviation($string));
}

/**
* Data provider for renderString.
*/
Expand Down

0 comments on commit 5bec24c

Please sign in to comment.