Skip to content

Commit 4f46c3c

Browse files
author
Philip Guo
committed
better alignment of Expect output
1 parent 2d148a0 commit 4f46c3c

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

edu-python-questions.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,19 +373,23 @@ function gradeSubmission() {
373373

374374
if (res.passed_test) {
375375
var happyFaceImg = '<img style="vertical-align: middle;" src="yellow-happy-face.png"/>';
376-
$("#gradeMatrix tr.gradeMatrixRow:last").append('<td>' + happyFaceImg + '</td>');
376+
$("#gradeMatrix tr.gradeMatrixRow:last").append('<td class="statusCell">' + happyFaceImg + '</td>');
377+
378+
// add an empty 'expected' cell
379+
$("#gradeMatrix tr.gradeMatrixRow:last").append('<td class="expectedCell"></td>');
377380
}
378381
else {
379382
var sadFaceImg = '<img style="vertical-align: middle; margin-right: 8px;" src="red-sad-face.jpg"/>';
380383

381384
var debugBtnID = 'debug_test_' + i;
382385
var debugMeBtn = '<button id="' + debugBtnID + '" class="debugBtn" type="button">Debug me</button>';
383-
var expectedSpan = '<span class="expectedSpan">Expected: </span>';
386+
var expectedTd = '<td class="expectedCell">Expected: </td>';
384387

385-
$("#gradeMatrix tr.gradeMatrixRow:last").append('<td class="statusCell">' + sadFaceImg + debugMeBtn + expectedSpan + '</td>');
388+
$("#gradeMatrix tr.gradeMatrixRow:last").append('<td class="statusCell">' + sadFaceImg + debugMeBtn + '</td>' + expectedTd);
386389

387-
var curCell = $("#gradeMatrix tr.gradeMatrixRow:last td.statusCell:last");
388-
renderData(res.expect_val, curCell.find('span.expectedSpan:last'), true /* ignoreIDs */);
390+
renderData(res.expect_val,
391+
$("#gradeMatrix tr.gradeMatrixRow:last td.expectedCell:last"),
392+
true /* ignoreIDs */);
389393

390394
$('#' + debugBtnID).unbind(); // unbind it just to be paranoid
391395
$('#' + debugBtnID).click(genDebugLinkHandler(i));

edu-python.css

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,13 +565,23 @@ table#gradeMatrix {
565565
table#gradeMatrix thead {
566566
font-weight: bold;
567567
border: solid;
568-
/*text-align: center;*/
568+
}
569+
570+
table#gradeMatrix thead td.statusCell {
571+
padding-left: 18px; /* to line up with smiley faces */
569572
}
570573

571574
table#gradeMatrix td.testInputCell,
572575
table#gradeMatrix td.testOutputCell {
573576
padding-right: 25px;
574-
padding-bottom: 8px;
577+
padding-bottom: 10px;
578+
vertical-align: middle;
579+
}
580+
581+
table#gradeMatrix td.statusCell,
582+
table#gradeMatrix td.expectedCell {
583+
padding-left: 12px;
584+
padding-bottom: 10px;
575585
vertical-align: middle;
576586
}
577587

@@ -608,6 +618,4 @@ div#submittedSolutionDisplay {
608618
margin-bottom: 20px;
609619
}
610620

611-
.expectedSpan {
612-
margin-left: 8px;
613-
}
621+

question.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</textarea>
8080

8181
<p/>Write your test code here:<br/>
82-
<textarea class="codeInputPane" id="testCodeInput" cols="60" rows="4" wrap="off">
82+
<textarea class="codeInputPane" id="testCodeInput" cols="60" rows="3" wrap="off">
8383
</textarea>
8484

8585
<p>
@@ -153,7 +153,8 @@
153153
<tr>
154154
<td>Input</td>
155155
<td>Result</td>
156-
<td>Status</td>
156+
<td class="statusCell">Status</td>
157+
<td></td>
157158
</tr>
158159
</thead>
159160
<tbody id="gradeMatrixTbody">

0 commit comments

Comments
 (0)