зеркало из https://github.com/nextcloud/news.git
add unittest for feedcontroller, fix #51, dont activate add button if input does not contain characters
This commit is contained in:
Родитель
6c7883d284
Коммит
ac5c8f5f4f
|
@ -68,7 +68,6 @@ ActiveFeed, FeedType, $window) ->
|
|||
return @_isAddingFeed
|
||||
|
||||
@_$scope.addFeed = (feedUrl, parentFolderId=0) =>
|
||||
@_$scope.feedEmptyError = false
|
||||
@_$scope.feedExistsError = false
|
||||
|
||||
try
|
||||
|
@ -89,13 +88,10 @@ ActiveFeed, FeedType, $window) ->
|
|||
catch error
|
||||
if error instanceof _ExistsError
|
||||
@_$scope.feedExistsError = true
|
||||
else
|
||||
@_$scope.feedEmptyError = true
|
||||
@_isAddingFeed = false
|
||||
|
||||
|
||||
@_$scope.addFolder = (folderName) =>
|
||||
@_$scope.folderEmptyError = false
|
||||
@_$scope.folderExistsError = false
|
||||
|
||||
try
|
||||
|
@ -116,10 +112,7 @@ ActiveFeed, FeedType, $window) ->
|
|||
catch error
|
||||
if error instanceof _ExistsError
|
||||
@_$scope.folderExistsError = true
|
||||
else
|
||||
@_$scope.folderEmptyError = true
|
||||
@_isAddingFolder = false
|
||||
@_$scope.addNewFolder = true
|
||||
|
||||
|
||||
@_$scope.$on 'moveFeedToFolder', (scope, data) =>
|
||||
|
|
|
@ -362,7 +362,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
if (parentFolderId == null) {
|
||||
parentFolderId = 0;
|
||||
}
|
||||
_this._$scope.feedEmptyError = false;
|
||||
_this._$scope.feedExistsError = false;
|
||||
try {
|
||||
_this._isAddingFeed = true;
|
||||
|
@ -380,8 +379,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
error = _error;
|
||||
if (error instanceof _ExistsError) {
|
||||
_this._$scope.feedExistsError = true;
|
||||
} else {
|
||||
_this._$scope.feedEmptyError = true;
|
||||
}
|
||||
return _this._isAddingFeed = false;
|
||||
}
|
||||
|
@ -389,7 +386,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
this._$scope.addFolder = function(folderName) {
|
||||
var error;
|
||||
|
||||
_this._$scope.folderEmptyError = false;
|
||||
_this._$scope.folderExistsError = false;
|
||||
try {
|
||||
_this._isAddingFolder = true;
|
||||
|
@ -408,11 +404,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
error = _error;
|
||||
if (error instanceof _ExistsError) {
|
||||
_this._$scope.folderExistsError = true;
|
||||
} else {
|
||||
_this._$scope.folderEmptyError = true;
|
||||
}
|
||||
_this._isAddingFolder = false;
|
||||
return _this._$scope.addNewFolder = true;
|
||||
return _this._isAddingFolder = false;
|
||||
}
|
||||
};
|
||||
this._$scope.$on('moveFeedToFolder', function(scope, data) {
|
||||
|
|
|
@ -1,123 +1,150 @@
|
|||
<?xml version="1.0"?>
|
||||
<testsuites>
|
||||
<testsuite name="PhantomJS 1.9 (Linux)" package="undefined" timestamp="2013-04-18T14:48:48" id="0" hostname="archtop" tests="175" errors="0" failures="0" time="0.409">
|
||||
<testsuite name="PhantomJS 1.9 (Linux)" package="undefined" timestamp="2013-04-22T10:25:28" id="0" hostname="archtop" tests="204" errors="0" failures="0" time="0.484">
|
||||
<properties>
|
||||
<property name="browser.fullName" value="Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.0 Safari/534.34"/>
|
||||
</properties>
|
||||
<testcase name="isAddingFolder should return false in the beginning" time="0.023" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="isAddingFeed should return false in the beginning" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make unreadCountFormatter available" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make unreadCountFormatter available" time="0.008" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make FeedBusinessLayer available" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make FolderBusinessLayer available" time="0.008" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make FolderBusinessLayer available" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make SubscriptionsBusinessLayer available" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make StarredBusinessLayer available" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should not add folders that have no name" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make ItemBusinessLayer availabe" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should make FeedBusinessLayer availabe" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should set the window title to the total unread count" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should show 999+ if in window title when more than 999 unread count" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should move a feed if moveFeedToFolder is broadcasted" time="0.004" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should set isAddingFolder to true if there were no problems" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should set isAddingFolder to false after a failed request" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should show an error if the folder exists and reset the input" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should reset the add folder form and set the created as selected" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should set isAddingFeed to true if there were no problems" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should set isAddingFeed to false after a failed request" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should show an error if the feed exists and reset the input" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should open the parent folder of the added feed" time="0.002" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should reset the add feed form and load the added feed" time="0.003" classname="PhantomJS 1.9 (Linux).FeedController"/>
|
||||
<testcase name="should make ItemBusinessLayer availabe" time="0.003" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should make FeedBusinessLayer availabe" time="0.01" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should make feedloading available" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should make autopagin available" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should return the feedtitle" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should return no value if feedtitle is not found" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should return no value if relative date gets no value" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should set an item read on readItem broadcast" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should not autopage if there are no items" time="0.004" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should autoPage with the lowest Item Id" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should not prevent autopaging if there are no items" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should not send multiple autopage requests at once" time="0.003" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should allow another autopaging request if the last one finished" time="0.002" classname="PhantomJS 1.9 (Linux).ItemController"/>
|
||||
<testcase name="should make FeedBl available" time="0.002" classname="PhantomJS 1.9 (Linux).SettingsController"/>
|
||||
<testcase name="should show an error if the xml import failed" time="0.003" classname="PhantomJS 1.9 (Linux).SettingsController"/>
|
||||
<testcase name="should set showall to true if importing" time="0.002" classname="PhantomJS 1.9 (Linux).SettingsController"/>
|
||||
<testcase name="should set showall to true if importing json" time="0.002" classname="PhantomJS 1.9 (Linux).SettingsController"/>
|
||||
<testcase name="should show an error if the json import failed" time="0.002" classname="PhantomJS 1.9 (Linux).SettingsController"/>
|
||||
<testcase name="should import json" time="0.002" classname="PhantomJS 1.9 (Linux).SettingsController"/>
|
||||
<testcase name="should be Subscriptions by default" time="0.001" classname="PhantomJS 1.9 (Linux).ActiveFeed"/>
|
||||
<testcase name="should set the correct feed id" time="0.001" classname="PhantomJS 1.9 (Linux).ActiveFeed"/>
|
||||
<testcase name="should set the correct feed type" time="0.001" classname="PhantomJS 1.9 (Linux).ActiveFeed"/>
|
||||
<testcase name="should reset the item cache when a different feed is being loaded" time="0.002" classname="PhantomJS 1.9 (Linux).BusinessLayer"/>
|
||||
<testcase name="should send a get all items query when feed changed" time="0.003" classname="PhantomJS 1.9 (Linux).BusinessLayer"/>
|
||||
<testcase name="should send a get all items query when feed changed" time="0.002" classname="PhantomJS 1.9 (Linux).BusinessLayer"/>
|
||||
<testcase name="should be active when its selected" time="0.001" classname="PhantomJS 1.9 (Linux).BusinessLayer"/>
|
||||
<testcase name="should delete feeds" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return the number of unread feeds" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return the number of unread feeds" time="0.003" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return all feeds of a folder" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count for folders" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should mark feed as read" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should mark feed as read and set 0 if as highest id if its not active" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should mark all as read" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count for subscribtions" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return the correct number of feeds" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should be visible if its active" time="0.008" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return the correct number of feeds" time="0.012" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should be visible if its active" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should be visible if show all is true" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should be visible if unreadcount bigger than 0" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not move the feed to a new folder" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not move the feed to the same folder" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should set the show all setting" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should set the hide read setting" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return all feeds" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should set the show all setting" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should set the hide read setting" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return all feeds" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return if ShowAll is set" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return all feeds of a folder" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return the correct feed link" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not create a feed if it already exists" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return all feeds of a folder" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should return the correct feed link" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not create a feed if it already exists" time="0.003" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not create feeds that are empty" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should create a feed before theres a response from the server" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should set a title and an url hash to the newly crated feed" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should make a create feed request" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should set a title and an url to the newly created feed" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not add http when it already is at the start of created feed" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should make a create feed request" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should call the onSuccess function on response status ok" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should call the handle a response error when creating a folder" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should mark a feed error as read by removing it" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should update all feeds" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not update feeds without ids" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not import google reader json" time="0.001" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should not create a google reader feed if it already exists" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should create an import google reader request" time="0.002" classname="PhantomJS 1.9 (Linux).FeedBusinessLayer"/>
|
||||
<testcase name="should delete folders" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should return true when folder has feeds" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should toggle folder" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should mark folder as read" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count" time="0.001" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should be visible if show all is true" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should be visible if its active" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should be visible if one of its subfeeds is active" time="0.009" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should be visible if one of its subfeeds is active" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should be visible if showAll is false and it has unread items" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should return all folders" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should not create a folder if it already exists" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should return all folders" time="0.001" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should not create a folder if it already exists" time="0.001" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should not create folders that are empty" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should create a folder before theres a response from the server" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should make a create folder request" time="0.001" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should call the onSuccess function on response status ok" time="0.001" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should call the handle a response error when creating a folder" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should mark a folder error as read by removing it" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should make a create folder request" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should call the onSuccess function on response status ok" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should call the handle a response error when creating a folder" time="0.013" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should mark a folder error as read by removing it" time="0.003" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should return the corret folder for id" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should open a folder" time="0.002" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should not import on empty opml" time="0.006" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should import a folder" time="0.004" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should import a feed" time="0.003" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should open a folder" time="0.003" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should not import on empty opml" time="0.008" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should import a folder" time="0.008" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should import a feed" time="0.006" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should import nested folders" time="0.004" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should use an existing folder when importing a folder" time="0.003" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should use an existing folder when importing a folder" time="0.01" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should not import a feed if it already exists" time="0.004" classname="PhantomJS 1.9 (Linux).FolderBusinessLayer"/>
|
||||
<testcase name="should return all items" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should return all items" time="0.003" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should tell if no feed is active" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should return the correct feed title" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item unstarred" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item starred" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item read" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should not set an item read if its kept unread" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item unstarred" time="0.003" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item starred" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item read" time="0.003" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should not set an item read if its kept unread" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should no set an item read if its already read" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should return false when item kept unread does not exist" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should return false when item kept unread does not exist" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should return false if an item is not kept unread" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should toggle an item as kept unread" time="0.011" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should toggle an item as kept unread" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set an item as unread" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should not set an item as unread if its unread" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should not set an item as unread if its unread" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should set item as unread if kept unread is toggled and it is read" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should lower the unread count of a feed when its items get read" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should increase the unread count of a feed when its items get unread" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should load the next items" time="0.002" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should not be visible if starredCount is 0" time="0.002" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should load the next items" time="0.001" classname="PhantomJS 1.9 (Linux).ItemBusinessLayer"/>
|
||||
<testcase name="should not be visible if starredCount is 0" time="0.001" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should always be visible if its the active feed" time="0.002" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count" time="0.002" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count" time="0.001" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should increase the starred count" time="0.001" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should decrease the starred count" time="0.001" classname="PhantomJS 1.9 (Linux).StarredBusinessLayer"/>
|
||||
<testcase name="should be visible shows all items is set to true and there are feeds" time="0.003" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should not be visible if there are no feeds" time="0.002" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should not be visible if showall is false + there are no unread" time="0.002" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should be visible shows all items is set to true and there are feeds" time="0.002" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should not be visible if there are no feeds" time="0.001" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should not be visible if showall is false + there are no unread" time="0.001" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should always be visible if its the active feed" time="0.002" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should mark all feeds as read" time="0.002" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count" time="0.005" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should have the correct folder number" time="0.002" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should mark all feeds as read" time="0.001" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should get the correct unread count" time="0.002" classname="PhantomJS 1.9 (Linux).SubscriptionsBusinessLayer"/>
|
||||
<testcase name="should have the correct folder number" time="0.002" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should have the correct folder number" time="0.001" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should have the correct folder number" time="0.002" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should have the correct folder number" time="0.001" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should have the correct folder number" time="0.001" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should have the correct folder number" time="0.001" classname="PhantomJS 1.9 (Linux).FeedType"/>
|
||||
<testcase name="should be en by default" time="0.002" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should set the correct language" time="0.007" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should only set the first part of the language if not available" time="0.003" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should default to en" time="0.001" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should set the correct language" time="0.001" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should only set the first part of the language if not available" time="0.001" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should default to en" time="0.015" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should support languages" time="0.002" classname="PhantomJS 1.9 (Linux).Language"/>
|
||||
<testcase name="should extend _Model" time="0.002" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should bind an imagepath to the item if the url is empty" time="0.001" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should bind an imagepath to the item if the url is empty" time="0.002" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should add feeds without id" time="0.002" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should clear the url cache" time="0.001" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should delete items from the fodername cache" time="0.002" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
|
@ -125,55 +152,57 @@
|
|||
<testcase name="should update normally" time="0.001" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should clear invalidate the query cache on adding folder with name" time="0.002" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should only update feeds that contain only an id but no url" time="0.001" classname="PhantomJS 1.9 (Linux).FeedModel"/>
|
||||
<testcase name="should extend model" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should add folders without id but name if they dont exist yet" time="0.002" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should extend model" time="0.002" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should add folders without id but name if they dont exist yet" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should clear the fodername cache" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should delete items from the fodername cache" time="0.002" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should delete items from the fodername cache" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should update by foldername" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should update the id if an update comes in with an id" time="0.012" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should update normally" time="0.002" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should update the id if an update comes in with an id" time="0.002" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should update normally" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should clear invalidate the query cache on adding folder with name" time="0.001" classname="PhantomJS 1.9 (Linux).FolderModel"/>
|
||||
<testcase name="should extend model" time="0.002" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should also update items with the same feed id and guidhash" time="0.002" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should extend model" time="0.001" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should also update items with the same feed id and guidhash" time="0.001" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should also remove the feed from the url cache when its removed" time="0.002" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should bind the correct isRead() method to the item" time="0.001" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should bind the correct set unread method to the item" time="0.001" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should bind the correct set starred method to the item" time="0.002" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should bind the correct set unstarred method to the item" time="0.001" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should return the lowest id" time="0.002" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should return the lowest id" time="0.001" classname="PhantomJS 1.9 (Linux).ItemModel"/>
|
||||
<testcase name="should return only the root folder when parsing empty OPML" time="0.004" classname="PhantomJS 1.9 (Linux).OPMLParser"/>
|
||||
<testcase name="should parse folders" time="0.003" classname="PhantomJS 1.9 (Linux).OPMLParser"/>
|
||||
<testcase name="should parse feeds" time="0.003" classname="PhantomJS 1.9 (Linux).OPMLParser"/>
|
||||
<testcase name="should nest feeds" time="0.004" classname="PhantomJS 1.9 (Linux).OPMLParser"/>
|
||||
<testcase name="should nest feeds" time="0.003" classname="PhantomJS 1.9 (Linux).OPMLParser"/>
|
||||
<testcase name="should send a autopaging request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should send a load newest items request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct get starred items request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct star item request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct unstar item request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct star item request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct unstar item request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct read item request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct unread item request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct unread item request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should get all feeds" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should not show loading sign if disabled" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="create a correct request for moving a feed" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="shoud send a correct request for marking all items read" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct feed update request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct get active feed request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="shoud send a correct request for marking all items read" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct feed update request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct get active feed request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct feed delete request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct feed create request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper get all folders request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct feed create request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper import google reader request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper get all folders request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct collapse folder request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="send a correct open folder request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper folder create request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper folder delete request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper folder rename request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should have an export request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper get user settings read request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should have an export request" time="0.016" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper get user settings read request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper user settings read show request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper user settings read hide request" time="0.002" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper user settings language request" time="0.011" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should be false by default" time="0.002" classname="PhantomJS 1.9 (Linux).ShowAll"/>
|
||||
<testcase name="should set the correct ShowAll value" time="0.001" classname="PhantomJS 1.9 (Linux).ShowAll"/>
|
||||
<testcase name="should do a proper user settings read hide request" time="0.001" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should do a proper user settings language request" time="0.003" classname="PhantomJS 1.9 (Linux).Persistence"/>
|
||||
<testcase name="should be false by default" time="0.001" classname="PhantomJS 1.9 (Linux).ShowAll"/>
|
||||
<testcase name="should set the correct ShowAll value" time="0.002" classname="PhantomJS 1.9 (Linux).ShowAll"/>
|
||||
<testcase name="should provide a set Showall setter" time="0.001" classname="PhantomJS 1.9 (Linux).ShowAll"/>
|
||||
<testcase name="should be 0 by default" time="0.002" classname="PhantomJS 1.9 (Linux).StarredCount"/>
|
||||
<testcase name="should be 0 by default" time="0.001" classname="PhantomJS 1.9 (Linux).StarredCount"/>
|
||||
<testcase name="should set the correct StarredCount count" time="0.001" classname="PhantomJS 1.9 (Linux).StarredCount"/>
|
||||
<testcase name="should provide a setter" time="0.001" classname="PhantomJS 1.9 (Linux).StarredCount"/>
|
||||
<testcase name="should have the correct status flags" time="0.002" classname="PhantomJS 1.9 (Linux).StatusFlag"/>
|
||||
|
|
|
@ -26,17 +26,26 @@ describe 'FeedController', ->
|
|||
beforeEach module 'News'
|
||||
|
||||
beforeEach module ($provide) =>
|
||||
@imagePath = jasmine.createSpy('imagePath')
|
||||
@utils =
|
||||
imagePath: @imagePath
|
||||
$provide.value 'Utils', @utils
|
||||
|
||||
@persistence = {}
|
||||
|
||||
$provide.value 'Persistence', @persistence
|
||||
return
|
||||
|
||||
beforeEach inject ($controller, @FolderBusinessLayer, @FeedBusinessLayer,
|
||||
$rootScope, @unreadCountFormatter,
|
||||
@SubscriptionsBusinessLayer, @StarredBusinessLayer) =>
|
||||
$rootScope, @unreadCountFormatter, @FeedModel,
|
||||
@SubscriptionsBusinessLayer, @StarredBusinessLayer,
|
||||
@$window, @_ExistsError, @FolderModel, @FeedType) =>
|
||||
@scope = $rootScope.$new()
|
||||
replace =
|
||||
$scope: @scope
|
||||
|
||||
@$window.document.title = ''
|
||||
|
||||
@controller = $controller('FeedController', replace)
|
||||
|
||||
|
||||
|
@ -64,103 +73,143 @@ describe 'FeedController', ->
|
|||
expect(@scope.subscriptionsBusinessLayer).toBe(
|
||||
@SubscriptionsBusinessLayer)
|
||||
|
||||
|
||||
it 'should make StarredBusinessLayer available', =>
|
||||
expect(@scope.starredBusinessLayer).toBe(@StarredBusinessLayer)
|
||||
|
||||
it 'should not add folders that have no name', =>
|
||||
@persistence.createFolder = jasmine.createSpy('create')
|
||||
@scope.addFolder(' ')
|
||||
|
||||
expect(@scope.folderEmptyError).toBeTruthy()
|
||||
expect(@persistence.createFolder).not.toHaveBeenCalled()
|
||||
it 'should set the window title to the total unread count', =>
|
||||
expect(@$window.document.title).toBe('')
|
||||
|
||||
@scope.getTotalUnreadCount()
|
||||
expect(@$window.document.title).toBe('News | ownCloud')
|
||||
|
||||
item = {id: 3, unreadCount: 5, faviconLink: 'test', url: 'hi'}
|
||||
@FeedModel.add(item)
|
||||
@scope.getTotalUnreadCount()
|
||||
|
||||
expect(@$window.document.title).toBe('News (5) | ownCloud')
|
||||
|
||||
|
||||
xit 'should not add folders that already exist client side', =>
|
||||
@FolderModel.add({id: 3, name: 'ola'})
|
||||
it 'should show 999+ if in window title when more than 999 unread count', =>
|
||||
item = {id: 3, unreadCount: 1, faviconLink: 'test', url: 'hi'}
|
||||
item1 = {id: 5, unreadCount: 999, faviconLink: 'test', url: 'his'}
|
||||
@FeedModel.add(item)
|
||||
@FeedModel.add(item1)
|
||||
|
||||
@scope.getTotalUnreadCount()
|
||||
|
||||
expect(@$window.document.title).toBe('News (999+) | ownCloud')
|
||||
|
||||
|
||||
it 'should move a feed if moveFeedToFolder is broadcasted', =>
|
||||
item = {id: 3, unreadCount: 1, faviconLink: 'test', url: 'hi'}
|
||||
@FeedModel.add(item)
|
||||
@persistence.moveFeed = jasmine.createSpy('move feed')
|
||||
@scope.$broadcast 'moveFeedToFolder', {feedId: 3, folderId: 1}
|
||||
|
||||
expect(@persistence.moveFeed).toHaveBeenCalledWith(3, 1)
|
||||
|
||||
|
||||
it 'should set isAddingFolder to true if there were no problems', =>
|
||||
@persistence.createFolder = jasmine.createSpy('create')
|
||||
@scope.addFolder(' Ola')
|
||||
|
||||
expect(@scope.folderExistsError).toBeTruthy()
|
||||
expect(@persistence.createFolder).not.toHaveBeenCalled()
|
||||
expect(@scope.isAddingFolder()).toBe(true)
|
||||
|
||||
|
||||
xit 'should set isAddingFolder to true if there were no problems', =>
|
||||
it 'should set isAddingFolder to false after a failed request', =>
|
||||
@persistence.createFolder = jasmine.createSpy('create')
|
||||
@persistence.createFolder.andCallFake (name, id, onSuccess, onFailure) ->
|
||||
onFailure()
|
||||
|
||||
@scope.addFolder(' Ola')
|
||||
expect(@scope.isAddingFolder()).toBeTruthy()
|
||||
expect(@scope.isAddingFolder()).toBe(false)
|
||||
|
||||
|
||||
xit 'should create a create new folder request if everything was ok', =>
|
||||
it 'should show an error if the folder exists and reset the input', =>
|
||||
@FolderBusinessLayer.create = jasmine.createSpy('create')
|
||||
@FolderBusinessLayer.create.andCallFake =>
|
||||
throw new @_ExistsError('ye')
|
||||
|
||||
@scope.addFolder(' Ola')
|
||||
|
||||
expect(@scope.folderExistsError).toBe(true)
|
||||
expect(@scope.isAddingFolder()).toBe(false)
|
||||
|
||||
|
||||
it 'should reset the add folder form and set the created as selected', =>
|
||||
@persistence.createFolder = jasmine.createSpy('create')
|
||||
@scope.addFolder(' Ola')
|
||||
expect(@persistence.createFolder).toHaveBeenCalled()
|
||||
expect(@persistence.createFolder.argsForCall[0][0]).toBe('Ola')
|
||||
expect(@persistence.createFolder.argsForCall[0][1]).toBe(0)
|
||||
data =
|
||||
data:
|
||||
folders: [
|
||||
{id: 3, name: 'soba'}
|
||||
]
|
||||
status: 'success'
|
||||
@persistence.createFolder.andCallFake (id, parent, onSuccess) =>
|
||||
@FolderModel.handle(data.data.folders)
|
||||
onSuccess(data)
|
||||
|
||||
|
||||
xit 'should should reset the foldername on and set isAddingFolder to false',=>
|
||||
@persistence.createFolder =
|
||||
jasmine.createSpy('create').andCallFake (arg1, arg2, func) =>
|
||||
func()
|
||||
@scope.addFolder(' Ola')
|
||||
@scope.addFolder(' Soba')
|
||||
|
||||
expect(@scope.folderName).toBe('')
|
||||
expect(@scope.isAddingFolder()).toBeFalsy()
|
||||
expect(@scope.addNewFolder).toBeFalsy()
|
||||
expect(@scope.addNewFolder).toBe(false)
|
||||
expect(@scope.isAddingFolder()).toBe(false)
|
||||
expect(@scope.folderId.name).toBe('soba')
|
||||
|
||||
|
||||
xit 'should not add feeds that have no url', =>
|
||||
it 'should set isAddingFeed to true if there were no problems', =>
|
||||
@persistence.createFeed = jasmine.createSpy('create')
|
||||
@scope.addFeed(' ')
|
||||
|
||||
expect(@scope.feedEmptyError).toBeTruthy()
|
||||
expect(@persistence.createFeed).not.toHaveBeenCalled()
|
||||
@scope.addFeed('Ola')
|
||||
expect(@scope.isAddingFeed()).toBe(true)
|
||||
|
||||
|
||||
xit 'should set isAddingFeed to true if there were no problems', =>
|
||||
it 'should set isAddingFeed to false after a failed request', =>
|
||||
@persistence.createFeed = jasmine.createSpy('create')
|
||||
@scope.addFeed('ola')
|
||||
expect(@scope.isAddingFeed()).toBeTruthy()
|
||||
@persistence.createFeed.andCallFake (name, id, onSuccess, onFailure) ->
|
||||
onFailure()
|
||||
|
||||
@scope.addFolder(' Ola')
|
||||
expect(@scope.isAddingFeed()).toBe(false)
|
||||
|
||||
|
||||
xit 'should should reset the feedurl and set isAddingFeed to false on succ',=>
|
||||
@persistence.createFeed =
|
||||
jasmine.createSpy('create').andCallFake (arg1, arg2, func) =>
|
||||
data =
|
||||
status: 'success'
|
||||
func(data)
|
||||
it 'should show an error if the feed exists and reset the input', =>
|
||||
@FeedBusinessLayer.create = jasmine.createSpy('create')
|
||||
@FeedBusinessLayer.create.andCallFake =>
|
||||
throw new @_ExistsError('ye')
|
||||
|
||||
@scope.addFeed(' Ola')
|
||||
|
||||
expect(@scope.feedUrl).toBe('')
|
||||
expect(@scope.isAddingFeed()).toBeFalsy()
|
||||
expect(@scope.feedExistsError).toBe(true)
|
||||
expect(@scope.isAddingFeed()).toBe(false)
|
||||
|
||||
|
||||
xit 'should should set isAddingFeed to false on err',=>
|
||||
@persistence.createFeed =
|
||||
jasmine.createSpy('create').andCallFake (arg1, arg2, func, err) =>
|
||||
err()
|
||||
@scope.addFeed('Ola')
|
||||
it 'should open the parent folder of the added feed', =>
|
||||
item = {opened: false, id: 3, name: 'john'}
|
||||
@FolderModel.add(item)
|
||||
|
||||
expect(@scope.isAddingFeed()).toBeFalsy()
|
||||
expect(@scope.feedError).toBeTruthy()
|
||||
@scope.addFeed(' Ola', 3)
|
||||
|
||||
expect(item.opened).toBe(true)
|
||||
|
||||
|
||||
xit 'should should set isAddingFeed to false on serverside error',=>
|
||||
@persistence.createFeed =
|
||||
jasmine.createSpy('create').andCallFake (arg1, arg2, func) =>
|
||||
data =
|
||||
status: 'error'
|
||||
func(data)
|
||||
@scope.addFeed('Ola')
|
||||
|
||||
expect(@scope.isAddingFeed()).toBeFalsy()
|
||||
expect(@scope.feedError).toBeTruthy()
|
||||
|
||||
|
||||
xit 'should create a create new feed request if everything was ok', =>
|
||||
it 'should reset the add feed form and load the added feed', =>
|
||||
@persistence.createFeed = jasmine.createSpy('create')
|
||||
@scope.addFeed('Ola')
|
||||
expect(@persistence.createFeed).toHaveBeenCalled()
|
||||
expect(@persistence.createFeed.argsForCall[0][0]).toBe('Ola')
|
||||
expect(@persistence.createFeed.argsForCall[0][1]).toBe(0)
|
||||
@persistence.getItems = jasmine.createSpy('load')
|
||||
|
||||
data =
|
||||
data:
|
||||
feeds: [
|
||||
{id: 3, url: 'http://soba', title: 'hi'}
|
||||
]
|
||||
status: 'success'
|
||||
@persistence.createFeed.andCallFake (id, parent, onSuccess) =>
|
||||
@FeedModel.handle(data.data.feeds)
|
||||
onSuccess(data)
|
||||
|
||||
@scope.addFeed(' Soba')
|
||||
|
||||
expect(@scope.feedUrl).toBe('')
|
||||
expect(@scope.isAddingFeed()).toBe(false)
|
||||
expect(@persistence.getItems).toHaveBeenCalledWith(
|
||||
@FeedType.Feed, 3, 0
|
||||
)
|
|
@ -15,15 +15,9 @@
|
|||
<div class="add-new-popup">
|
||||
<fieldset class="personalblock">
|
||||
<p class="error">
|
||||
<span ng-show="feedEmptyError">
|
||||
<?php p($l->t('Error: address must not be empty!')); ?>
|
||||
</span>
|
||||
<span ng-show="feedExistsError">
|
||||
<?php p($l->t('Error: address exists already!')); ?>
|
||||
</span>
|
||||
<span ng-show="folderEmptyError">
|
||||
<?php p($l->t('Error: folder name must not be empty!')); ?>
|
||||
</span>
|
||||
<span ng-show="folderExistsError">
|
||||
<?php p($l->t('Error: folder exists already')); ?>
|
||||
</span>
|
||||
|
@ -38,7 +32,7 @@
|
|||
autofocus>
|
||||
<button title="<?php p($l->t('Add')); ?>"
|
||||
class="primary"
|
||||
ng-disabled="isAddingFeed() || isAddingFolder()"
|
||||
ng-disabled="isAddingFeed() || isAddingFolder() || !feedUrl.trim()"
|
||||
ng-click="addFeed(feedUrl, folderId.id)"><?php p($l->t('Add')); ?></button>
|
||||
</form>
|
||||
<form>
|
||||
|
@ -72,7 +66,7 @@
|
|||
<button title="<?php p($l->t('Create folder')); ?>"
|
||||
ng-show="addNewFolder"
|
||||
ng-click="addFolder(folderName)"
|
||||
ng-disabled="isAddingFolder()"
|
||||
ng-disabled="isAddingFolder() || !folderName.trim()"
|
||||
ng-class="{loading: isAddingFolder()}"
|
||||
class="action-button create-button action">
|
||||
</button>
|
||||
|
|
Загрузка…
Ссылка в новой задаче