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
5fbad148
Commit
5fbad148
authored
Jun 12, 2015
by
cahrens
Committed by
Andy Armstrong
Jun 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jasmine test runner for files in common using RequireJS.
parent
4c39132f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
344 additions
and
75 deletions
+344
-75
common/static/common/js/spec/components/paging_collection.js
+38
-0
common/static/common/js/spec/components/paging_spec.js
+67
-75
common/static/js/spec/main_requirejs.js
+161
-0
common/static/js_test_requirejs.yml
+76
-0
pavelib/utils/envs.py
+2
-0
No files found.
common/static/common/js/spec/components/paging_collection.js
0 → 100644
View file @
5fbad148
define
([
"backbone.paginator"
,
"backbone"
],
function
(
BackbonePaginator
,
Backbone
)
{
// This code was adapted from collections/asset.js.
var
PagingCollection
=
BackbonePaginator
.
requestPager
.
extend
({
model
:
Backbone
.
Model
,
paginator_core
:
{
type
:
'GET'
,
accepts
:
'application/json'
,
dataType
:
'json'
,
url
:
function
()
{
return
this
.
url
;
}
},
paginator_ui
:
{
firstPage
:
0
,
currentPage
:
0
,
perPage
:
50
},
server_api
:
{
'page'
:
function
()
{
return
this
.
currentPage
;
},
'page_size'
:
function
()
{
return
this
.
perPage
;
},
'sort'
:
function
()
{
return
this
.
sortField
;
},
'direction'
:
function
()
{
return
this
.
sortDirection
;
},
'format'
:
'json'
},
parse
:
function
(
response
)
{
var
totalCount
=
response
.
totalCount
,
start
=
response
.
start
,
currentPage
=
response
.
page
,
pageSize
=
response
.
pageSize
,
totalPages
=
Math
.
ceil
(
totalCount
/
pageSize
);
this
.
totalCount
=
totalCount
;
this
.
totalPages
=
Math
.
max
(
totalPages
,
1
);
// Treat an empty collection as having 1 page...
this
.
currentPage
=
currentPage
;
this
.
start
=
start
;
return
response
.
items
;
}
});
return
PagingCollection
;
});
common/static/
js/spec/common
/components/paging_spec.js
→
common/static/
common/js/spec
/components/paging_spec.js
View file @
5fbad148
define
([
"jquery"
,
"common/js/spec_helpers/ajax_helpers"
,
"URI"
,
define
([
"jquery"
,
"common/js/spec_helpers/ajax_helpers"
,
"URI"
,
"
js/views/paging"
,
"js/views/paging_header"
,
"js/views/paging_foot
er"
,
"
common/js/components/views/paging"
,
"common/js/components/views/paging_head
er"
,
"
js/models/asset"
,
"js/collections/asset"
],
"
common/js/components/views/paging_footer"
,
"common/js/spec/components/paging_collection"
],
function
(
$
,
AjaxHelpers
,
URI
,
PagingView
,
PagingHeader
,
PagingFooter
,
AssetModel
,
Asset
Collection
)
{
function
(
$
,
AjaxHelpers
,
URI
,
PagingView
,
PagingHeader
,
PagingFooter
,
Paging
Collection
)
{
var
create
MockAsset
=
function
(
index
)
{
var
create
PageableItem
=
function
(
index
)
{
var
id
=
'
asset
_'
+
index
;
var
id
=
'
item
_'
+
index
;
return
{
return
{
id
:
id
,
id
:
id
,
display_name
:
id
,
display_name
:
id
,
...
@@ -13,10 +13,10 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -13,10 +13,10 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
};
};
var
mockFirstPage
=
{
var
mockFirstPage
=
{
asset
s
:
[
item
s
:
[
create
MockAsset
(
1
),
create
PageableItem
(
1
),
create
MockAsset
(
2
),
create
PageableItem
(
2
),
create
MockAsset
(
3
)
create
PageableItem
(
3
)
],
],
pageSize
:
3
,
pageSize
:
3
,
totalCount
:
4
,
totalCount
:
4
,
...
@@ -25,8 +25,8 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -25,8 +25,8 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
end
:
2
end
:
2
};
};
var
mockSecondPage
=
{
var
mockSecondPage
=
{
asset
s
:
[
item
s
:
[
create
MockAsset
(
4
)
create
PageableItem
(
4
)
],
],
pageSize
:
3
,
pageSize
:
3
,
totalCount
:
4
,
totalCount
:
4
,
...
@@ -35,7 +35,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -35,7 +35,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
end
:
4
end
:
4
};
};
var
mockEmptyPage
=
{
var
mockEmptyPage
=
{
asset
s
:
[],
item
s
:
[],
pageSize
:
3
,
pageSize
:
3
,
totalCount
:
0
,
totalCount
:
0
,
page
:
0
,
page
:
0
,
...
@@ -43,7 +43,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -43,7 +43,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
end
:
0
end
:
0
};
};
var
respondWithMock
Asset
s
=
function
(
requests
)
{
var
respondWithMock
Item
s
=
function
(
requests
)
{
var
requestIndex
=
requests
.
length
-
1
;
var
requestIndex
=
requests
.
length
-
1
;
var
request
=
requests
[
requestIndex
];
var
request
=
requests
[
requestIndex
];
var
url
=
new
URI
(
request
.
url
);
var
url
=
new
URI
(
request
.
url
);
...
@@ -58,9 +58,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -58,9 +58,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
initialize
:
function
()
{
initialize
:
function
()
{
this
.
registerSortableColumn
(
'name-col'
,
'Name'
,
'name'
,
'asc'
);
this
.
registerSortableColumn
(
'name-col'
,
'Name'
,
'name'
,
'asc'
);
this
.
registerSortableColumn
(
'date-col'
,
'Date'
,
'date'
,
'desc'
);
this
.
registerSortableColumn
(
'date-col'
,
'Date'
,
'date'
,
'desc'
);
this
.
registerFilterableColumn
(
'js-asset-type-col'
,
gettext
(
'Type'
),
'asset_type'
);
this
.
setInitialSortColumn
(
'date-col'
);
this
.
setInitialSortColumn
(
'date-col'
);
this
.
setInitialFilterColumn
(
'js-asset-type-col'
);
}
}
});
});
...
@@ -68,30 +66,25 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -68,30 +66,25 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
var
pagingView
;
var
pagingView
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
var
assets
=
new
AssetCollection
();
pagingView
=
new
MockPagingView
({
collection
:
new
PagingCollection
()});
assets
.
url
=
"assets_url"
;
var
feedbackTpl
=
readFixtures
(
'system-feedback.underscore'
);
setFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedbackTpl
));
pagingView
=
new
MockPagingView
({
collection
:
assets
});
});
});
describe
(
"PagingView"
,
function
()
{
describe
(
"PagingView"
,
function
()
{
describe
(
"setPage"
,
function
()
{
describe
(
"setPage"
,
function
()
{
it
(
'can set the current page'
,
function
()
{
it
(
'can set the current page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
});
});
it
(
'should not change page after a server error'
,
function
()
{
it
(
'should not change page after a server error'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
...
@@ -102,7 +95,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -102,7 +95,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'does not move forward after a server error'
,
function
()
{
it
(
'does not move forward after a server error'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
nextPage
();
pagingView
.
nextPage
();
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
...
@@ -111,16 +104,16 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -111,16 +104,16 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'can move to the next page'
,
function
()
{
it
(
'can move to the next page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
nextPage
();
pagingView
.
nextPage
();
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
});
});
it
(
'can not move forward from the final page'
,
function
()
{
it
(
'can not move forward from the final page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
nextPage
();
pagingView
.
nextPage
();
expect
(
requests
.
length
).
toBe
(
1
);
expect
(
requests
.
length
).
toBe
(
1
);
});
});
...
@@ -131,16 +124,16 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -131,16 +124,16 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'can move back a page'
,
function
()
{
it
(
'can move back a page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
previousPage
();
pagingView
.
previousPage
();
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
});
});
it
(
'can not move back from the first page'
,
function
()
{
it
(
'can not move back from the first page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
previousPage
();
pagingView
.
previousPage
();
expect
(
requests
.
length
).
toBe
(
1
);
expect
(
requests
.
length
).
toBe
(
1
);
});
});
...
@@ -148,7 +141,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -148,7 +141,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'does not move back after a server error'
,
function
()
{
it
(
'does not move back after a server error'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingView
.
previousPage
();
pagingView
.
previousPage
();
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
...
@@ -161,21 +154,21 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -161,21 +154,21 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'desc'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'desc'
);
pagingView
.
toggleSortOrder
(
'date-col'
);
pagingView
.
toggleSortOrder
(
'date-col'
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'asc'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'asc'
);
pagingView
.
toggleSortOrder
(
'date-col'
);
pagingView
.
toggleSortOrder
(
'date-col'
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'desc'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'desc'
);
});
});
it
(
'sets the correct default sort direction for a column'
,
function
()
{
it
(
'sets the correct default sort direction for a column'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
toggleSortOrder
(
'name-col'
);
pagingView
.
toggleSortOrder
(
'name-col'
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
sortDisplayName
()).
toBe
(
'Name'
);
expect
(
pagingView
.
sortDisplayName
()).
toBe
(
'Name'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'asc'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'asc'
);
pagingView
.
toggleSortOrder
(
'date-col'
);
pagingView
.
toggleSortOrder
(
'date-col'
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
sortDisplayName
()).
toBe
(
'Date'
);
expect
(
pagingView
.
sortDisplayName
()).
toBe
(
'Date'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'desc'
);
expect
(
pagingView
.
collection
.
sortDirection
).
toBe
(
'desc'
);
});
});
...
@@ -185,7 +178,6 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -185,7 +178,6 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'returns the registered info for a column'
,
function
()
{
it
(
'returns the registered info for a column'
,
function
()
{
pagingView
.
registerSortableColumn
(
'test-col'
,
'Test Column'
,
'testField'
,
'asc'
);
pagingView
.
registerSortableColumn
(
'test-col'
,
'Test Column'
,
'testField'
,
'asc'
);
pagingView
.
registerFilterableColumn
(
'js-asset-type-col'
,
gettext
(
'Type'
),
'asset_type'
);
var
sortInfo
=
pagingView
.
sortableColumnInfo
(
'test-col'
);
var
sortInfo
=
pagingView
.
sortableColumnInfo
(
'test-col'
);
expect
(
sortInfo
.
displayName
).
toBe
(
'Test Column'
);
expect
(
sortInfo
.
displayName
).
toBe
(
'Test Column'
);
expect
(
sortInfo
.
fieldName
).
toBe
(
'testField'
);
expect
(
sortInfo
.
fieldName
).
toBe
(
'testField'
);
...
@@ -217,7 +209,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -217,7 +209,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'does not move forward if a server error occurs'
,
function
()
{
it
(
'does not move forward if a server error occurs'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingHeader
.
$
(
'.next-page-link'
).
click
();
pagingHeader
.
$
(
'.next-page-link'
).
click
();
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
...
@@ -226,23 +218,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -226,23 +218,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'can move to the next page'
,
function
()
{
it
(
'can move to the next page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingHeader
.
$
(
'.next-page-link'
).
click
();
pagingHeader
.
$
(
'.next-page-link'
).
click
();
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
});
});
it
(
'should be enabled when there is at least one more page'
,
function
()
{
it
(
'should be enabled when there is at least one more page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.next-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
expect
(
pagingHeader
.
$
(
'.next-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
});
});
it
(
'should be disabled on the final page'
,
function
()
{
it
(
'should be disabled on the final page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.next-page-link'
)).
toHaveClass
(
'is-disabled'
);
expect
(
pagingHeader
.
$
(
'.next-page-link'
)).
toHaveClass
(
'is-disabled'
);
});
});
...
@@ -264,7 +256,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -264,7 +256,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'does not move back if a server error occurs'
,
function
()
{
it
(
'does not move back if a server error occurs'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingHeader
.
$
(
'.previous-page-link'
).
click
();
pagingHeader
.
$
(
'.previous-page-link'
).
click
();
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
...
@@ -273,23 +265,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -273,23 +265,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'can go back a page'
,
function
()
{
it
(
'can go back a page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingHeader
.
$
(
'.previous-page-link'
).
click
();
pagingHeader
.
$
(
'.previous-page-link'
).
click
();
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
});
});
it
(
'should be disabled on the first page'
,
function
()
{
it
(
'should be disabled on the first page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.previous-page-link'
)).
toHaveClass
(
'is-disabled'
);
expect
(
pagingHeader
.
$
(
'.previous-page-link'
)).
toHaveClass
(
'is-disabled'
);
});
});
it
(
'should be enabled on the second page'
,
function
()
{
it
(
'should be enabled on the second page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.previous-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
expect
(
pagingHeader
.
$
(
'.previous-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
});
});
...
@@ -306,7 +298,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -306,7 +298,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
var
requests
=
AjaxHelpers
.
requests
(
this
),
var
requests
=
AjaxHelpers
.
requests
(
this
),
message
;
message
;
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
message
=
pagingHeader
.
$
(
'.meta'
).
html
().
trim
();
message
=
pagingHeader
.
$
(
'.meta'
).
html
().
trim
();
expect
(
message
).
toBe
(
'<p>Showing <span class="count-current-shown">1-3</span>'
+
expect
(
message
).
toBe
(
'<p>Showing <span class="count-current-shown">1-3</span>'
+
' out of <span class="count-total">4 total</span>, '
+
' out of <span class="count-total">4 total</span>, '
+
...
@@ -318,7 +310,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -318,7 +310,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
message
;
message
;
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
pagingView
.
toggleSortOrder
(
'name-col'
);
pagingView
.
toggleSortOrder
(
'name-col'
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
message
=
pagingHeader
.
$
(
'.meta'
).
html
().
trim
();
message
=
pagingHeader
.
$
(
'.meta'
).
html
().
trim
();
expect
(
message
).
toBe
(
'<p>Showing <span class="count-current-shown">1-3</span>'
+
expect
(
message
).
toBe
(
'<p>Showing <span class="count-current-shown">1-3</span>'
+
' out of <span class="count-total">4 total</span>, '
+
' out of <span class="count-total">4 total</span>, '
+
...
@@ -326,18 +318,18 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -326,18 +318,18 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
});
});
});
});
describe
(
"
Asset
count label"
,
function
()
{
describe
(
"
Item
count label"
,
function
()
{
it
(
'should show correct count on first page'
,
function
()
{
it
(
'should show correct count on first page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.count-current-shown'
)).
toHaveHtml
(
'1-3'
);
expect
(
pagingHeader
.
$
(
'.count-current-shown'
)).
toHaveHtml
(
'1-3'
);
});
});
it
(
'should show correct count on second page'
,
function
()
{
it
(
'should show correct count on second page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.count-current-shown'
)).
toHaveHtml
(
'4-4'
);
expect
(
pagingHeader
.
$
(
'.count-current-shown'
)).
toHaveHtml
(
'4-4'
);
});
});
...
@@ -349,18 +341,18 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -349,18 +341,18 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
});
});
});
});
describe
(
"
Asset
total label"
,
function
()
{
describe
(
"
Item
total label"
,
function
()
{
it
(
'should show correct total on the first page'
,
function
()
{
it
(
'should show correct total on the first page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.count-total'
)).
toHaveText
(
'4 total'
);
expect
(
pagingHeader
.
$
(
'.count-total'
)).
toHaveText
(
'4 total'
);
});
});
it
(
'should show correct total on the second page'
,
function
()
{
it
(
'should show correct total on the second page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.count-total'
)).
toHaveText
(
'4 total'
);
expect
(
pagingHeader
.
$
(
'.count-total'
)).
toHaveText
(
'4 total'
);
});
});
...
@@ -376,14 +368,14 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -376,14 +368,14 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'should show correct initial sort order'
,
function
()
{
it
(
'should show correct initial sort order'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.sort-order'
)).
toHaveText
(
'Date'
);
expect
(
pagingHeader
.
$
(
'.sort-order'
)).
toHaveText
(
'Date'
);
});
});
it
(
'should show updated sort order'
,
function
()
{
it
(
'should show updated sort order'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
toggleSortOrder
(
'name-col'
);
pagingView
.
toggleSortOrder
(
'name-col'
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingHeader
.
$
(
'.sort-order'
)).
toHaveText
(
'Name'
);
expect
(
pagingHeader
.
$
(
'.sort-order'
)).
toHaveText
(
'Name'
);
});
});
});
});
...
@@ -406,7 +398,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -406,7 +398,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'does not move forward if a server error occurs'
,
function
()
{
it
(
'does not move forward if a server error occurs'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.next-page-link'
).
click
();
pagingFooter
.
$
(
'.next-page-link'
).
click
();
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
...
@@ -415,23 +407,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -415,23 +407,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'can move to the next page'
,
function
()
{
it
(
'can move to the next page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.next-page-link'
).
click
();
pagingFooter
.
$
(
'.next-page-link'
).
click
();
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
});
});
it
(
'should be enabled when there is at least one more page'
,
function
()
{
it
(
'should be enabled when there is at least one more page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.next-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
expect
(
pagingFooter
.
$
(
'.next-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
});
});
it
(
'should be disabled on the final page'
,
function
()
{
it
(
'should be disabled on the final page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.next-page-link'
)).
toHaveClass
(
'is-disabled'
);
expect
(
pagingFooter
.
$
(
'.next-page-link'
)).
toHaveClass
(
'is-disabled'
);
});
});
...
@@ -453,7 +445,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -453,7 +445,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'does not move back if a server error occurs'
,
function
()
{
it
(
'does not move back if a server error occurs'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.previous-page-link'
).
click
();
pagingFooter
.
$
(
'.previous-page-link'
).
click
();
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
1
);
...
@@ -462,23 +454,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -462,23 +454,23 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'can go back a page'
,
function
()
{
it
(
'can go back a page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.previous-page-link'
).
click
();
pagingFooter
.
$
(
'.previous-page-link'
).
click
();
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
});
});
it
(
'should be disabled on the first page'
,
function
()
{
it
(
'should be disabled on the first page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.previous-page-link'
)).
toHaveClass
(
'is-disabled'
);
expect
(
pagingFooter
.
$
(
'.previous-page-link'
)).
toHaveClass
(
'is-disabled'
);
});
});
it
(
'should be enabled on the second page'
,
function
()
{
it
(
'should be enabled on the second page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.previous-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
expect
(
pagingFooter
.
$
(
'.previous-page-link'
)).
not
.
toHaveClass
(
'is-disabled'
);
});
});
...
@@ -494,14 +486,14 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -494,14 +486,14 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'should show 1 on the first page'
,
function
()
{
it
(
'should show 1 on the first page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.current-page'
)).
toHaveText
(
'1'
);
expect
(
pagingFooter
.
$
(
'.current-page'
)).
toHaveText
(
'1'
);
});
});
it
(
'should show 2 on the second page'
,
function
()
{
it
(
'should show 2 on the second page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
1
);
pagingView
.
setPage
(
1
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.current-page'
)).
toHaveText
(
'2'
);
expect
(
pagingFooter
.
$
(
'.current-page'
)).
toHaveText
(
'2'
);
});
});
...
@@ -517,11 +509,11 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -517,11 +509,11 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'should show the correct value with more than one page'
,
function
()
{
it
(
'should show the correct value with more than one page'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.total-pages'
)).
toHaveText
(
'2'
);
expect
(
pagingFooter
.
$
(
'.total-pages'
)).
toHaveText
(
'2'
);
});
});
it
(
'should show page 1 when there are no
asset
s'
,
function
()
{
it
(
'should show page 1 when there are no
pageable item
s'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
AjaxHelpers
.
respondWithJson
(
requests
,
mockEmptyPage
);
AjaxHelpers
.
respondWithJson
(
requests
,
mockEmptyPage
);
...
@@ -539,14 +531,14 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -539,14 +531,14 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'should initially have a blank page input'
,
function
()
{
it
(
'should initially have a blank page input'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
expect
(
pagingFooter
.
$
(
'.page-number-input'
)).
toHaveValue
(
''
);
expect
(
pagingFooter
.
$
(
'.page-number-input'
)).
toHaveValue
(
''
);
});
});
it
(
'should handle invalid page requests'
,
function
()
{
it
(
'should handle invalid page requests'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.page-number-input'
).
val
(
'abc'
);
pagingFooter
.
$
(
'.page-number-input'
).
val
(
'abc'
);
pagingFooter
.
$
(
'.page-number-input'
).
trigger
(
'change'
);
pagingFooter
.
$
(
'.page-number-input'
).
trigger
(
'change'
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
expect
(
pagingView
.
collection
.
currentPage
).
toBe
(
0
);
...
@@ -556,7 +548,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -556,7 +548,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'should switch pages via the input field'
,
function
()
{
it
(
'should switch pages via the input field'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.page-number-input'
).
val
(
'2'
);
pagingFooter
.
$
(
'.page-number-input'
).
val
(
'2'
);
pagingFooter
.
$
(
'.page-number-input'
).
trigger
(
'change'
);
pagingFooter
.
$
(
'.page-number-input'
).
trigger
(
'change'
);
AjaxHelpers
.
respondWithJson
(
requests
,
mockSecondPage
);
AjaxHelpers
.
respondWithJson
(
requests
,
mockSecondPage
);
...
@@ -567,7 +559,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
...
@@ -567,7 +559,7 @@ define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI",
it
(
'should handle AJAX failures when switching pages via the input field'
,
function
()
{
it
(
'should handle AJAX failures when switching pages via the input field'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
pagingView
.
setPage
(
0
);
pagingView
.
setPage
(
0
);
respondWithMock
Asset
s
(
requests
);
respondWithMock
Item
s
(
requests
);
pagingFooter
.
$
(
'.page-number-input'
).
val
(
'2'
);
pagingFooter
.
$
(
'.page-number-input'
).
val
(
'2'
);
pagingFooter
.
$
(
'.page-number-input'
).
trigger
(
'change'
);
pagingFooter
.
$
(
'.page-number-input'
).
trigger
(
'change'
);
requests
[
1
].
respond
(
500
);
requests
[
1
].
respond
(
500
);
...
...
common/static/js/spec/main_requirejs.js
0 → 100644
View file @
5fbad148
(
function
(
requirejs
,
define
)
{
requirejs
.
config
({
paths
:
{
'gettext'
:
'js/test/i18n'
,
'jquery'
:
'js/vendor/jquery.min'
,
'jquery.ui'
:
'js/vendor/jquery-ui.min'
,
'jquery.flot'
:
'js/vendor/flot/jquery.flot.min'
,
'jquery.form'
:
'js/vendor/jquery.form'
,
'jquery.markitup'
:
'js/vendor/markitup/jquery.markitup'
,
'jquery.leanModal'
:
'js/vendor/jquery.leanModal.min'
,
'jquery.ajaxQueue'
:
'js/vendor/jquery.ajaxQueue'
,
'jquery.smoothScroll'
:
'js/vendor/jquery.smooth-scroll.min'
,
'jquery.scrollTo'
:
'js/vendor/jquery.scrollTo-1.4.2-min'
,
'jquery.timepicker'
:
'js/vendor/timepicker/jquery.timepicker'
,
'jquery.cookie'
:
'js/vendor/jquery.cookie'
,
'jquery.qtip'
:
'js/vendor/jquery.qtip.min'
,
'jquery.fileupload'
:
'js/vendor/jQuery-File-Upload/js/jquery.fileupload'
,
'jquery.iframe-transport'
:
'js/vendor/jQuery-File-Upload/js/jquery.iframe-transport'
,
'jquery.inputnumber'
:
'js/vendor/html5-input-polyfills/number-polyfill'
,
'jquery.immediateDescendents'
:
'coffee/src/jquery.immediateDescendents'
,
'jquery.simulate'
:
'js/vendor/jquery.simulate'
,
'jquery.url'
:
'js/vendor/url.min'
,
'sinon'
:
'js/vendor/sinon-1.7.1'
,
'text'
:
'js/vendor/requirejs/text'
,
'underscore'
:
'js/vendor/underscore-min'
,
'underscore.string'
:
'js/vendor/underscore.string.min'
,
'backbone'
:
'js/vendor/backbone-min'
,
'backbone.associations'
:
'js/vendor/backbone-associations-min'
,
'backbone.paginator'
:
'js/vendor/backbone.paginator.min'
,
"backbone-super"
:
"js/vendor/backbone-super"
,
'jasmine-jquery'
:
'js/vendor/jasmine-jquery'
,
'jasmine-imagediff'
:
'js/vendor/jasmine-imagediff'
,
'jasmine-stealth'
:
'js/vendor/jasmine-stealth'
,
'jasmine.async'
:
'js/vendor/jasmine.async'
,
'URI'
:
'js/vendor/URI.min'
},
shim
:
{
'gettext'
:
{
exports
:
'gettext'
},
'jquery.ui'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.ui'
},
'jquery.flot'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.flot'
},
'jquery.form'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.ajaxForm'
},
'jquery.markitup'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.markitup'
},
'jquery.leanModal'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.leanModal'
},
'jquery.smoothScroll'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.smoothScroll'
},
'jquery.ajaxQueue'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.ajaxQueue'
},
'jquery.scrollTo'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.scrollTo'
},
'jquery.cookie'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.cookie'
},
'jquery.qtip'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.qtip'
},
'jquery.fileupload'
:
{
deps
:
[
'jquery.iframe-transport'
],
exports
:
'jQuery.fn.fileupload'
},
'jquery.inputnumber'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.inputNumber'
},
'jquery.simulate'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.simulate'
},
'jquery.url'
:
{
deps
:
[
'jquery'
],
exports
:
'jQuery.fn.url'
},
'datepair'
:
{
deps
:
[
'jquery.ui'
,
'jquery.timepicker'
]
},
'underscore'
:
{
deps
:
[
'underscore.string'
],
exports
:
'_'
,
init
:
function
(
UnderscoreString
)
{
/* Mix non-conflicting functions from underscore.string
* (all but include, contains, and reverse) into the
* Underscore namespace. This allows the login, register,
* and password reset templates to render independent of the
* access view.
*/
_
.
mixin
(
UnderscoreString
.
exports
());
/* Since the access view is not using RequireJS, we also
* expose underscore.string at _.str, so that the access
* view can perform the mixin on its own.
*/
_
.
str
=
UnderscoreString
;
}
},
'backbone'
:
{
deps
:
[
'underscore'
,
'jquery'
],
exports
:
'Backbone'
},
'backbone.associations'
:
{
deps
:
[
'backbone'
],
exports
:
'Backbone.Associations'
},
'backbone.paginator'
:
{
deps
:
[
'backbone'
],
exports
:
'Backbone.Paginator'
},
"backbone-super"
:
{
deps
:
[
"backbone"
]
},
'URI'
:
{
exports
:
'URI'
},
'jasmine-jquery'
:
{
deps
:
[
'jasmine'
]
},
'jasmine-imagediff'
:
{
deps
:
[
'jasmine'
]
},
'jasmine-stealth'
:
{
deps
:
[
'jasmine'
]
},
'jasmine.async'
:
{
deps
:
[
'jasmine'
],
exports
:
'AsyncSpec'
},
"sinon"
:
{
exports
:
"sinon"
}
}
});
define
([
// Run the common tests that use RequireJS.
'common-requirejs/include/common/js/spec/components/paging_spec.js'
]);
}).
call
(
this
,
requirejs
,
define
);
common/static/js_test_requirejs.yml
0 → 100644
View file @
5fbad148
---
# Common JavaScript tests, using RequireJS.
#
#
# To run all the tests and print results to the console:
#
# js-test-tool run TEST_SUITE --use-firefox
#
# where `TEST_SUITE` is this file.
#
#
# To run the tests in your default browser ("dev mode"):
#
# js-test-tool dev TEST_SUITE
#
test_suite_name
:
common-requirejs
test_runner
:
jasmine_requirejs
# Path prepended to source files in the coverage report (optional)
# For example, if the source path
# is "src/source.js" (relative to this YAML file)
# and the prepend path is "base/dir"
# then the coverage report will show
# "base/dir/src/source.js"
prepend_path
:
common/static
# Paths to library JavaScript files (optional)
lib_paths
:
-
js/vendor/jquery.min.js
-
js/vendor/jasmine-jquery.js
-
js/vendor/jasmine-imagediff.js
-
js/vendor/jquery.truncate.js
-
js/vendor/underscore-min.js
-
js/vendor/underscore.string.min.js
-
js/vendor/backbone-min.js
-
js/vendor/backbone.paginator.min.js
-
js/vendor/jquery.timeago.js
-
js/vendor/URI.min.js
-
coffee/src/ajax_prefix.js
-
js/test/add_ajax_prefix.js
-
js/test/i18n.js
-
coffee/src/jquery.immediateDescendents.js
-
js/vendor/requirejs/text.js
-
js/vendor/sinon-1.7.1.js
# Paths to source JavaScript files
src_paths
:
-
common/js
# Paths to spec (test) JavaScript files
spec_paths
:
-
common/js/spec
-
js/spec/main_requirejs.js
# Paths to fixture files (optional)
# The fixture path will be set automatically when using jasmine-jquery.
# (https://github.com/velesin/jasmine-jquery)
#
# You can then access fixtures using paths relative to
# the test suite description:
#
# loadFixtures('path/to/fixture/fixture.html');
#
fixture_paths
:
-
common/templates
requirejs
:
paths
:
main
:
js/spec/main_requirejs
# Because require.js is responsible for loading all dependencies, we exclude
# all files from being included in <script> tags
exclude_from_page
:
-
.*
pavelib/utils/envs.py
View file @
5fbad148
...
@@ -109,6 +109,7 @@ class Env(object):
...
@@ -109,6 +109,7 @@ class Env(object):
REPO_ROOT
/
'cms/static/js_test_squire.yml'
,
REPO_ROOT
/
'cms/static/js_test_squire.yml'
,
REPO_ROOT
/
'common/lib/xmodule/xmodule/js/js_test.yml'
,
REPO_ROOT
/
'common/lib/xmodule/xmodule/js/js_test.yml'
,
REPO_ROOT
/
'common/static/js_test.yml'
,
REPO_ROOT
/
'common/static/js_test.yml'
,
REPO_ROOT
/
'common/static/js_test_requirejs.yml'
,
]
]
JS_TEST_ID_KEYS
=
[
JS_TEST_ID_KEYS
=
[
...
@@ -118,6 +119,7 @@ class Env(object):
...
@@ -118,6 +119,7 @@ class Env(object):
'cms-squire'
,
'cms-squire'
,
'xmodule'
,
'xmodule'
,
'common'
,
'common'
,
'common-requirejs'
]
]
JS_REPORT_DIR
=
REPORT_DIR
/
'javascript'
JS_REPORT_DIR
=
REPORT_DIR
/
'javascript'
...
...
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