+
@@ -151,7 +151,7 @@ if (isset($file_src) || isset($img) || isset($validate['upload'])) {
echo " showHide('upload')\n";
} else {
echo " var wordcounter = document.getElementById('wordcounter');\n";
- echo " wordcounter.style.display = 'block';\n";
+ echo " wordcounter.hidden = false;\n";
}
echo "\n";
?>
diff --git a/style.css b/style.css
index 6617d7c..e2d04ec 100644
--- a/style.css
+++ b/style.css
@@ -33,6 +33,11 @@
src: url('graphics/teenbold.ttf') format('truetype');
}
+/* Rules that set display, such as "#main .counter", would otherwise show hidden elements */
+[hidden] {
+ display: none !important;
+}
+
body {
font-family: "Noto Sans", "Verdana", sans-serif;
font-size: 12pt;
diff --git a/tests/js/helpers.js b/tests/js/helpers.js
index 2694d9b..845dbea 100644
--- a/tests/js/helpers.js
+++ b/tests/js/helpers.js
@@ -21,8 +21,8 @@ const STORY_FORM = `
Text:Image:
-
-
0 words
+
+
0 words
`;
function load(scripts, body, story) {
diff --git a/tests/js/utilities.test.js b/tests/js/utilities.test.js
index 14b2633..dd12833 100644
--- a/tests/js/utilities.test.js
+++ b/tests/js/utilities.test.js
@@ -82,11 +82,9 @@ test("showHide switches between the text and the image tabs", () => {
let focused = 0;
w.storyEditor = { focus: () => focused++ };
assert.equal(w.showHide("upload"), true);
- assert.deepEqual([$("textparent").style.display, $("uploadparent").style.display, $("wordcounter").style.display],
- ["none", "block", "none"]);
+ assert.deepEqual([$("textparent").hidden, $("uploadparent").hidden, $("wordcounter").hidden], [true, false, true]);
assert.equal(w.showHide("text"), true);
- assert.deepEqual([$("textparent").style.display, $("uploadparent").style.display, $("wordcounter").style.display],
- ["block", "none", "block"]);
+ assert.deepEqual([$("textparent").hidden, $("uploadparent").hidden, $("wordcounter").hidden], [false, true, false]);
assert.equal(focused, 1);
assert.equal(w.showHide("other"), false);
});
diff --git a/tests/php/Pages/SubmitTest.php b/tests/php/Pages/SubmitTest.php
index 139c9b1..d3b0c2a 100644
--- a/tests/php/Pages/SubmitTest.php
+++ b/tests/php/Pages/SubmitTest.php
@@ -30,6 +30,14 @@ class SubmitTest extends PageTestCase {
$this->assertStringContainsString('', $page['body']);
}
+ public function testTheFormHidesWithTheHiddenAttribute(): void {
+ $body = $this->get('/publish')['body'];
+ $this->assertStringNotContainsString('display: none', $body);
+ $this->assertStringContainsString('
', $body);
+ $this->assertStringContainsString('', $body);
+ $this->assertStringContainsString('wordcounter.hidden = false;', $body);
+ }
+
public function testTheImageTabKeepsTheSpaceOfTheNote(): void {
$html = new \DOMDocument();
$html->loadHTML($this->get('/publish')['body'], LIBXML_NOERROR);