From 9422f6ee42e861785a2e5078c53be11333c936f2 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Thu, 3 Jul 2014 14:00:40 +0800 Subject: [PATCH] MDL-46163 question/quiz: fix elements ids and their labels --- lib/questionlib.php | 4 ++-- .../classes/bank/search/category_condition.php | 4 ++-- question/tests/behat/question_categories.feature | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index 1b2837a3773..fab8f7e533c 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1045,8 +1045,8 @@ function question_category_select_menu($contexts, $top = false, $currentcat = 0, foreach ($categoriesarray as $group => $opts) { $options[] = array($group => $opts); } - echo html_writer::label($selected, 'menucategory', false, array('class' => 'accesshide')); - echo html_writer::select($options, 'category', $selected, $choose); + echo html_writer::label(get_string('questioncategory', 'core_question'), 'id_movetocategory', false, array('class' => 'accesshide')); + echo html_writer::select($options, 'category', $selected, $choose, array('id' => 'id_movetocategory')); } /** diff --git a/question/classes/bank/search/category_condition.php b/question/classes/bank/search/category_condition.php index 36c18df9749..4ad0d8e892a 100644 --- a/question/classes/bank/search/category_condition.php +++ b/question/classes/bank/search/category_condition.php @@ -134,8 +134,8 @@ class category_condition extends condition { echo \html_writer::start_div('choosecategory'); $catmenu = question_category_options($contexts, false, 0, true); - echo \html_writer::label(get_string('selectacategory', 'question'), 'category'); - echo \html_writer::select($catmenu, 'category', $current, array(), array('class' => 'searchoptions')); + echo \html_writer::label(get_string('selectacategory', 'question'), 'id_selectacategory'); + echo \html_writer::select($catmenu, 'category', $current, array(), array('class' => 'searchoptions', 'id' => 'id_selectacategory')); echo \html_writer::end_div() . "\n"; } diff --git a/question/tests/behat/question_categories.feature b/question/tests/behat/question_categories.feature index 4249723efc0..3d2f26fe92d 100644 --- a/question/tests/behat/question_categories.feature +++ b/question/tests/behat/question_categories.feature @@ -35,14 +35,14 @@ Feature: A teacher can put questions in categories in the question bank @javascript Scenario: Move a question between categories via the question page - When I set the field "category" to "New Category 1 (1)" + When I set the field "Select a category" to "New Category 1 (1)" And I click on "my test question" "checkbox" in the "my test question" "table_row" - And I set the field "menucategory" to "New Category 2" + And I set the field "Question category" to "New Category 2" And I press "Move to >>" Then I should see "my test question" - And the "category" select box should contain "New Category 2 (1)" - And the "category" select box should contain "New Category 1" - And the "category" select box should not contain "New Category 1 (1)" + And the "Select a category" select box should contain "New Category 2 (1)" + And the "Select a category" select box should contain "New Category 1" + And the "Select a category" select box should not contain "New Category 1 (1)" @javascript Scenario: Move a question between categories via the question settings page @@ -51,8 +51,8 @@ Feature: A teacher can put questions in categories in the question bank And I set the field "Save in category" to "New Category 2" And I press "id_submitbutton" Then I should see "my test question" - And the "category" select box should contain "New Category 2 (1)" - And the "category" select box should not contain "New Category 1 (1)" + And the "Select a category" select box should contain "New Category 2 (1)" + And the "Select a category" select box should not contain "New Category 1 (1)" @javascript Scenario: Delete a question category