Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
solr-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9a076165
authored
2016-06-15 17:48:08 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Remove unused hasNextJumpPage and hasPreviousJumpPage options.
1 parent
7721aa02
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
23 deletions
src/scripts/solr/model/Pagination.js
src/scripts/solr/model/Pagination.spec.js
src/scripts/solr/model/Pagination.js
View file @
9a07616
...
...
@@ -8,9 +8,9 @@ define(function(require) {
return
{
currentPage
:
1
,
hasNext
:
false
,
hasNextJump
Page
:
false
,
hasNextJump
:
false
,
hasPrevious
:
false
,
hasPreviousJump
Page
:
false
,
hasPreviousJump
:
false
,
nextJumpPage
:
undefined
,
nextPage
:
undefined
,
pages
:
[],
...
...
src/scripts/solr/model/Pagination.spec.js
View file @
9a07616
...
...
@@ -17,23 +17,19 @@ define(function(require) {
describe
(
'singleton'
,
function
()
{
var
p
;
function
checkHas
(
hasNext
,
hasNextJump
,
has
NextJumpPage
,
hasPrevious
,
hasPreviousJump
,
hasPreviousJumpPage
)
{
function
checkHas
(
hasNext
,
hasNextJump
,
has
Previous
,
hasPreviousJump
)
{
var
wanted
=
{
hasNext
:
hasNext
,
hasNextJump
:
hasNextJump
,
hasNextJumpPage
:
hasNextJumpPage
,
hasPrevious
:
hasPrevious
,
hasPreviousJump
:
hasPreviousJump
,
hasPreviousJumpPage
:
hasPreviousJumpPage
,
};
it
(
'has'
,
function
()
{
var
got
=
{
hasNext
:
p
.
get
(
'hasNext'
),
hasNextJump
:
p
.
get
(
'hasNextJump'
),
hasNextJumpPage
:
p
.
get
(
'hasNextJumpPage'
),
hasPrevious
:
p
.
get
(
'hasPrevious'
),
hasPreviousJump
:
p
.
get
(
'hasPreviousJump'
),
hasPreviousJumpPage
:
p
.
get
(
'hasPreviousJumpPage'
),
};
expect
(
got
).
toEqual
(
wanted
);
});
...
...
@@ -63,7 +59,7 @@ define(function(require) {
p
=
new
Pagination
();
});
describe
(
'default settings'
,
function
()
{
checkHas
(
false
,
undefined
,
false
,
false
,
undefined
,
false
);
checkHas
(
false
,
undefined
,
false
,
undefined
);
checkPages
(
0
,
0
,
1
);
});
describe
(
'35 items'
,
function
()
{
...
...
@@ -71,7 +67,7 @@ define(function(require) {
p
.
set
({
totalCount
:
35
});
});
describe
(
'initial settings'
,
function
()
{
checkHas
(
true
,
false
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
false
,
false
,
false
);
checkPages
(
4
,
0
,
1
);
});
describe
(
'clamping'
,
function
()
{
...
...
@@ -79,14 +75,14 @@ define(function(require) {
beforeEach
(
function
()
{
p
.
set
({
currentPage
:
5
});
});
checkHas
(
false
,
false
,
false
,
true
,
fals
e
,
false
);
checkHas
(
false
,
false
,
tru
e
,
false
);
checkPages
(
4
,
0
,
4
);
});
describe
(
'set currentPage=-1'
,
function
()
{
beforeEach
(
function
()
{
p
.
set
({
currentPage
:
-
1
});
});
checkHas
(
true
,
false
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
false
,
false
,
false
);
checkPages
(
4
,
0
,
1
);
});
});
...
...
@@ -99,7 +95,7 @@ define(function(require) {
beforeEach
(
function
()
{
p
.
previous
();
});
checkHas
(
true
,
false
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
false
,
false
,
false
);
checkPages
(
4
,
0
,
1
);
});
describe
(
'next[2]'
,
function
()
{
...
...
@@ -107,40 +103,40 @@ define(function(require) {
p
.
next
();
p
.
next
();
});
checkHas
(
false
,
false
,
false
,
true
,
fals
e
,
false
);
checkHas
(
false
,
false
,
tru
e
,
false
);
checkPages
(
4
,
0
,
4
);
describe
(
'next[1] - clamp'
,
function
()
{
beforeEach
(
function
()
{
p
.
next
();
});
checkHas
(
false
,
false
,
false
,
true
,
fals
e
,
false
);
checkHas
(
false
,
false
,
tru
e
,
false
);
checkPages
(
4
,
0
,
4
);
});
describe
(
'page[0].jump'
,
function
()
{
beforeEach
(
function
()
{
p
.
get
(
'pages'
)[
0
].
jump
();
});
checkHas
(
true
,
false
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
false
,
false
,
false
);
checkPages
(
4
,
0
,
1
);
});
describe
(
'page[3].jump'
,
function
()
{
beforeEach
(
function
()
{
p
.
get
(
'pages'
)[
3
].
jump
();
});
checkHas
(
false
,
false
,
false
,
true
,
fals
e
,
false
);
checkHas
(
false
,
false
,
tru
e
,
false
);
checkPages
(
4
,
0
,
4
);
});
describe
(
'decrease to 25 items'
,
function
()
{
beforeEach
(
function
()
{
p
.
set
({
totalCount
:
25
});
});
checkHas
(
false
,
false
,
false
,
true
,
fals
e
,
false
);
checkHas
(
false
,
false
,
tru
e
,
false
);
checkPages
(
3
,
0
,
3
);
describe
(
'increase to 150 items'
,
function
()
{
beforeEach
(
function
()
{
p
.
set
({
totalCount
:
150
});
});
checkHas
(
true
,
true
,
false
,
true
,
fals
e
,
false
);
checkHas
(
true
,
true
,
tru
e
,
false
);
checkPages
(
9
,
0
,
3
);
});
});
...
...
@@ -150,7 +146,7 @@ define(function(require) {
beforeEach
(
function
()
{
p
.
previous
();
});
checkHas
(
true
,
false
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
false
,
false
,
false
);
checkPages
(
4
,
0
,
1
);
});
});
...
...
@@ -158,19 +154,19 @@ define(function(require) {
beforeEach
(
function
()
{
p
.
set
({
totalCount
:
150
});
});
checkHas
(
true
,
true
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
true
,
false
,
false
);
checkPages
(
9
,
0
,
1
);
describe
(
'page[7].jump'
,
function
()
{
beforeEach
(
function
()
{
p
.
get
(
'pages'
)[
7
].
jump
();
});
checkHas
(
true
,
true
,
false
,
true
,
true
,
fals
e
);
checkHas
(
true
,
true
,
true
,
tru
e
);
checkPages
(
9
,
3
,
5
);
describe
(
'previousJump'
,
function
()
{
beforeEach
(
function
()
{
p
.
previousJump
();
});
checkHas
(
true
,
true
,
false
,
true
,
fals
e
,
false
);
checkHas
(
true
,
true
,
tru
e
,
false
);
checkPages
(
9
,
0
,
3
);
});
});
...
...
@@ -180,7 +176,7 @@ define(function(require) {
p
.
set
({
pageJump
:
false
});
p
.
set
({
totalCount
:
150
});
});
checkHas
(
true
,
false
,
false
,
false
,
false
,
false
);
checkHas
(
true
,
false
,
false
,
false
);
checkPages
(
9
,
0
,
1
);
});
});
...
...
Please
register
or
sign in
to post a comment