Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes input box weirdness for numeric questions w/ large units text #1843

Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ exports[`NumericAssessment NumericAssessment renders a correct response 1`] = `
<div
className="input-container"
>
<div
className="result-symbol"
/>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -142,6 +145,17 @@ exports[`NumericAssessment NumericAssessment renders a correct response in revie
<div
className="input-container"
>
<div
className="review-flag"
>
<div
className="obojobo-draft--components--flag is-type-chosen-correctly"
>
<p>
Your Answer (Correct)
</p>
</div>
</div>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -180,15 +194,7 @@ exports[`NumericAssessment NumericAssessment renders a correct response in revie
</div>
<div
className="review"
>
<div
className="obojobo-draft--components--flag is-type-chosen-correctly"
>
<p>
Your Answer (Correct)
</p>
</div>
</div>
/>
</div>
</div>
`;
Expand All @@ -209,6 +215,9 @@ exports[`NumericAssessment NumericAssessment renders a response correct within t
<div
className="input-container"
>
<div
className="result-symbol"
/>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -278,6 +287,9 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response 1`] =
<div
className="input-container"
>
<div
className="result-symbol"
/>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -331,6 +343,17 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response in re
<div
className="input-container"
>
<div
className="review-flag"
>
<div
className="obojobo-draft--components--flag is-type-should-not-have-chosen"
>
<p>
Your Answer (Incorrect)
</p>
</div>
</div>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -367,13 +390,6 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response in re
<div
className="review"
>
<div
className="obojobo-draft--components--flag is-type-should-not-have-chosen"
>
<p>
Your Answer (Incorrect)
</p>
</div>
<div
className="correct-answers"
>
Expand Down Expand Up @@ -428,6 +444,17 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response in re
<div
className="input-container"
>
<div
className="review-flag"
>
<div
className="obojobo-draft--components--flag is-type-should-not-have-chosen"
>
<p>
Your Answer (Incorrect)
</p>
</div>
</div>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -464,13 +491,6 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response in re
<div
className="review"
>
<div
className="obojobo-draft--components--flag is-type-should-not-have-chosen"
>
<p>
Your Answer (Incorrect)
</p>
</div>
<div
className="correct-answers"
>
Expand Down Expand Up @@ -501,6 +521,17 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response in re
<div
className="input-container"
>
<div
className="review-flag"
>
<div
className="obojobo-draft--components--flag is-type-should-not-have-chosen"
>
<p>
Your Answer (Incorrect)
</p>
</div>
</div>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down Expand Up @@ -537,13 +568,6 @@ exports[`NumericAssessment NumericAssessment renders an incorrect response in re
<div
className="review"
>
<div
className="obojobo-draft--components--flag is-type-should-not-have-chosen"
>
<p>
Your Answer (Incorrect)
</p>
</div>
<div
className="correct-answers"
>
Expand Down Expand Up @@ -584,6 +608,9 @@ exports[`NumericAssessment NumericAssessment still renders when NumericAnswerEva
<div
className="input-container"
>
<div
className="result-symbol"
/>
<input
aria-labelledby="obojobo-draft--chunks--numeric-assessment--answer-input--mock-id"
autoComplete="off"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
display: inline-block;
position: absolute;
left: 0.8em;
top: 1.1em;
top: 50%;
transform: translateY(-50%);
z-index: $z-index-above-all;

.container {
font-family: $font-default;
Expand Down Expand Up @@ -45,4 +47,13 @@
}
}
}

@include mq($until: desktop) {
left: 0.4em;
}

@include mq($until: tablet) {
left: 0.1em;
transform: translateY(-165%);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,18 @@ export default class NumericAssessment extends OboQuestionAssessmentComponent {
}
}

renderScoreInfo(score, isReview, isSurvey) {
if (isReview) {
return (
<div className="review-flag">
<Flag type={Flag.getType(score === 100, score === 100, true, isSurvey)} />
</div>
)
} else {
return <div className="result-symbol" />
}
}

render() {
const score = this.props.score
const scoreClass = this.props.scoreClass
Expand Down Expand Up @@ -508,7 +520,11 @@ export default class NumericAssessment extends OboQuestionAssessmentComponent {
>
<div className="input-section pad">
<div className="input-container">
{!isScored ? <NumericInputMoreInfoButton /> : null}
{!isScored ? (
<NumericInputMoreInfoButton />
) : (
this.renderScoreInfo(score, isReview, isSurvey)
)}
<input
ref={this.inputRef}
autoComplete="off"
Expand Down Expand Up @@ -550,7 +566,6 @@ export default class NumericAssessment extends OboQuestionAssessmentComponent {
) : null}
{isReview ? (
<div className="review">
<Flag type={Flag.getType(score === 100, score === 100, true, isSurvey)} />
{score !== 'no-score' && score !== 100 ? (
<div className="correct-answers">{this.renderCorrectAnswerList(correctRules)}</div>
) : null}
Expand Down
Loading