Skip to content

Commit ecb7f02

Browse files
authored
Fix showing and hiding of columns. (#489)
* Fix showing and hiding of columns. The class name col-hide was overruled by bootstrap because of the col- prefix. * Remove log message used for debugging * Fix deprecation warning * Updated phpunit configuration file and added phpunit.xsd
1 parent d1192ef commit ecb7f02

File tree

6 files changed

+377
-55
lines changed

6 files changed

+377
-55
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ Here is a little screen shot of the edition page :)
3636
TESTING
3737
=======
3838

39-
[Read the documentation for testing ](./testing.md)
39+
[Read the documentation for testing ](./testing.md)

Resources/public/css/translation.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
width: 60px;
2424
}
2525

26-
.col-hide {
27-
display: none;
28-
}
29-
3026
.pagination {
3127
margin: 0;
3228
}
@@ -63,4 +59,4 @@ table button.delete {
6359

6460
.content div.action.action-button {
6561
margin: 0;
66-
}
62+
}

Resources/public/js/translation.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ const TranslationManager = (() => {
157157
{
158158
_showCol[column] = checked;
159159

160-
document.getElementById('header-' + column).classList.toggle('col-hide', !checked);
160+
document.getElementById('header-' + column).classList.toggle('hide', !checked);
161161
document.querySelectorAll('.col-' + column).forEach(element => {
162-
element.classList.toggle('col-hide', !checked);
162+
element.classList.toggle('hide', !checked);
163163
});
164164

165165
if (translationCfg.toggleSimilar) {
@@ -168,10 +168,10 @@ const TranslationManager = (() => {
168168
input.checked = checked;
169169
});
170170
document.querySelectorAll('[id^="header-' + column + '_"]').forEach(element => {
171-
element.classList.toggle('col-hide', !checked);
171+
element.classList.toggle('hide', !checked);
172172
});
173173
document.querySelectorAll('[class^="col-' + column + '_"]').forEach(element => {
174-
element.classList.toggle('col-hide', !checked);
174+
element.classList.toggle('hide', !checked);
175175
});
176176
}
177177
}
@@ -424,7 +424,7 @@ const TranslationManager = (() => {
424424

425425
return `
426426
<tr class="content">
427-
<td class="col-_id ${_showCol['_id'] === false ? 'col-hide' : ''}">
427+
<td class="col-_id ${_showCol['_id'] === false ? 'hide' : ''}">
428428
<span>${item._id}</span>
429429
<div on="editType">
430430
</div>
@@ -434,7 +434,7 @@ const TranslationManager = (() => {
434434
</button>
435435
</div>
436436
</td>
437-
<td class="col-_domain ${_showCol['_domain'] === false ? 'col-hide' : ''}">
437+
<td class="col-_domain ${_showCol['_domain'] === false ? 'hide' : ''}">
438438
<span>${item._domain}</span>
439439
<div on="editType">
440440
</div>
@@ -444,7 +444,7 @@ const TranslationManager = (() => {
444444
</button>
445445
</div>
446446
</td>
447-
<td class="col-_key ${_showCol['_key'] === false ? 'col-hide' : ''}">
447+
<td class="col-_key ${_showCol['_key'] === false ? 'hide' : ''}">
448448
<span>${item._key}</span>
449449
<div on="editType">
450450
</div>
@@ -455,7 +455,7 @@ const TranslationManager = (() => {
455455
</div>
456456
</td>
457457
${Object.keys(item).filter(key => key !== '_id' && key !== '_domain' && key !== '_key').map(locale => `
458-
<td class="col-${locale} ${_showCol[locale] === false ? 'col-hide' : ''}">
458+
<td class="col-${locale} ${_showCol[locale] === false ? 'hide' : ''}">
459459
<span id="content-${item._id}-${locale}" class="locale">${escapeHtml(item[locale])}</span>
460460
<div>
461461
${renderInputElement(item._id, locale, item[locale])}
@@ -509,4 +509,4 @@ const TranslationManager = (() => {
509509
deleteEntry,
510510
invalidateCache
511511
}
512-
})();
512+
})();

Tests/app/AppKernel.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
class AppKernel extends Kernel
2222
{
2323
private $testCase;
24-
private $rootConfig;
24+
private string $rootConfig;
2525

2626
public function __construct($testCase, $debug = true)
2727
{
2828
$environment = $testCase;
2929

3030
if (!is_dir(__DIR__ . '/' . $testCase)) {
31-
throw new \InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase));
31+
throw new InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase));
3232
}
3333
$this->testCase = $testCase;
3434

@@ -40,7 +40,7 @@ public function __construct($testCase, $debug = true)
4040
$rootConfig = __DIR__ . '/' . $testCase . '/' . $rootConfig
4141
)
4242
) {
43-
throw new \InvalidArgumentException(sprintf('The root config "%s" does not exist.', $rootConfig));
43+
throw new InvalidArgumentException(sprintf('The root config "%s" does not exist.', $rootConfig));
4444
}
4545
$this->rootConfig = $rootConfig;
4646

@@ -50,13 +50,13 @@ public function __construct($testCase, $debug = true)
5050
public function registerBundles(): iterable
5151
{
5252
if (!file_exists($filename = $this->getRootDir() . '/' . $this->testCase . '/bundles.php')) {
53-
throw new \RuntimeException(sprintf('The bundles file "%s" does not exist.', $filename));
53+
throw new RuntimeException(sprintf('The bundles file "%s" does not exist.', $filename));
5454
}
5555

5656
return include $filename;
5757
}
5858

59-
public function getRootDir()
59+
public function getRootDir(): string
6060
{
6161
return __DIR__;
6262
}
@@ -71,17 +71,20 @@ public function getLogDir(): string
7171
return $this->getRootDir() . '/tmp/' . $this->testCase . '/logs';
7272
}
7373

74-
public function registerContainerConfiguration(LoaderInterface $loader)
74+
/**
75+
* @throws Exception
76+
*/
77+
public function registerContainerConfiguration(LoaderInterface $loader): void
7578
{
7679
$loader->load($this->rootConfig);
7780
}
7881

79-
public function serialize()
82+
public function serialize(): string
8083
{
8184
return serialize([$this->testCase, $this->rootConfig, $this->getEnvironment(), $this->isDebug()]);
8285
}
8386

84-
public function unserialize($str)
87+
public function unserialize($str): void
8588
{
8689
call_user_func_array([$this, '__construct'], unserialize($str));
8790
}

phpunit.xml.dist

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="Tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory>./</directory>
6-
</include>
7-
<exclude>
8-
<directory>./Resources</directory>
9-
<directory>./Tests</directory>
10-
</exclude>
11-
</coverage>
12-
<testsuites>
13-
<testsuite name="LexikTranslationBundle Test Suite">
14-
<directory>./Tests/</directory>
15-
</testsuite>
16-
</testsuites>
17-
<groups>
18-
<include>
19-
<group>util</group>
20-
<group>orm</group>
21-
<group>odm</group>
22-
<group>exporter</group>
23-
<group>loader</group>
24-
<group>importer</group>
25-
<group>translator</group>
26-
<group>command</group>
27-
</include>
28-
</groups>
29-
<php>
30-
<server name="ROOT_DIR" value="../../../../.."/>
31-
<server name="KERNEL_DIR" value="./Tests/app/"/>
32-
<server name="KERNEL_CLASS" value="AppKernel"/>
33-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
colors="true"
4+
failOnDeprecation="true"
5+
bootstrap="Tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
6+
<testsuites>
7+
<testsuite name="LexikTranslationBundle Test Suite">
8+
<directory>./Tests/</directory>
9+
</testsuite>
10+
</testsuites>
11+
<groups>
12+
<include>
13+
<group>util</group>
14+
<group>orm</group>
15+
<group>odm</group>
16+
<group>exporter</group>
17+
<group>loader</group>
18+
<group>importer</group>
19+
<group>translator</group>
20+
<group>command</group>
21+
</include>
22+
</groups>
23+
<php>
24+
<ini name="error_reporting" value="-1"/><!-- -1 == E_ALL -->
25+
<ini name="display_errors" value="1"/>
26+
<server name="ROOT_DIR" value="../../../../.."/>
27+
<server name="KERNEL_DIR" value="./Tests/app/"/>
28+
<server name="KERNEL_CLASS" value="AppKernel"/>
29+
</php>
3430
</phpunit>

0 commit comments

Comments
 (0)