Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
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
OpenEdx
edx-proctoring
Commits
7e7e9788
Commit
7e7e9788
authored
Oct 24, 2017
by
Farhanah Sheets
Committed by
GitHub
Oct 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #363 from jspayd/toggle-timer
Toggle timer visibility on timed exams
parents
23ab09c4
63d9456e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletions
+33
-1
edx_proctoring/static/proctoring/js/views/proctored_exam_view.js
+19
-0
edx_proctoring/static/proctoring/spec/proctored_exam_spec.js
+14
-1
No files found.
edx_proctoring/static/proctoring/js/views/proctored_exam_view.js
View file @
7e7e9788
...
@@ -49,6 +49,9 @@ var edx = edx || {};
...
@@ -49,6 +49,9 @@ var edx = edx || {};
/* will call into the rendering */
/* will call into the rendering */
this
.
model
.
fetch
();
this
.
model
.
fetch
();
},
},
events
:
{
'click #toggle_timer'
:
'toggleTimerVisibility'
},
detectScroll
:
function
(
event
)
{
detectScroll
:
function
(
event
)
{
if
(
$
(
event
.
currentTarget
).
scrollTop
()
>
this
.
timerBarTopPosition
)
{
if
(
$
(
event
.
currentTarget
).
scrollTop
()
>
this
.
timerBarTopPosition
)
{
$
(
".proctored_exam_status"
).
addClass
(
'is-fixed'
);
$
(
".proctored_exam_status"
).
addClass
(
'is-fixed'
);
...
@@ -171,6 +174,22 @@ var edx = edx || {};
...
@@ -171,6 +174,22 @@ var edx = edx || {};
// refresh the page when the timer expired
// refresh the page when the timer expired
self
.
reloadPage
();
self
.
reloadPage
();
}
}
},
toggleTimerVisibility
:
function
(
event
)
{
var
button
=
$
(
event
.
currentTarget
);
var
icon
=
button
.
find
(
'i'
);
var
timer
=
this
.
$el
.
find
(
'span#time_remaining_id b'
);
if
(
timer
.
hasClass
(
'timer-hidden'
))
{
timer
.
removeClass
(
'timer-hidden'
);
button
.
attr
(
'aria-pressed'
,
'false'
);
icon
.
removeClass
(
'fa-eye'
).
addClass
(
'fa-eye-slash'
);
}
else
{
timer
.
addClass
(
'timer-hidden'
);
button
.
attr
(
'aria-pressed'
,
'true'
);
icon
.
removeClass
(
'fa-eye-slash'
).
addClass
(
'fa-eye'
);
}
event
.
stopPropagation
();
event
.
preventDefault
();
}
}
});
});
this
.
edx
.
coursware
.
proctored_exam
.
ProctoredExamView
=
edx
.
coursware
.
proctored_exam
.
ProctoredExamView
;
this
.
edx
.
coursware
.
proctored_exam
.
ProctoredExamView
=
edx
.
coursware
.
proctored_exam
.
ProctoredExamView
;
...
...
edx_proctoring/static/proctoring/spec/proctored_exam_spec.js
View file @
7e7e9788
...
@@ -9,7 +9,11 @@ describe('ProctoredExamView', function () {
...
@@ -9,7 +9,11 @@ describe('ProctoredExamView', function () {
'You are taking "'
+
'You are taking "'
+
'<a href="<%= exam_url_path %>"> <%= exam_display_name %> </a>'
+
'<a href="<%= exam_url_path %>"> <%= exam_display_name %> </a>'
+
'" as a proctored exam. The timer on the right shows the time remaining in the exam'
+
'" as a proctored exam. The timer on the right shows the time remaining in the exam'
+
'<span id="time_remaining_id" class="pull-right"> <b> </b> </span> </div>'
+
'<span class="exam-timer-clock"> <span id="time_remaining_id">'
+
'<b> </b> <button role="button" id="toggle_timer" aria-label="Hide Timer" aria-pressed="false">'
+
'<i class="fa fa-eye-slash" aria-hidden="true"></i></button>'
+
'</span> </span>'
+
'</div>'
+
'</script>'
+
'</script>'
+
'</div>'
'</div>'
);
);
...
@@ -55,6 +59,15 @@ describe('ProctoredExamView', function () {
...
@@ -55,6 +59,15 @@ describe('ProctoredExamView', function () {
this
.
proctored_exam_view
.
render
();
this
.
proctored_exam_view
.
render
();
expect
(
this
.
proctored_exam_view
.
$el
.
find
(
'div.exam-timer'
)).
toHaveClass
(
'low-time critical'
);
expect
(
this
.
proctored_exam_view
.
$el
.
find
(
'div.exam-timer'
)).
toHaveClass
(
'low-time critical'
);
});
});
it
(
'toggles timer visibility correctly'
,
function
()
{
var
button
=
this
.
proctored_exam_view
.
$el
.
find
(
'#toggle_timer'
);
var
timer
=
this
.
proctored_exam_view
.
$el
.
find
(
'span#time_remaining_id b'
);
expect
(
timer
).
not
.
toHaveClass
(
'timer-hidden'
);
button
.
click
();
expect
(
timer
).
toHaveClass
(
'timer-hidden'
);
button
.
click
();
expect
(
timer
).
not
.
toHaveClass
(
'timer-hidden'
);
});
it
(
"reload the page when the exam time finishes"
,
function
(){
it
(
"reload the page when the exam time finishes"
,
function
(){
this
.
proctored_exam_view
.
secondsLeft
=
-
10
;
this
.
proctored_exam_view
.
secondsLeft
=
-
10
;
var
reloadPage
=
spyOn
(
this
.
proctored_exam_view
,
'reloadPage'
);
var
reloadPage
=
spyOn
(
this
.
proctored_exam_view
,
'reloadPage'
);
...
...
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