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
7693659e
Commit
7693659e
authored
May 05, 2014
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address Christina's review comments
parent
6f404fe2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
cms/static/js/spec/views/container_spec.js
+8
-12
No files found.
cms/static/js/spec/views/container_spec.js
View file @
7693659e
...
...
@@ -8,7 +8,7 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
describe
(
"Supports reordering components"
,
function
()
{
var
model
,
containerView
,
mockContainerHTML
,
respondWithMockXBlockFragment
,
init
,
getComponent
,
getDragHandle
,
dragComponentVertically
,
dragComponent
ToY
,
dragComponent
Above
,
getDragHandle
,
dragComponentVertically
,
dragComponentAbove
,
verifyRequest
,
verifyNumReorderCalls
,
respondToRequest
,
rootLocator
=
'testCourse/branch/draft/split_test/splitFFF'
,
...
...
@@ -26,7 +26,6 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
groupBComponent2
=
"locator-component-B2"
,
groupBComponent3
=
"locator-component-B3"
;
rootLocator
=
'testCourse/branch/draft/split_test/splitFFF'
;
mockContainerHTML
=
readFixtures
(
'mock/mock-container-xblock.underscore'
);
respondWithMockXBlockFragment
=
function
(
requests
,
response
)
{
...
...
@@ -81,18 +80,15 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
handle
.
simulate
(
"drag"
,
{
dy
:
dy
});
};
dragComponentToY
=
function
(
locator
,
y
)
{
var
handle
=
getDragHandle
(
locator
),
dragComponentAbove
=
function
(
sourceLocator
,
targetLocator
)
{
var
targetElement
=
getComponent
(
targetLocator
),
targetTop
=
targetElement
.
offset
().
top
+
1
,
handle
=
getDragHandle
(
sourceLocator
),
handleY
=
handle
.
offset
().
top
+
(
handle
.
height
()
/
2
),
dy
=
y
-
handleY
;
dy
=
targetTop
-
handleY
;
handle
.
simulate
(
"drag"
,
{
dy
:
dy
});
};
dragComponentAbove
=
function
(
sourceLocator
,
targetLocator
)
{
var
targetElement
=
getComponent
(
targetLocator
);
dragComponentToY
(
sourceLocator
,
targetElement
.
offset
().
top
+
1
);
};
verifyRequest
=
function
(
requests
,
reorderCallIndex
,
expectedURL
,
expectedChildren
)
{
var
actualIndex
,
request
,
children
,
i
;
// 0th call is the response to the initial render call to get HTML.
...
...
@@ -137,10 +133,10 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
it
(
'can drag from one group to another'
,
function
()
{
var
requests
=
init
(
this
);
// Drag the first component in Group B to the
first group
.
// Drag the first component in Group B to the
top of group A
.
dragComponentAbove
(
groupBComponent1
,
groupAComponent1
);
// Respond to the
first request which will trigger a request to make the move
// Respond to the
two requests: add the component to Group A, then remove it from Group B.
respondToRequest
(
requests
,
0
,
200
);
respondToRequest
(
requests
,
1
,
200
);
...
...
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