Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-qtype_stack
Commits
c436aa42
Commit
c436aa42
authored
1 year ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Fix to issue #1057: syntax hint in matrix inputs.
parent
6df3a391
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
stack/input/matrix/matrix.class.php
+1
-1
1 addition, 1 deletion
stack/input/matrix/matrix.class.php
tests/input_matrix_test.php
+22
-0
22 additions, 0 deletions
tests/input_matrix_test.php
with
23 additions
and
1 deletion
stack/input/matrix/matrix.class.php
+
1
−
1
View file @
c436aa42
...
...
@@ -159,7 +159,7 @@ class stack_matrix_input extends stack_input {
// @codingStandardsIgnoreEnd
$rows
=
$this
->
modinput_tokenizer
(
substr
(
$t
,
7
,
-
1
));
for
(
$i
=
0
;
$i
<
count
(
$rows
);
$i
++
)
{
$row
=
$this
->
modinput_tokenizer
(
substr
(
$rows
[
$i
],
1
,
-
1
));
$row
=
$this
->
modinput_tokenizer
(
substr
(
trim
(
$rows
[
$i
]
)
,
1
,
-
1
));
$tc
[
$i
]
=
$row
;
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/input_matrix_test.php
+
22
−
0
View file @
c436aa42
...
...
@@ -120,6 +120,28 @@ class input_matrix_test extends qtype_stack_testcase {
'ans1'
,
false
,
null
));
}
public
function
test_render_syntax_hint_spaces
()
{
$options
=
new
stack_options
();
$el
=
stack_input_factory
::
make
(
'matrix'
,
'ans1'
,
'M'
,
$options
);
$el
->
set_parameter
(
'syntaxHint'
,
'matrix([a,b], [?,d])'
);
$el
->
adapt_to_model_answer
(
'matrix([1,0],[0,1])'
);
$this
->
assertEquals
(
'<div class="matrixsquarebrackets"><table class="matrixtable" id="ans1_container" '
.
'style="display:inline; vertical-align: middle;" cellpadding="1" cellspacing="0"><tbody><tr>'
.
'<td style="padding-top: 0.5em"> </td>'
.
'<td><input type="text" id="ans1_sub_0_0" name="ans1_sub_0_0" value="a" size="5" '
.
'autocapitalize="none" spellcheck="false"></td>'
.
'<td><input type="text" id="ans1_sub_0_1" name="ans1_sub_0_1" value="b" size="5" '
.
'autocapitalize="none" spellcheck="false"></td>'
.
'<td style="padding-top: 0.5em"> </td></tr><tr><td> </td>'
.
'<td><input type="text" id="ans1_sub_1_0" name="ans1_sub_1_0" value="?" size="5" '
.
'autocapitalize="none" spellcheck="false"></td>'
.
'<td><input type="text" id="ans1_sub_1_1" name="ans1_sub_1_1" value="d" size="5" '
.
'autocapitalize="none" spellcheck="false"></td>'
.
'<td style="padding-bottom: 0.5em"> </td></tr></tbody></table></div>'
,
$el
->
render
(
new
stack_input_state
(
stack_input
::
VALID
,
array
(),
''
,
''
,
''
,
''
,
''
),
'ans1'
,
false
,
null
));
}
public
function
test_render_syntax_hint_round
()
{
$options
=
new
stack_options
();
$options
->
set_option
(
'matrixparens'
,
'('
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment