Skip to content

Commit 69a9189

Browse files
committed
Merge branch 'hotfix/0.21.13'
2 parents 3ae4cdd + 7e7910e commit 69a9189

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
## Changelog ##
33

44

5+
### 0.21.13 ###
6+
7+
Add answer's attribute for CSS styling.
8+
9+
510
### 0.21.12 ###
611

712
Fix bug with scale sorting.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
**Tested up to:** 4.9
1010

11-
**Stable tag:** 0.21.12
11+
**Stable tag:** 0.21.13
1212

1313
**License:** GPLv3
1414

js/test-pass-fill-form.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Wpt.form.initQuestionAnswered = function(form) {
4949
}).bind('question_unanswered_initially.wpt', function(event, question) {
5050
question.removeClass('answered');
5151
question.find('.answer input:first').attr('required', 'required').attr('aria-required', 'true');
52+
}).bind('answer_selected.wpt', function (event, answer) {
53+
answer.addClass('selected');
54+
}).bind('answer_unselected.wpt', function (event, answer) {
55+
answer.removeClass('selected');
5256
});
5357
};
5458

@@ -146,7 +150,19 @@ Wpt.form.setupQuestionsAnswered = function($, form) {
146150
question.find('.answer').each(function () {
147151
var answer = $(this);
148152
answer.find('input').bind('change', function () {
149-
if (!$(this).attr('checked')) {
153+
answer.data('isSelected', !!$(this).attr('checked'));
154+
if (answer.data('isSelected')) {
155+
form.trigger('answer_selected.wpt', [answer]);
156+
questionAnswersInputs.each(function (i, otherInput) {
157+
var $el = $(otherInput);
158+
if ($el.closest('.answer').data('isSelected') != !!$(otherInput).attr('checked')) {
159+
$el.change();
160+
}
161+
});
162+
} else {
163+
form.trigger('answer_unselected.wpt', [answer]);
164+
}
165+
if (!answer.data('isSelected')) {
150166
var isAllCheckboxesEmpty = (0 == questionAnswersInputs.filter(':checked').length);
151167
if (isAllCheckboxesEmpty) {
152168
question.data('isAnswered', false);

wp-testing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Wp-testing
44
* Plugin URI: http://wordpress.org/extend/plugins/wp-testing/
55
* Description: Helps to create psychological tests.
6-
* Version: 0.21.12
6+
* Version: 0.21.13
77
* Author: Alexander Ustimenko
88
* Author URI: http://ustimen.co
99
* License: GPL3

0 commit comments

Comments
 (0)