Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-ora2
Commits
8d5a842e
Commit
8d5a842e
authored
Dec 30, 2014
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for javascript.
TNL-708wq
parent
29e270a1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
31 deletions
+39
-31
openassessment/xblock/static/js/fixtures/templates.json
+2
-2
openassessment/xblock/static/js/openassessment-studio.min.js
+0
-0
openassessment/xblock/static/js/spec/oa_server.js
+3
-3
openassessment/xblock/static/js/spec/studio/oa_edit.js
+2
-2
openassessment/xblock/static/js/spec/studio/oa_edit_prompt.js
+32
-7
openassessment/xblock/static/js/src/studio/oa_container_item.js
+0
-10
openassessment/xblock/static/js/src/studio/oa_edit_prompts.js
+0
-7
No files found.
openassessment/xblock/static/js/fixtures/templates.json
View file @
8d5a842e
...
...
@@ -403,7 +403,7 @@
{
"template"
:
"openassessmentblock/edit/oa_edit.html"
,
"context"
:
{
"prompt
"
:
"How much do you like waffles?"
,
"prompt
s"
:
[{
"description"
:
"How much do you like waffles?"
},
{
"description"
:
"How much do you like waffles 2?"
}]
,
"title"
:
"The most important of all questions."
,
"submission_start"
:
"2014-01-02T12:15"
,
"submission_due"
:
"2014-10-01T04:53"
,
...
...
@@ -484,7 +484,7 @@
{
"template"
:
"openassessmentblock/edit/oa_edit.html"
,
"context"
:
{
"prompt
"
:
"Test prompt"
,
"prompt
s"
:
[{
"description"
:
"How much do you like waffles?"
},
{
"description"
:
"How much do you like waffles 2?"
}]
,
"title"
:
"Test title"
,
"submission_start"
:
"2014-01-1T10:00:00"
,
"submission_due"
:
"2014-10-1T10:00:00"
,
...
...
openassessment/xblock/static/js/openassessment-studio.min.js
View file @
8d5a842e
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/spec/oa_server.js
View file @
8d5a842e
...
...
@@ -30,7 +30,7 @@ describe("OpenAssessment.Server", function() {
);
};
var
PROMPT
=
"Hello this is the prompt yes."
;
var
PROMPT
S
=
[{
"description"
:
"Hello this is the prompt yes."
}]
;
var
FEEDBACK_PROMPT
=
"Prompt for feedback"
;
var
FEEDBACK_DEFAULT_TEXT
=
"Default feedback response text"
;
...
...
@@ -253,7 +253,7 @@ describe("OpenAssessment.Server", function() {
it
(
"updates the XBlock's editor context definition"
,
function
()
{
stubAjax
(
true
,
{
success
:
true
});
server
.
updateEditorContext
({
prompt
:
PROMPT
,
prompt
s
:
PROMPTS
,
feedbackPrompt
:
FEEDBACK_PROMPT
,
feedback_default_text
:
FEEDBACK_DEFAULT_TEXT
,
title
:
TITLE
,
...
...
@@ -268,7 +268,7 @@ describe("OpenAssessment.Server", function() {
expect
(
$
.
ajax
).
toHaveBeenCalledWith
({
type
:
"POST"
,
url
:
'/update_editor_context'
,
data
:
JSON
.
stringify
({
prompt
:
PROMPT
,
prompt
s
:
PROMPTS
,
feedback_prompt
:
FEEDBACK_PROMPT
,
feedback_default_text
:
FEEDBACK_DEFAULT_TEXT
,
title
:
TITLE
,
...
...
openassessment/xblock/static/js/spec/studio/oa_edit.js
View file @
8d5a842e
...
...
@@ -43,7 +43,7 @@ describe("OpenAssessment.StudioView", function() {
var
EXPECTED_SERVER_DATA
=
{
title
:
"The most important of all questions."
,
prompt
:
"How much do you like waffles?"
,
prompt
s
:
[{
"description"
:
"How much do you like waffles?"
},
{
description
:
'How much do you like waffles 2?'
}]
,
feedbackPrompt
:
""
,
submissionStart
:
"2014-01-02T12:15"
,
submissionDue
:
"2014-10-01T04:53"
,
...
...
@@ -145,7 +145,7 @@ describe("OpenAssessment.StudioView", function() {
// Top-level attributes
expect
(
server
.
receivedData
.
title
).
toEqual
(
EXPECTED_SERVER_DATA
.
title
);
expect
(
server
.
receivedData
.
prompt
).
toEqual
(
EXPECTED_SERVER_DATA
.
prompt
);
expect
(
server
.
receivedData
.
prompt
s
).
toEqual
(
EXPECTED_SERVER_DATA
.
prompts
);
expect
(
server
.
receivedData
.
feedbackPrompt
).
toEqual
(
EXPECTED_SERVER_DATA
.
feedbackPrompt
);
expect
(
server
.
receivedData
.
submissionStart
).
toEqual
(
EXPECTED_SERVER_DATA
.
submissionStart
);
expect
(
server
.
receivedData
.
submissionDue
).
toEqual
(
EXPECTED_SERVER_DATA
.
submissionDue
);
...
...
openassessment/xblock/static/js/spec/studio/oa_edit_prompt.js
View file @
8d5a842e
...
...
@@ -2,7 +2,7 @@
Tests for OpenAssessment prompt editing view.
**/
describe
(
"OpenAssessment.EditPromptView"
,
function
()
{
describe
(
"OpenAssessment.EditPromptView
s
"
,
function
()
{
var
view
=
null
;
...
...
@@ -12,13 +12,38 @@ describe("OpenAssessment.EditPromptView", function() {
// Create the view
var
element
=
$
(
"#oa_prompt_editor_wrapper"
).
get
(
0
);
view
=
new
OpenAssessment
.
EditPromptView
(
element
);
view
=
new
OpenAssessment
.
EditPrompt
s
View
(
element
);
});
it
(
"sets and loads prompt text"
,
function
()
{
view
.
promptText
(
""
);
expect
(
view
.
promptText
()).
toEqual
(
""
);
view
.
promptText
(
"This is a test prompt!"
);
expect
(
view
.
promptText
()).
toEqual
(
"This is a test prompt!"
);
it
(
"reads prompts from the editor"
,
function
()
{
// This assumes a particular structure of the DOM,
// which is set by the HTML fixture.
var
prompts
=
view
.
promptsDefinition
();
expect
(
prompts
.
length
).
toEqual
(
2
);
expect
(
prompts
[
0
]).
toEqual
({
"description"
:
"How much do you like waffles?"
});
});
it
(
"creates new prompts"
,
function
()
{
// Delete all existing prompts
// Then add new prompts (created from a client-side template)
$
.
each
(
view
.
getAllPrompts
(),
function
()
{
view
.
removePrompt
(
this
);
});
view
.
addPrompt
();
view
.
addPrompt
();
view
.
addPrompt
();
var
prompts
=
view
.
promptsDefinition
();
expect
(
prompts
.
length
).
toEqual
(
3
);
expect
(
prompts
[
0
]).
toEqual
({
description
:
""
});
expect
(
prompts
[
1
]).
toEqual
({
description
:
""
});
});
});
openassessment/xblock/static/js/src/studio/oa_container_item.js
View file @
8d5a842e
...
...
@@ -87,7 +87,6 @@ OpenAssessment.Prompt.prototype = {
Returns:
object literal of the form:
{
'uuid': 'djn98jr4inu',
'description': 'Write a nice long essay about anything.'
}
**/
...
...
@@ -95,15 +94,6 @@ OpenAssessment.Prompt.prototype = {
var
fields
=
{
description
:
this
.
description
()
};
// New prompts won't have unique uuids assigned.
// By convention, we exclude the "uuid" key from the JSON dict
// sent to the server, and the server will assign a unique uuid.
var
uuid
=
OpenAssessment
.
Fields
.
stringField
(
$
(
'.openassessment_prompt_uuid'
,
this
.
element
)
);
if
(
uuid
!==
""
)
{
fields
.
uuid
=
uuid
;
}
return
fields
;
},
...
...
openassessment/xblock/static/js/src/studio/oa_edit_prompts.js
View file @
8d5a842e
...
...
@@ -46,13 +46,6 @@ OpenAssessment.EditPromptsView.prototype = {
**/
promptsDefinition
:
function
()
{
var
prompts
=
this
.
promptsContainer
.
getItemValues
();
// Add order_num fields for prompts
for
(
var
prompt_idx
=
0
;
prompt_idx
<
prompts
.
length
;
prompt_idx
++
)
{
var
prompt
=
prompts
[
prompt_idx
];
prompt
.
order_num
=
prompt_idx
;
}
return
prompts
;
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment