Skip to content
Snippets Groups Projects
Unverified Commit e543d976 authored by Johannes Wolf's avatar Johannes Wolf Committed by GitHub
Browse files

Textarea styling and text answer warnings (#1715)

* add correct styling for textareas

* add additional meaningless text answer triggers
parent 5b0d512b
Branches main
No related tags found
No related merge requests found
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</div> </div>
<div class="col-answer col-lg-8 col-xl-7 d-flex"> <div class="col-answer col-lg-8 col-xl-7 d-flex">
<div class="vote-inputs"> <div class="vote-inputs">
<textarea id="preview-textarea"></textarea> <textarea id="preview-textarea" class="form-control"></textarea>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -3,7 +3,7 @@ function normalize(text: string) { ...@@ -3,7 +3,7 @@ function normalize(text: string) {
} }
function isTextMeaningless(text: string): boolean { function isTextMeaningless(text: string): boolean {
return text.length > 0 && ["", "ka", "na"].includes(text.replace(/\W/g, "")); return text.length > 0 && ["", "ka", "na", "none", "keine", "keines", "keiner"].includes(text.replace(/\W/g, ""));
} }
function doesTextContainTriggerString(text: string, triggerStrings: string[]): boolean { function doesTextContainTriggerString(text: string, triggerStrings: string[]): boolean {
......
...@@ -25,6 +25,7 @@ test.each([ ...@@ -25,6 +25,7 @@ test.each([
"n/A", "n/A",
"k.A.", "k.A.",
"-/-", "-/-",
"none."
])("detect as meaningless: %j", text => { ])("detect as meaningless: %j", text => {
const normalized = testable.normalize(text); const normalized = testable.normalize(text);
expect(testable.isTextMeaningless(normalized)).toBe(true); expect(testable.isTextMeaningless(normalized)).toBe(true);
...@@ -34,6 +35,7 @@ test.each([ ...@@ -34,6 +35,7 @@ test.each([
"", "",
"c", "c",
"word", "word",
"Kanone",
"I didn't understand the definition of n/A", "I didn't understand the definition of n/A",
"The abbreviation k.A. is known to me, but maybe not to all" "The abbreviation k.A. is known to me, but maybe not to all"
])("do not detect as meaningless: %j", text => { ])("do not detect as meaningless: %j", text => {
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<div class="col-answer d-flex"> <div class="col-answer d-flex">
<div class="vote-inputs tab-row {% if preview %} preview{% endif %}"> <div class="vote-inputs tab-row {% if preview %} preview{% endif %}">
{{ field.errors }} {{ field.errors }}
<textarea id="{{ field.id_for_label }}" class="tab-selectable" name="{{ field.name }}"{% if preview %} disabled{% endif %}>{{ field.value|default_if_none:"" }}</textarea> <textarea id="{{ field.id_for_label }}" class="form-control tab-selectable" name="{{ field.name }}"{% if preview %} disabled{% endif %}>{{ field.value|default_if_none:"" }}</textarea>
</div> </div>
<div> <div>
{% blocktrans asvar intro_text %}After publishing, this text answer can be seen by:{% endblocktrans %} {% blocktrans asvar intro_text %}After publishing, this text answer can be seen by:{% endblocktrans %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment