summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-03-21 10:09:24 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-03-21 13:36:50 +0100
commit35550fe42e36868be1a3ac471bea6dc89b8b6200 (patch)
treec18c147f6f59202baee0bfe2c45bf30d83c2bbba /js/tests
parentc0e6ca12e83e27b2ef86a58f9a44c0248e711a75 (diff)
fix autopaging in search
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/controller/ContentControllerSpec.js10
-rw-r--r--js/tests/unit/service/ItemResourceSpec.js29
2 files changed, 38 insertions, 1 deletions
diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js
index e413df672..5004c3ec2 100644
--- a/js/tests/unit/controller/ContentControllerSpec.js
+++ b/js/tests/unit/controller/ContentControllerSpec.js
@@ -322,6 +322,12 @@ describe('ContentController', function () {
SettingsResource.set('oldestFirst', true);
SettingsResource.set('showAll', false);
+ var $location = {
+ search: jasmine.createSpy('search').and.returnValue({
+ search: 'some+string'
+ })
+ };
+
var $route = {
current: {
$$route: {
@@ -363,6 +369,7 @@ describe('ContentController', function () {
ItemResource: ItemResource,
SettingsResource: SettingsResource,
data: {'items': [{id: 3}, {id: 4}]},
+ $location: $location
});
expect(ctrl.autoPagingEnabled()).toBe(true);
@@ -372,7 +379,8 @@ describe('ContentController', function () {
expect(ctrl.autoPagingEnabled()).toBe(false);
expect(Loading.isLoading('autopaging')).toBe(false);
- expect(ItemResource.autoPage).toHaveBeenCalledWith(3, 2, true, false);
+ expect(ItemResource.autoPage).toHaveBeenCalledWith(3, 2, true, false,
+ 'some+string');
}));
diff --git a/js/tests/unit/service/ItemResourceSpec.js b/js/tests/unit/service/ItemResourceSpec.js
index a3228f7a4..397ba0841 100644
--- a/js/tests/unit/service/ItemResourceSpec.js
+++ b/js/tests/unit/service/ItemResourceSpec.js
@@ -267,6 +267,35 @@ describe('ItemResource', function () {
}));
+ it ('should auto page all', inject(function (ItemResource) {
+ http.expectGET(
+ 'base/items?id=4&limit=5&offset=5&oldestFirst=true' +
+ '&search=some+string&showAll=true&type=3')
+ .respond(200, {});
+
+ ItemResource.receive([
+ {
+ id: 3,
+ feedId: 4,
+ unread: true
+ },
+ {
+ id: 5,
+ feedId: 3,
+ unread: true
+ },
+ {
+ id: 4,
+ feedId: 4,
+ unread: true
+ }
+ ], 'items');
+
+ ItemResource.autoPage(3, 4, true, true, 'some string');
+
+ http.flush();
+ }));
+
it ('should clear all state', inject(function (ItemResource) {
ItemResource.receive([