diff options
author | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2015-03-30 19:40:07 +0200 |
---|---|---|
committer | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2015-03-30 19:40:07 +0200 |
commit | 05985bc2965f8a332e98121050ba1f07343bbc0f (patch) | |
tree | 96ca5d59b7ce3c9d3678dd95d8595145d1d5df08 /js/tests | |
parent | eb7fc97f33cadcf041a06915b8f1650a9b4f6bbb (diff) | |
parent | ee3d2332ec97487893ae5f1f46b599c550b25eb6 (diff) |
Merge pull request #751 from owncloud/next
Changes for 8.1
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/unit/controller/ContentControllerSpec.js | 22 | ||||
-rw-r--r-- | js/tests/unit/controller/NavigationControllerSpec.js | 15 | ||||
-rw-r--r-- | js/tests/unit/service/ItemResourceSpec.js | 29 |
3 files changed, 65 insertions, 1 deletions
diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index e413df672..dbb88bcbb 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'); })); @@ -557,4 +565,16 @@ describe('ContentController', function () { expect(ctrl.isShowAll()).toBe(true); })); + + it('should return the correct media type', inject(function ($controller) { + + var ctrl = $controller('ContentController', { + data: {}, + }); + + expect(ctrl.getMediaType('audio/test')).toBe('audio'); + expect(ctrl.getMediaType('video/test')).toBe('video'); + expect(ctrl.getMediaType('vides/test')).toBe(undefined); + })); + }); diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js index 22c510c3f..d6b016c9a 100644 --- a/js/tests/unit/controller/NavigationControllerSpec.js +++ b/js/tests/unit/controller/NavigationControllerSpec.js @@ -1038,4 +1038,19 @@ describe('NavigationController', function () { })); + it ('should set location on search', inject(function ($controller) { + var location = { + search: jasmine.createSpy('search') + }; + var ctrl = $controller('NavigationController', { + $location: location + }); + + ctrl.search(''); + expect(location.search).toHaveBeenCalledWith('search', null); + + ctrl.search('ab'); + expect(location.search).toHaveBeenCalledWith('search', 'ab'); + })); + }); 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([ |