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
36657f13
Commit
36657f13
authored
2 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Further changes to fix issue #837.
parent
29e355b6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
stack/input/equiv/equiv.class.php
+5
-4
5 additions, 4 deletions
stack/input/equiv/equiv.class.php
styles.css
+10
-0
10 additions, 0 deletions
styles.css
tests/input_equiv_test.php
+5
-5
5 additions, 5 deletions
tests/input_equiv_test.php
with
20 additions
and
9 deletions
stack/input/equiv/equiv.class.php
+
5
−
4
View file @
36657f13
...
...
@@ -93,6 +93,7 @@ class stack_equiv_input extends stack_input {
}
$attributes
=
array
(
'class'
=>
'equivinput'
,
'name'
=>
$fieldname
,
'id'
=>
$fieldname
,
'rows'
=>
max
(
3
,
count
(
$rows
)
+
1
),
...
...
This diff is collapsed.
Click to expand it.
styles.css
+
10
−
0
View file @
36657f13
...
...
@@ -161,6 +161,14 @@ body.pagelayout-embedded .que.stack .formulation .questiontestslink {
unicode-bidi
:
plaintext
;
}
.que.stack
textarea
.equivinput
{
overflow
:
hidden
;
white-space
:
pre
;
outline
:
none
;
direction
:
ltr
;
unicode-bidi
:
plaintext
;
}
body
.path-question-type-stack-doc
blockquote
{
border-left
:
5px
solid
#ccc
;
margin
:
1.5em
10px
;
...
...
@@ -1046,7 +1054,9 @@ table.HELM_table th:last-child {
.que.stack
.maxima-string
,
.que.stack
.maxima-list
,
.que.stack
.equiv
,
.que.stack
.equivinput
,
.que.stack
.varmatrixinput
,
.que.stack
.matrixtable
,
/* Question authoring form */
#page-question-type-stack
textarea
#id_questionvariables
,
#page-question-type-stack
input
#id_variantsselectionseed
,
...
...
This diff is collapsed.
Click to expand it.
tests/input_equiv_test.php
+
5
−
5
View file @
36657f13
...
...
@@ -52,7 +52,7 @@ class input_equiv_test extends qtype_stack_testcase {
public
function
test_render_blank
()
{
$el
=
stack_input_factory
::
make
(
'equiv'
,
'ans1'
,
'[]'
);
$this
->
assertEquals
(
'<textarea name="stack1__ans1" id="stack1__ans1" rows="3" cols="25" '
.
$this
->
assertEquals
(
'<textarea
class="equivinput"
name="stack1__ans1" id="stack1__ans1" rows="3" cols="25" '
.
'autocapitalize="none" spellcheck="false"></textarea>'
,
$el
->
render
(
new
stack_input_state
(
stack_input
::
VALID
,
array
(),
''
,
''
,
''
,
''
,
''
),
'stack1__ans1'
,
false
,
null
));
...
...
@@ -62,7 +62,7 @@ class input_equiv_test extends qtype_stack_testcase {
$el
=
stack_input_factory
::
make
(
'equiv'
,
'ans1'
,
'[]'
);
$el
->
set_parameter
(
'syntaxHint'
,
'[r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,t*h*i*s+i*s+a+v*e*r*y+l*o*n*g+e*x*p*r*e*s*s*i*o*n=g*o*o*d+t*e*s*t!]'
);
$this
->
assertEquals
(
"<textarea name=
\"
stack1__ans1
\"
id=
\"
stack1__ans1
\"
"
.
$this
->
assertEquals
(
"<textarea
class=
\"
equivinput
\"
name=
\"
stack1__ans1
\"
id=
\"
stack1__ans1
\"
"
.
"rows=
\"
8
\"
cols=
\"
50
\"
autocapitalize=
\"
none
\"
spellcheck=
\"
false
\"
>"
.
"r1 = 0
\n
r2 = 0
\n
r3 = 0
\n
r4 = 0
\n
r5 = 0
\n
r6 = 0
\n
"
.
"t*h*i*s+i*s+a+v*e*r*y+l*o*n*g+e*x*p*r*e*s*s*i*o*n = g*o*o*d+t*e*s*t!"
.
...
...
@@ -74,7 +74,7 @@ class input_equiv_test extends qtype_stack_testcase {
public
function
test_render_firstline
()
{
$el
=
stack_input_factory
::
make
(
'equiv'
,
'ans1'
,
'[]'
);
$el
->
set_parameter
(
'syntaxHint'
,
'firstline'
);
$this
->
assertEquals
(
'<textarea name="stack1__ans1" id="stack1__ans1" rows="3" cols="25" '
.
$this
->
assertEquals
(
'<textarea
class="equivinput"
name="stack1__ans1" id="stack1__ans1" rows="3" cols="25" '
.
'autocapitalize="none" spellcheck="false">x^2 = 4</textarea>'
,
$el
->
render
(
new
stack_input_state
(
stack_input
::
VALID
,
array
(),
''
,
''
,
''
,
''
,
''
),
'stack1__ans1'
,
false
,
'[x^2=4,x=2 or x=-2]'
));
...
...
@@ -84,7 +84,7 @@ class input_equiv_test extends qtype_stack_testcase {
$el
=
stack_input_factory
::
make
(
'equiv'
,
'ans1'
,
'[]'
);
// Note the syntax hint must be a list.
$el
->
set_parameter
(
'syntaxHint'
,
'[x^2=3]'
);
$this
->
assertEquals
(
'<textarea name="stack1__ans1" id="stack1__ans1" rows="3" cols="25" '
.
$this
->
assertEquals
(
'<textarea
class="equivinput"
name="stack1__ans1" id="stack1__ans1" rows="3" cols="25" '
.
'autocapitalize="none" spellcheck="false">x^2 = 3</textarea>'
,
$el
->
render
(
new
stack_input_state
(
stack_input
::
VALID
,
array
(),
''
,
''
,
''
,
''
,
''
),
'stack1__ans1'
,
false
,
'[x^2=4,x=2 or x=-2]'
));
...
...
@@ -209,7 +209,7 @@ class input_equiv_test extends qtype_stack_testcase {
$this
->
assertEquals
(
'\[ \begin{array}{lll} &x^2-5\cdot x+6=0& \cr'
.
' \color{green}{\Leftrightarrow}&x=2\,{\mbox{ or }}\, x=3& \cr \end{array} \]'
,
$state
->
contentsdisplayed
);
$this
->
assertEquals
(
''
,
$state
->
note
);
$this
->
assertEquals
(
'<textarea name="q140:1_ans1" id="q140:1_ans1" rows="3" cols="25" '
.
$this
->
assertEquals
(
'<textarea
class="equivinput"
name="q140:1_ans1" id="q140:1_ans1" rows="3" cols="25" '
.
'autocapitalize="none" spellcheck="false">x^2-5*x+6=0'
.
"
\n
"
.
'x=2 or x=3</textarea>'
,
$el
->
render
(
$state
,
'q140:1_ans1'
,
false
,
null
));
$this
->
assertEquals
(
'<span class="filter_mathjaxloader_equation">'
.
...
...
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