@instructure/quiz-core 18.3.0 → 18.3.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,8 +69,19 @@ export var AnswerSummaryTableRow = (_dec = themeable(theme, styles), _dec(_class
69
69
  }, content);
70
70
  };
71
71
 
72
+ _this.answerLabel = function (correct) {
73
+ return correct ? t('Correct answer') : t('Incorrect answer');
74
+ };
75
+
76
+ _this.extractChoiceText = function (choiceBody, correct) {
77
+ var text = extractTextFromHtml(choiceBody);
78
+ if (text.trim().length > 0) return text;
79
+ return _this.answerLabel(correct);
80
+ };
81
+
72
82
  _this.render = function () {
73
83
  var correct = _this.props.choice.correct;
84
+ var choiceBody = _this.props.choice.body;
74
85
  var cellPadding = correct ? '0' : _this.theme.cellPadding;
75
86
  return /*#__PURE__*/React.createElement(Table.Row, {
76
87
  key: _this.props.choiceIndex
@@ -79,12 +90,12 @@ export var AnswerSummaryTableRow = (_dec = themeable(theme, styles), _dec(_class
79
90
  padding: '0px',
80
91
  fontWeight: 'bold'
81
92
  }
82
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, correct ? t('Correct answer') : t('Incorrect answer')), _this.renderIcon(correct)), /*#__PURE__*/React.createElement(Table.RowHeader, {
93
+ }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, _this.answerLabel(correct)), _this.renderIcon(correct)), /*#__PURE__*/React.createElement(Table.RowHeader, {
83
94
  theme: {
84
95
  padding: cellPadding,
85
96
  fontWeight: 'bold'
86
97
  }
87
- }, _this.renderMiddleCell(correct, extractTextFromHtml(_this.props.choice.body))), /*#__PURE__*/React.createElement(Table.Cell, {
98
+ }, _this.renderMiddleCell(correct, _this.extractChoiceText(choiceBody, correct))), /*#__PURE__*/React.createElement(Table.Cell, {
88
99
  theme: {
89
100
  padding: cellPadding,
90
101
  fontWeight: 'bold'
@@ -93,8 +93,19 @@ var AnswerSummaryTableRow = (_dec = (0, _uiThemeable.themeable)(_theme.default,
93
93
  }, content);
94
94
  };
95
95
 
96
+ _this.answerLabel = function (correct) {
97
+ return correct ? (0, _formatMessage.default)('Correct answer') : (0, _formatMessage.default)('Incorrect answer');
98
+ };
99
+
100
+ _this.extractChoiceText = function (choiceBody, correct) {
101
+ var text = (0, _quizInteractions.extractTextFromHtml)(choiceBody);
102
+ if (text.trim().length > 0) return text;
103
+ return _this.answerLabel(correct);
104
+ };
105
+
96
106
  _this.render = function () {
97
107
  var correct = _this.props.choice.correct;
108
+ var choiceBody = _this.props.choice.body;
98
109
  var cellPadding = correct ? '0' : _this.theme.cellPadding;
99
110
  return /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, {
100
111
  key: _this.props.choiceIndex
@@ -103,12 +114,12 @@ var AnswerSummaryTableRow = (_dec = (0, _uiThemeable.themeable)(_theme.default,
103
114
  padding: '0px',
104
115
  fontWeight: 'bold'
105
116
  }
106
- }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, correct ? (0, _formatMessage.default)('Correct answer') : (0, _formatMessage.default)('Incorrect answer')), _this.renderIcon(correct)), /*#__PURE__*/_react.default.createElement(_uiTable.Table.RowHeader, {
117
+ }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, _this.answerLabel(correct)), _this.renderIcon(correct)), /*#__PURE__*/_react.default.createElement(_uiTable.Table.RowHeader, {
107
118
  theme: {
108
119
  padding: cellPadding,
109
120
  fontWeight: 'bold'
110
121
  }
111
- }, _this.renderMiddleCell(correct, (0, _quizInteractions.extractTextFromHtml)(_this.props.choice.body))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
122
+ }, _this.renderMiddleCell(correct, _this.extractChoiceText(choiceBody, correct))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
112
123
  theme: {
113
124
  padding: cellPadding,
114
125
  fontWeight: 'bold'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "18.3.0",
3
+ "version": "18.3.1-rc.0+6b0f26616",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -42,11 +42,11 @@
42
42
  "dependencies": {
43
43
  "@instructure/grading-utils": "^1.0.0",
44
44
  "@instructure/outcomes-ui": "^2.1.9",
45
- "@instructure/quiz-common": "^18.3.0",
46
- "@instructure/quiz-i18n": "^18.3.0",
47
- "@instructure/quiz-interactions": "^18.3.0",
48
- "@instructure/quiz-number-input": "^18.3.0",
49
- "@instructure/quiz-rce": "^18.3.0",
45
+ "@instructure/quiz-common": "18.3.1-rc.0+6b0f26616",
46
+ "@instructure/quiz-i18n": "18.3.1-rc.0+6b0f26616",
47
+ "@instructure/quiz-interactions": "18.3.1-rc.0+6b0f26616",
48
+ "@instructure/quiz-number-input": "18.3.1-rc.0+6b0f26616",
49
+ "@instructure/quiz-rce": "18.3.1-rc.0+6b0f26616",
50
50
  "@instructure/ui-a11y-content": "^7.22.1",
51
51
  "@instructure/ui-alerts": "^7.22.1",
52
52
  "@instructure/ui-avatar": "^7.22.1",
@@ -107,7 +107,7 @@
107
107
  "eventemitter3": "^3.1.0",
108
108
  "humps": "^2.0.0",
109
109
  "immutable": "^3.8.1",
110
- "instructure-validations": "^18.3.0",
110
+ "instructure-validations": "18.3.1-rc.0+6b0f26616",
111
111
  "ipaddr.js": "^1.5.4",
112
112
  "isomorphic-fetch": "^2.2.0",
113
113
  "isuuid": "^0.1.0",
@@ -139,7 +139,7 @@
139
139
  "uuid": "^3.2.1"
140
140
  },
141
141
  "devDependencies": {
142
- "@instructure/quiz-scripts": "^18.3.0",
142
+ "@instructure/quiz-scripts": "18.3.0",
143
143
  "@instructure/ui-axe-check": "^7.22.1",
144
144
  "@instructure/ui-babel-preset": "^7.22.1",
145
145
  "@instructure/ui-karma-config": "^7.22.1",
@@ -158,7 +158,7 @@
158
158
  "intl": "^1.2.4",
159
159
  "jquery": "^2.2.3",
160
160
  "most-subject": "^5.3.0",
161
- "quiz-presets": "^18.3.0",
161
+ "quiz-presets": "18.3.1-rc.0+6b0f26616",
162
162
  "react": "^16.8.6",
163
163
  "react-addons-test-utils": "^15.6.2",
164
164
  "react-dom": "^16.8.6",
@@ -174,5 +174,5 @@
174
174
  "publishConfig": {
175
175
  "access": "public"
176
176
  },
177
- "gitHead": "61ac5eafa06f38b395d85655cec64a876b07e268"
177
+ "gitHead": "6b0f266164e85a033952f5571797a836499def65"
178
178
  }