Skip to content

Commit

Permalink
fixes for linters and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dionysius committed Mar 11, 2019
1 parent 0d9517f commit 8a50016
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 27 deletions.
3 changes: 2 additions & 1 deletion attempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
if ($canfinish && ($hasnext || !$hasanswered)) {
$html .= html_writer::empty_tag('input',
array('type' => 'submit', 'name' => 'finish',
'value' => get_string('finish_button', 'studentquiz'), 'class' => 'btn btn-link'));
'value' => get_string('abort_button', 'studentquiz'), 'class' => 'btn'));
}

$html .= html_writer::end_tag('div');
Expand All @@ -268,6 +268,7 @@
$html .= html_writer::end_tag('div');

// Output the comments.
$html .= html_writer::empty_tag('hr');
if ($hasanswered) {
$comments = mod_studentquiz_get_comments_with_creators($question->id);

Expand Down
1 change: 1 addition & 0 deletions lang/en/studentquiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
defined('MOODLE_INTERNAL') || die();

$string['add_comment'] = 'Add comment';
$string['abort_button'] = 'Abort';
$string['after_answering_end_date'] = 'This StudentQuiz closed for answering on {$a}.';
$string['after_submission_end_date'] = 'This StudentQuiz closed for question submission on {$a}.';
$string['answeringndbeforestart'] = 'Answering deadline can not be specified before the open for answering date';
Expand Down
1 change: 0 additions & 1 deletion renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,6 @@ public function render_rate($questionid) {
* @return string HTML fragment
*/
public function render_comment($cmid, $questionid, $comments, $userid, $anonymize = true, $ismoderator = false) {

return html_writer::div(
html_writer::div(
$this->comment_form($questionid, $cmid)
Expand Down
45 changes: 20 additions & 25 deletions tests/behat/run_quiz.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ Feature: Quizzes can be startet
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| studentquiz | StudentQuiz 1 | Quiz 1 description | C1 | studentquiz1 |
#And the following "questions" exist:
# | questioncategory | qtype | name | template |
# | Default for StudentQuiz 1 | truefalse | 1. Can next? | |
# | Default for StudentQuiz 1 | multichoice | 2. Can previous? | two_of_four |
# | Default for StudentQuiz 1 | numerical | 3. Can finish? | |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Default for StudentQuiz 1 | truefalse | Exampe question | |
Expand All @@ -63,64 +58,64 @@ Feature: Quizzes can be startet
# QUESTION 1 mainly
#Then I should see "Can next?"
Then I should see "1" in the ".qno" "css_element"
And I should not see "Please Rate"
And I should not see "Please rate"
# Can't navigate before answering question
And "Previous" "button" should not exist
And "Next" "button" should not exist
And "Finish" "button" should exist
And "Abort" "button" should exist
And "Finish" "button" should not exist
# Must rate before go next
When I set the field "True" to "1"
And I press "Check"
Then "Next" "button" should exist
When I click on "Next" "button"
Then I should see "Please Rate"
# Must also rate when now trying to early finish
When I click on "Finish" "button"
Then I should see "Please Rate"
Then I should see "Please rate"
# Must also rate when now trying to early abort
When I click on "Abort" "button"
Then I should see "Please rate"
When I click on ".rateable[data-rate='1']" "css_element"
And I click on "Next" "button"
# QUESTION 2 mainly
#Then I should see "Can previous?"
Then I should see "2" in the ".qno" "css_element"
And I should not see "Please Rate"
And I should not see "Please rate"
# Can navigate back when not answered yet
And "Previous" "button" should exist
And "Next" "button" should not exist
And "Finish" "button" should exist
And "Abort" "button" should exist
And "Finish" "button" should not exist
When I click on "Previous" "button"
#Then I should see "Can next?"
Then I should see "1" in the ".qno" "css_element"
# Can navigate forth because already answered this question
And I click on "Next" "button"
#Then I should see "Can previous?"
Then I should see "2" in the ".qno" "css_element"
# After answering can only navigate back after rating
#When I click on "One" "checkbox"
#And I click on "Two" "checkbox"
When I set the field "False" to "1"
And I press "Check"
And I click on "Previous" "button"
Then I should see "Please Rate"
Then I should see "Please rate"
When I click on ".rateable[data-rate='2']" "css_element"
And I click on "Previous" "button"
#Then I should see "Can next?"
Then I should see "1" in the ".qno" "css_element"
And I click on "Next" "button"
And I click on "Next" "button"
# QUESTION 3 mainly
#Then I should see "Can finish?"
Then I should see "3" in the ".qno" "css_element"
And I should not see "Please Rate"
And I should not see "Please rate"
# When answered can only finish when rated
And "Previous" "button" should exist
And "Next" "button" should not exist
And "Finish" "button" should exist
And "Abort" "button" should exist
And "Finish" "button" should not exist
# After answering can only finish after rating
#When I set the field "Answer:" to "3.14"
When I set the field "True" to "1"
And I press "Check"
And I click on "Finish" "button"
Then I should see "Please Rate"
Then "Previous" "button" should exist
And "Next" "button" should not exist
And "Abort" "button" should not exist
And "Finish" "button" should exist
When I click on "Finish" "button"
Then I should see "Please rate"
When I click on ".rateable[data-rate='3']" "css_element"
And I click on "Finish" "button"
# Back to main view and check the result numbers
Expand Down

0 comments on commit 8a50016

Please sign in to comment.