qti 2.21.0 → 2.22.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e16530dedba8c33540a05d73d7c497eb3d3d84a75891fe080443187c85a68eff
4
- data.tar.gz: 5e83f70021c905abba7bafb12cbad27532868f972d423f21c5ca4209a00af5c8
3
+ metadata.gz: 226c095ecb34ca04b13cfd9f81f39322b95317290c2e26ba4c01a1fb96fba029
4
+ data.tar.gz: 8053d9550e1a7bfca1a6b510e63bbae3ae8e57981281e2e651488addcc6361af
5
5
  SHA512:
6
- metadata.gz: 61b96b3a9dd2096b2b15766d2e577a90f225181de62ddd9f2304e2163e84e08011b31b5395157a81ce131eb3b160a94e9455de8faf1c2888488edf7168bafb03
7
- data.tar.gz: 812ef9edf33a9b3fd1f1712767b14ab63a21f845a02df89affc98feebff7698cca561c3945eb2988e5b41ed23bdb736e697024421d20d247dc5bcdb684a5d381
6
+ metadata.gz: 7ec199fed12c9b46b9a7f7ea3ed74aaeaf2877e6202d13e4fc5da4c30ca225f38832473b13d3653a1a9ef0a4fa1e7d4fb7ac0d6a1e287c825aafa534425450ee
7
+ data.tar.gz: 7c3146c9f00d6fd745b2cd9046e0614ffb44db07484659bd2cb11099e37f719c30f03a18431b12bdf76df62072ff78f17bbbd5a594952e5a1d3916a1f95f5d93
@@ -44,6 +44,13 @@ module Qti
44
44
  end
45
45
  end
46
46
 
47
+ def scoring_algorithm
48
+ scoring_algorithm_path = './/xmlns:qtimetadatafield/xmlns:fieldlabel' \
49
+ '[text()="scoring_algorithm"]/../xmlns:fieldentry'
50
+
51
+ node.at_xpath(scoring_algorithm_path)&.text
52
+ end
53
+
47
54
  private
48
55
 
49
56
  def answer_nodes
@@ -72,8 +79,8 @@ module Qti
72
79
  scoring_options: scoring_options)
73
80
  end
74
81
  end
75
- # rubocop:enable Metrics/AbcSize
76
82
 
83
+ # rubocop:enable Metrics/AbcSize
77
84
  def setvar_nodes(choice_nodes)
78
85
  choice_nodes.select do |choice_node|
79
86
  choice_node.at_xpath('.//xmlns:setvar')&.content&.to_f&.positive?
@@ -35,6 +35,13 @@ module Qti
35
35
  all.reject { |v| correct.include? v }
36
36
  end
37
37
 
38
+ def scoring_algorithm
39
+ scoring_algorithm_path = './/xmlns:qtimetadatafield/xmlns:fieldlabel' \
40
+ '[text()="scoring_algorithm"]/../xmlns:fieldentry'
41
+
42
+ node.at_xpath(scoring_algorithm_path)&.text
43
+ end
44
+
38
45
  private
39
46
 
40
47
  def parse_scoring_data
@@ -43,6 +50,7 @@ module Qti
43
50
  matches = node.xpath(path).map do |node|
44
51
  [node.attributes['respident'].value, answers_map[node.content]]
45
52
  end
53
+
46
54
  [Models::ScoringData.new(Hash[matches], rcardinality)]
47
55
  end
48
56
 
@@ -12,10 +12,35 @@ module Qti
12
12
  new(node, parent)
13
13
  end
14
14
 
15
+ def top_label
16
+ @top_label ||= label_at_position('top')
17
+ end
18
+
19
+ def bottom_label
20
+ @bottom_label ||= label_at_position('bottom')
21
+ end
22
+
15
23
  def scoring_data_structs
16
24
  correct_order = node.xpath('.//xmlns:varequal').map(&:content)
17
25
  correct_order.map { |id| ScoringData.new(id, rcardinality) }
18
26
  end
27
+
28
+ def display_answers_paragraph
29
+ render_extension = node.at_xpath('.//xmlns:render_extension')
30
+ ims_render_object = render_extension&.at_xpath('.//xmlns:ims_render_object')
31
+
32
+ ims_render_object&.attributes&.[]('orientation')&.value&.downcase == 'row' || false
33
+ end
34
+
35
+ private
36
+
37
+ def label_at_position(position)
38
+ render_extension = node.at_xpath('.//xmlns:render_extension')
39
+ label_material = render_extension&.at_xpath(".//xmlns:material[@position='#{position}']")
40
+ label_mattext = label_material&.at_xpath('.//xmlns:mattext')
41
+
42
+ label_mattext&.content
43
+ end
19
44
  end
20
45
  end
21
46
  end
@@ -10,11 +10,40 @@ module Qti
10
10
  new(node, parent)
11
11
  end
12
12
 
13
+ def rce
14
+ @rce ||= (rce_raw.nil? || rce_raw.downcase == 'yes')
15
+ end
16
+
17
+ def word_count
18
+ @word_count ||= @node.at_xpath('.//xmlns:response_str/@word_count')&.value&.downcase == 'yes'
19
+ end
20
+
21
+ def spell_check
22
+ @spell_check ||= @node.at_xpath('.//xmlns:response_str/@spell_check')&.value&.downcase == 'yes'
23
+ end
24
+
25
+ def word_limit_enabled
26
+ @word_limit_enabled ||=
27
+ @node.at_xpath('.//xmlns:response_str/@word_limit_enabled')&.value&.downcase == 'yes'
28
+ end
29
+
30
+ def word_limit_max
31
+ @word_limit_max ||= @node.at_xpath('.//xmlns:response_str/@word_limit_max')&.value
32
+ end
33
+
34
+ def word_limit_min
35
+ @word_limit_min ||= @node.at_xpath('.//xmlns:response_str/@word_limit_min')&.value
36
+ end
37
+
13
38
  private
14
39
 
15
40
  def rcardinality
16
41
  @rcardinality ||= @node.at_xpath('.//xmlns:response_str/@rcardinality').value
17
42
  end
43
+
44
+ def rce_raw
45
+ @rce_raw ||= @node.at_xpath('.//xmlns:response_str/@rce')&.value
46
+ end
18
47
  end
19
48
  end
20
49
  end
@@ -27,6 +27,14 @@ module Qti
27
27
  def scoring_data_structs
28
28
  { value: '' }
29
29
  end
30
+
31
+ def allowed_types
32
+ @allowed_types ||= @node.at_xpath('.//xmlns:presentation/@allowed_types')&.value
33
+ end
34
+
35
+ def files_count
36
+ @files_count ||= @node.at_xpath('.//xmlns:presentation/@files_count')&.value
37
+ end
30
38
  end
31
39
  end
32
40
  end
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.21.0'.freeze
2
+ VERSION = '2.22.1'.freeze
3
3
  end
@@ -220,6 +220,10 @@
220
220
  <fieldentry>i50a52b1e8b3e61e8e4f56b30182a3f6f</fieldentry>
221
221
  </qtimetadatafield>
222
222
  </qtimetadata>
223
+ <qtimetadatafield>
224
+ <fieldlabel>scoring_algorithm</fieldlabel>
225
+ <fieldentry>AllOrNothing</fieldentry>
226
+ </qtimetadatafield>
223
227
  </itemmetadata>
224
228
  <presentation>
225
229
  <material>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
3
+ <item ident="if15fb877c2cde9a14437aa7429360ac6" title="First Essay">
4
+ <presentation>
5
+ <material>
6
+ <mattext texttype="text/html">
7
+ &lt;div&gt;&lt;p&gt;Here is an essay question.&lt;/p&gt;&lt;/div&gt;
8
+ </mattext>
9
+ </material>
10
+ <response_str ident="response1" rcardinality="Single" rce="No" word_count="Yes" spell_check="Yes" word_limit_max="500" word_limit_min="140" word_limit_enabled="Yes">
11
+ <render_fib>
12
+ <response_label ident="answer1" rshuffle="No"/>
13
+ </render_fib>
14
+ </response_str>
15
+ </presentation>
16
+ <resprocessing>
17
+ <outcomes>
18
+ <decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
19
+ </outcomes>
20
+ <respcondition continue="No">
21
+ <conditionvar>
22
+ <other/>
23
+ </conditionvar>
24
+ </respcondition>
25
+ </resprocessing>
26
+ </item>
27
+ </questestinterop>
@@ -70,5 +70,25 @@
70
70
  <setvar varname="SCORE" action="Add">50.00</setvar>
71
71
  </respcondition>
72
72
  </resprocessing>
73
+ <itemmetadata>
74
+ <qtimetadata>
75
+ <qtimetadatafield>
76
+ <fieldlabel>question_type</fieldlabel>
77
+ <fieldentry>multiple_answers_question</fieldentry>
78
+ </qtimetadatafield>
79
+ <qtimetadatafield>
80
+ <fieldlabel>points_possible</fieldlabel>
81
+ <fieldentry>1.0</fieldentry>
82
+ </qtimetadatafield>
83
+ <qtimetadatafield>
84
+ <fieldlabel>assessment_question_identifierref</fieldlabel>
85
+ <fieldentry>i50a52b1e8b3e61e8e4f56b30182a3f6f</fieldentry>
86
+ </qtimetadatafield>
87
+ </qtimetadata>
88
+ <qtimetadatafield>
89
+ <fieldlabel>scoring_algorithm</fieldlabel>
90
+ <fieldentry>AllOrNothing</fieldentry>
91
+ </qtimetadatafield>
92
+ </itemmetadata>
73
93
  </item>
74
94
  </questestinterop>
@@ -94,6 +94,26 @@
94
94
  <setvar varname="que_score" action="Add">25.00</setvar>
95
95
  </respcondition>
96
96
  </resprocessing>
97
+ <itemmetadata>
98
+ <qtimetadata>
99
+ <qtimetadatafield>
100
+ <fieldlabel>question_type</fieldlabel>
101
+ <fieldentry>multiple_answers_question</fieldentry>
102
+ </qtimetadatafield>
103
+ <qtimetadatafield>
104
+ <fieldlabel>points_possible</fieldlabel>
105
+ <fieldentry>1.0</fieldentry>
106
+ </qtimetadatafield>
107
+ <qtimetadatafield>
108
+ <fieldlabel>assessment_question_identifierref</fieldlabel>
109
+ <fieldentry>i50a52b1e8b3e61e8e4f56b30182a3f6f</fieldentry>
110
+ </qtimetadatafield>
111
+ </qtimetadata>
112
+ <qtimetadatafield>
113
+ <fieldlabel>scoring_algorithm</fieldlabel>
114
+ <fieldentry>AllOrNothing</fieldentry>
115
+ </qtimetadatafield>
116
+ </itemmetadata>
97
117
  </item>
98
118
  </section>
99
119
  </assessment>
@@ -0,0 +1,85 @@
1
+ <?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>
2
+ <!DOCTYPE questestinterop SYSTEM "ims_qtiasiv1p2.dtd" [
3
+ <!-- This is an IMS test extension for OBJECT rendering. -->
4
+ <!ELEMENT ims_render_object (flow_label+)>
5
+ <!ATTLIST ims_render_object
6
+ shuffle (Yes|No) 'No'
7
+ orientation (Row|Column) #REQUIRED >
8
+ ]>
9
+
10
+ <!-- Author: Colin Smythe -->
11
+
12
+ <!-- Date: 22nd January, 2002 -->
13
+
14
+ <!-- Version 1.2 Compliant Example: BasicExample009b -->
15
+
16
+ <!-- Basic Example with response processing. -->
17
+ <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
18
+ <qticomment>This is a standard ordering of a list of words. Ordered response processing is demonstrated.</qticomment>
19
+ <item title = "Standard Object Ordering of text Item" ident = "IMS_V01_I_BasicExample009b">
20
+ <presentation label = "BasicExample009b">
21
+ <flow>
22
+ <material>
23
+ <mattext>What is the correct order for the days of the week ?</mattext>
24
+ </material>
25
+ <response_lid ident = "OB01" rcardinality = "Ordered" rtiming = "No">
26
+ <render_extension>
27
+ <ims_render_object shuffle = "No" orientation = "Row">
28
+ <flow_label>
29
+ <response_label ident = "A">
30
+ <material>
31
+ <mattext>Monday</mattext>
32
+ </material>
33
+ </response_label>
34
+ <response_label ident = "B">
35
+ <material>
36
+ <mattext>Tuesday</mattext>
37
+ </material>
38
+ </response_label>
39
+ <response_label ident = "C">
40
+ <material>
41
+ <mattext>Friday</mattext>
42
+ </material>
43
+ </response_label>
44
+ <response_label ident = "D">
45
+ <material>
46
+ <mattext>Thursday</mattext>
47
+ </material>
48
+ </response_label>
49
+ <response_label ident = "E">
50
+ <material>
51
+ <mattext>Wednesday</mattext>
52
+ </material>
53
+ </response_label>
54
+ </flow_label>
55
+ </ims_render_object>
56
+ </render_extension>
57
+ </response_lid>
58
+ </flow>
59
+ </presentation>
60
+ <resprocessing>
61
+ <outcomes>
62
+ <decvar varname = "ORDERSCORE" vartype = "Integer" defaultval = "1"/>
63
+ </outcomes>
64
+ <respcondition>
65
+ <qticomment>Scoring for the correct answer where the order is important.</qticomment>
66
+ <conditionvar>
67
+ <varequal respident = "OB01">A</varequal>
68
+ <varequal respident = "OB01">B</varequal>
69
+ <varequal respident = "OB01">E</varequal>
70
+ <varequal respident = "OB01">D</varequal>
71
+ <varequal respident = "OB01">C</varequal>
72
+ </conditionvar>
73
+ <setvar action = "Add" varname = "SCORE1"> 5 </setvar>
74
+ <displayfeedback feedbacktype = "Response" linkrefid = "Correct"/>
75
+ </respcondition>
76
+ </resprocessing>
77
+ <itemfeedback ident = "Correct" view = "Candidate">
78
+ <flow_mat>
79
+ <material>
80
+ <mattext>Yes, the correct order.</mattext>
81
+ </material>
82
+ </flow_mat>
83
+ </itemfeedback>
84
+ </item>
85
+ </questestinterop>
@@ -24,7 +24,7 @@
24
24
  </material>
25
25
  <response_lid ident = "OB01" rcardinality = "Ordered" rtiming = "No">
26
26
  <render_extension>
27
- <ims_render_object shuffle = "No" orientation = "Row">
27
+ <ims_render_object shuffle = "No">
28
28
  <flow_label>
29
29
  <response_label ident = "A">
30
30
  <material>
@@ -0,0 +1,91 @@
1
+ <?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>
2
+ <!DOCTYPE questestinterop SYSTEM "ims_qtiasiv1p2.dtd" [
3
+ <!-- This is an IMS test extension for OBJECT rendering. -->
4
+ <!ELEMENT ims_render_object (flow_label+)>
5
+ <!ATTLIST ims_render_object
6
+ shuffle (Yes|No) 'No'
7
+ orientation (Row|Column) #REQUIRED >
8
+ ]>
9
+
10
+ <!-- Author: Colin Smythe -->
11
+
12
+ <!-- Date: 22nd January, 2002 -->
13
+
14
+ <!-- Version 1.2 Compliant Example: BasicExample009b -->
15
+
16
+ <!-- Basic Example with response processing. -->
17
+ <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
18
+ <qticomment>This is a standard ordering of a list of words. Ordered response processing is demonstrated.</qticomment>
19
+ <item title = "Standard Object Ordering of text Item" ident = "IMS_V01_I_BasicExample009b">
20
+ <presentation label = "BasicExample009b">
21
+ <flow>
22
+ <material>
23
+ <mattext>What is the correct order for the days of the week ?</mattext>
24
+ </material>
25
+ <response_lid ident = "OB01" rcardinality = "Ordered" rtiming = "No">
26
+ <render_extension>
27
+ <material position="top">
28
+ <mattext>This is the top label</mattext>
29
+ </material>
30
+ <ims_render_object shuffle = "No" orientation = "Row">
31
+ <flow_label>
32
+ <response_label ident = "A">
33
+ <material>
34
+ <mattext>Monday</mattext>
35
+ </material>
36
+ </response_label>
37
+ <response_label ident = "B">
38
+ <material>
39
+ <mattext>Tuesday</mattext>
40
+ </material>
41
+ </response_label>
42
+ <response_label ident = "C">
43
+ <material>
44
+ <mattext>Friday</mattext>
45
+ </material>
46
+ </response_label>
47
+ <response_label ident = "D">
48
+ <material>
49
+ <mattext>Thursday</mattext>
50
+ </material>
51
+ </response_label>
52
+ <response_label ident = "E">
53
+ <material>
54
+ <mattext>Wednesday</mattext>
55
+ </material>
56
+ </response_label>
57
+ </flow_label>
58
+ </ims_render_object>
59
+ <material position="bottom">
60
+ <mattext>This is the bottom label</mattext>
61
+ </material>
62
+ </render_extension>
63
+ </response_lid>
64
+ </flow>
65
+ </presentation>
66
+ <resprocessing>
67
+ <outcomes>
68
+ <decvar varname = "ORDERSCORE" vartype = "Integer" defaultval = "1"/>
69
+ </outcomes>
70
+ <respcondition>
71
+ <qticomment>Scoring for the correct answer where the order is important.</qticomment>
72
+ <conditionvar>
73
+ <varequal respident = "OB01">A</varequal>
74
+ <varequal respident = "OB01">B</varequal>
75
+ <varequal respident = "OB01">E</varequal>
76
+ <varequal respident = "OB01">D</varequal>
77
+ <varequal respident = "OB01">C</varequal>
78
+ </conditionvar>
79
+ <setvar action = "Add" varname = "SCORE1"> 5 </setvar>
80
+ <displayfeedback feedbacktype = "Response" linkrefid = "Correct"/>
81
+ </respcondition>
82
+ </resprocessing>
83
+ <itemfeedback ident = "Correct" view = "Candidate">
84
+ <flow_mat>
85
+ <material>
86
+ <mattext>Yes, the correct order.</mattext>
87
+ </material>
88
+ </flow_mat>
89
+ </itemfeedback>
90
+ </item>
91
+ </questestinterop>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
3
+ <qtimetadata>
4
+ <qtimetadatafield>
5
+ <fieldlabel>cc_maxattempts</fieldlabel>
6
+ <fieldentry>1</fieldentry>
7
+ </qtimetadatafield>
8
+ </qtimetadata>
9
+ <section ident="root_section">
10
+ <item ident="i53d46f6a4edbfcefd662489e9f2a970a" title="Question">
11
+ <itemmetadata>
12
+ <qtimetadata>
13
+ <qtimetadatafield>
14
+ <fieldlabel>question_type</fieldlabel>
15
+ <fieldentry>file_upload_question</fieldentry>
16
+ </qtimetadatafield>
17
+ <qtimetadatafield>
18
+ <fieldlabel>points_possible</fieldlabel>
19
+ <fieldentry>1.0</fieldentry>
20
+ </qtimetadatafield>
21
+ <qtimetadatafield>
22
+ <fieldlabel>assessment_question_identifierref</fieldlabel>
23
+ <fieldentry>i2b5557c31dcad5441b956ebb83d06915</fieldentry>
24
+ </qtimetadatafield>
25
+ </qtimetadata>
26
+ </itemmetadata>
27
+ <presentation allowed_types="png,jpeg" files_count="2">
28
+ <material>
29
+ <mattext texttype="text/html">Upload a file that is a CSV</mattext>
30
+ </material>
31
+ </presentation>
32
+ </item>
33
+ </section>
34
+ </questestinterop>
@@ -41,6 +41,10 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
41
41
  include_examples 'locked_choices'
42
42
  include_examples 'answers'
43
43
  include_examples 'meta_type'
44
+
45
+ it 'does not have any scoring algorithm' do
46
+ expect(loaded_class.scoring_algorithm).to eq nil
47
+ end
44
48
  end
45
49
 
46
50
  context 'true_false.xml' do
@@ -61,6 +65,10 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
61
65
  let(:shuffle_value) { false }
62
66
  let(:locked_choices_value) { [] }
63
67
 
68
+ it 'has the correct scoring algorithm' do
69
+ expect(loaded_class.scoring_algorithm).to eq 'AllOrNothing'
70
+ end
71
+
64
72
  include_examples 'shuffled?'
65
73
  include_examples 'locked_choices'
66
74
  end
@@ -75,6 +83,10 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
75
83
  include_examples 'shuffled?'
76
84
  include_examples 'locked_choices'
77
85
  include_examples 'meta_type'
86
+
87
+ it 'does not have any scoring algorithm' do
88
+ expect(loaded_class.scoring_algorithm).to eq nil
89
+ end
78
90
  end
79
91
 
80
92
  context 'multiple respconditions with empty setvars' do
@@ -59,6 +59,10 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
59
59
  end
60
60
  let(:expected_distractors) { ['A distractor answer.'] }
61
61
 
62
+ it 'has the correct scoring algorithm' do
63
+ expect(subject.scoring_algorithm).to eq 'AllOrNothing'
64
+ end
65
+
62
66
  include_examples('common features')
63
67
  include_examples('questions and answers')
64
68
  include_examples('#scoring_data_structs')
@@ -88,5 +92,9 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
88
92
  include_examples('common features')
89
93
  include_examples('questions and answers')
90
94
  include_examples('#scoring_data_structs')
95
+
96
+ it 'does not have any scoring algorithm' do
97
+ expect(subject.scoring_algorithm).to eq nil
98
+ end
91
99
  end
92
100
  end
@@ -10,6 +10,54 @@ describe Qti::V1::Models::Interactions::OrderingInteraction do
10
10
  end
11
11
  end
12
12
 
13
+ describe '.top_label' do
14
+ context 'when the item does not have a top label' do
15
+ it 'returns nil' do
16
+ expect(subject.top_label).to be_nil
17
+ end
18
+ end
19
+
20
+ context 'when the item has a top label' do
21
+ let(:file) { File.join('spec', 'fixtures', 'items_1.2', 'ordering_with_labels.xml') }
22
+
23
+ it 'returns the right bottom label' do
24
+ expect(subject.top_label).to eq('This is the top label')
25
+ end
26
+ end
27
+ end
28
+
29
+ describe '.bottom label' do
30
+ context 'when the item does not have a bottom label' do
31
+ it 'returns the right bottom label' do
32
+ expect(subject.bottom_label).to be_nil
33
+ end
34
+ end
35
+
36
+ context 'when the item has a bottom label' do
37
+ let(:file) { File.join('spec', 'fixtures', 'items_1.2', 'ordering_with_labels.xml') }
38
+
39
+ it 'returns the right bottom label' do
40
+ expect(subject.bottom_label).to eq('This is the bottom label')
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '.display_answers_paragraph' do
46
+ context 'when the ordering item orientation is set to "Row"' do
47
+ let(:file) { File.join('spec', 'fixtures', 'items_1.2', 'ordering.row.xml') }
48
+
49
+ it 'returns true' do
50
+ expect(subject.display_answers_paragraph).to eq(true)
51
+ end
52
+ end
53
+
54
+ context 'when the ordering item orientation is not set to "Row"' do
55
+ it 'returns false' do
56
+ expect(subject.display_answers_paragraph).to eq(false)
57
+ end
58
+ end
59
+ end
60
+
13
61
  describe '#scoring_data_structs' do
14
62
  it 'grabs scoring data value for ordering questions' do
15
63
  assessment_item = described_class.new(assessment.assessment_items.first, assessment)
@@ -8,8 +8,28 @@ describe Qti::V1::Models::Interactions::StringInteraction do
8
8
  let(:file_path) { File.join(fixtures_path, 'essay.xml') }
9
9
  let(:cardinality) { 'Single' }
10
10
 
11
- it 'returns loads the correct cardinality' do
11
+ it 'returns the correct cardinality' do
12
12
  expect(loaded_class.send(:rcardinality)).to eq(cardinality)
13
13
  end
14
+
15
+ it 'returns the correct settings' do
16
+ expect(loaded_class.rce).to eq(true)
17
+ expect(loaded_class.word_count).to eq(false)
18
+ expect(loaded_class.spell_check).to eq(false)
19
+ expect(loaded_class.word_limit_max).to be_nil
20
+ expect(loaded_class.word_limit_min).to be_nil
21
+ end
22
+ end
23
+
24
+ context 'essay.xml question with custom settings' do
25
+ let(:file_path) { File.join(fixtures_path, 'essay_custom_settings.xml') }
26
+
27
+ it 'returns the correct settings' do
28
+ expect(loaded_class.rce).to eq(false)
29
+ expect(loaded_class.word_count).to eq(true)
30
+ expect(loaded_class.spell_check).to eq(true)
31
+ expect(loaded_class.word_limit_max).to eq('500')
32
+ expect(loaded_class.word_limit_min).to eq('140')
33
+ end
14
34
  end
15
35
  end
@@ -26,5 +26,19 @@ describe Qti::V1::Models::Interactions::UploadInteraction do
26
26
  )
27
27
  end
28
28
  end
29
+
30
+ it 'returns the correct settings' do
31
+ expect(loaded_class.allowed_types).to be_nil
32
+ expect(loaded_class.files_count).to be_nil
33
+ end
34
+
35
+ context 'with custom settings' do
36
+ let(:file_path) { File.join(fixtures_path, 'upload_with_custom_settings.xml') }
37
+
38
+ it 'returns the correct settings' do
39
+ expect(loaded_class.allowed_types).to eq('png,jpeg')
40
+ expect(loaded_class.files_count).to eq('2')
41
+ end
42
+ end
29
43
  end
30
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qti
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.21.0
4
+ version: 2.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Diaz
@@ -404,6 +404,7 @@ files:
404
404
  - spec/fixtures/items_1.2/choice.xml
405
405
  - spec/fixtures/items_1.2/choice_vary_points_by_answer.xml
406
406
  - spec/fixtures/items_1.2/essay.xml
407
+ - spec/fixtures/items_1.2/essay_custom_settings.xml
407
408
  - spec/fixtures/items_1.2/fib.xml
408
409
  - spec/fixtures/items_1.2/fib_feedback.xml
409
410
  - spec/fixtures/items_1.2/fib_str.xml
@@ -427,7 +428,9 @@ files:
427
428
  - spec/fixtures/items_1.2/numeric_precision.xml
428
429
  - spec/fixtures/items_1.2/numeric_precision_decimals.xml
429
430
  - spec/fixtures/items_1.2/numeric_within_range.xml
431
+ - spec/fixtures/items_1.2/ordering.row.xml
430
432
  - spec/fixtures/items_1.2/ordering.xml
433
+ - spec/fixtures/items_1.2/ordering_with_labels.xml
431
434
  - spec/fixtures/items_1.2/question_group.xml
432
435
  - spec/fixtures/items_1.2/single_fib.xml
433
436
  - spec/fixtures/items_1.2/stimulus.xml
@@ -436,6 +439,7 @@ files:
436
439
  - spec/fixtures/items_1.2/true_false.xml
437
440
  - spec/fixtures/items_1.2/true_false_with_calculator.xml
438
441
  - spec/fixtures/items_1.2/upload.xml
442
+ - spec/fixtures/items_1.2/upload_with_custom_settings.xml
439
443
  - spec/fixtures/items_2.1/Example02-feedbackInline.xml
440
444
  - spec/fixtures/items_2.1/categorization.xml
441
445
  - spec/fixtures/items_2.1/choice.xml
@@ -780,6 +784,7 @@ test_files:
780
784
  - spec/fixtures/items_1.2/choice.xml
781
785
  - spec/fixtures/items_1.2/choice_vary_points_by_answer.xml
782
786
  - spec/fixtures/items_1.2/essay.xml
787
+ - spec/fixtures/items_1.2/essay_custom_settings.xml
783
788
  - spec/fixtures/items_1.2/fib.xml
784
789
  - spec/fixtures/items_1.2/fib_feedback.xml
785
790
  - spec/fixtures/items_1.2/fib_str.xml
@@ -803,7 +808,9 @@ test_files:
803
808
  - spec/fixtures/items_1.2/numeric_precision.xml
804
809
  - spec/fixtures/items_1.2/numeric_precision_decimals.xml
805
810
  - spec/fixtures/items_1.2/numeric_within_range.xml
811
+ - spec/fixtures/items_1.2/ordering.row.xml
806
812
  - spec/fixtures/items_1.2/ordering.xml
813
+ - spec/fixtures/items_1.2/ordering_with_labels.xml
807
814
  - spec/fixtures/items_1.2/question_group.xml
808
815
  - spec/fixtures/items_1.2/single_fib.xml
809
816
  - spec/fixtures/items_1.2/stimulus.xml
@@ -812,6 +819,7 @@ test_files:
812
819
  - spec/fixtures/items_1.2/true_false.xml
813
820
  - spec/fixtures/items_1.2/true_false_with_calculator.xml
814
821
  - spec/fixtures/items_1.2/upload.xml
822
+ - spec/fixtures/items_1.2/upload_with_custom_settings.xml
815
823
  - spec/fixtures/items_2.1/Example02-feedbackInline.xml
816
824
  - spec/fixtures/items_2.1/categorization.xml
817
825
  - spec/fixtures/items_2.1/choice.xml