Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
82dea974
Commit
82dea974
authored
Mar 30, 2017
by
Brian Jacobel
Committed by
GitHub
Mar 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14791 from edx/bjacobel/course-outline-events
Add events to course outline, and add JS tests for that
parents
d9ff4ed8
ee344980
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
common/test/acceptance/tests/lms/test_lms_courseware.py
+1
-0
openedx/features/course_experience/static/course_experience/js/course_outline_factory.js
+12
-1
openedx/features/course_experience/static/course_experience/js/spec/course_outline_factory_spec.js
+21
-1
No files found.
common/test/acceptance/tests/lms/test_lms_courseware.py
View file @
82dea974
...
@@ -592,6 +592,7 @@ class CoursewareMultipleVerticalsTest(CoursewareMultipleVerticalsTestBase):
...
@@ -592,6 +592,7 @@ class CoursewareMultipleVerticalsTest(CoursewareMultipleVerticalsTestBase):
selected_events
selected_events
)
)
# TODO: Delete as part of TNL-6546 / LEARNER-71
def
test_link_clicked_events
(
self
):
def
test_link_clicked_events
(
self
):
"""
"""
Given that I am a user in the courseware
Given that I am a user in the courseware
...
...
openedx/features/course_experience/static/course_experience/js/course_outline_factory.js
View file @
82dea974
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
define
([
define
([
'jquery'
,
'jquery'
,
'logger'
,
'edx-ui-toolkit/js/utils/constants'
'edx-ui-toolkit/js/utils/constants'
],
],
function
(
$
,
constants
)
{
function
(
$
,
Logger
,
constants
)
{
return
function
(
root
)
{
return
function
(
root
)
{
// In the future this factory could instantiate a Backbone view or React component that handles events
// In the future this factory could instantiate a Backbone view or React component that handles events
$
(
root
).
keydown
(
function
(
event
)
{
$
(
root
).
keydown
(
function
(
event
)
{
...
@@ -23,6 +24,16 @@
...
@@ -23,6 +24,16 @@
break
;
break
;
}
}
});
});
$
(
'a:not([href^="#"])'
).
click
(
function
(
event
)
{
Logger
.
log
(
'edx.ui.lms.link_clicked'
,
{
current_url
:
window
.
location
.
href
,
target_url
:
event
.
currentTarget
.
href
}
);
});
};
};
}
}
);
);
...
...
openedx/features/course_experience/static/course_experience/js/spec/course_outline_factory_spec.js
View file @
82dea974
define
([
define
([
'jquery'
,
'jquery'
,
'logger'
,
'edx-ui-toolkit/js/utils/constants'
,
'edx-ui-toolkit/js/utils/constants'
,
'course_experience/js/course_outline_factory'
'course_experience/js/course_outline_factory'
],
],
function
(
$
,
constants
,
CourseOutlineFactory
)
{
function
(
$
,
Logger
,
constants
,
CourseOutlineFactory
)
{
'use strict'
;
'use strict'
;
describe
(
'Course outline factory'
,
function
()
{
describe
(
'Course outline factory'
,
function
()
{
...
@@ -81,6 +82,25 @@ define([
...
@@ -81,6 +82,25 @@ define([
});
});
});
});
});
});
describe
(
'eventing'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'course_experience/fixtures/course-outline-fragment.html'
);
CourseOutlineFactory
(
'.block-tree'
);
spyOn
(
Logger
,
'log'
);
});
it
(
'sends an event when an outline section is clicked'
,
function
()
{
$
(
'a.focusable:contains("Homework - Labs and Demos")'
).
click
();
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.ui.lms.link_clicked'
,
{
target_url
:
window
.
location
.
origin
+
'/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type'
+
'@sequential+block@graded_simulations'
,
current_url
:
window
.
location
.
toString
()
});
});
});
});
});
}
}
);
);
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