From f2dec08b70d7550db56fc5fd467fab6ef31a1eaa Mon Sep 17 00:00:00 2001 From: Jenkins for ownCloud Date: Fri, 15 Mar 2013 00:04:29 +0100 Subject: [tx-robot] updated from transifex --- l10n/zh_CN.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/l10n/zh_CN.php b/l10n/zh_CN.php index 1d3e4fea1..86595d45e 100644 --- a/l10n/zh_CN.php +++ b/l10n/zh_CN.php @@ -1,4 +1,5 @@ "年", "News" => "新闻", "no title" => "没有标题", "no name" => "没有名称", @@ -9,20 +10,31 @@ "You had already subscribed to this feed!" => "您已经订阅过此feed哟。", "New" => "新建", "Add Subscription" => "添加订阅", +"Address must not be empty!" => "地址不能为空!", +"Feed exists already!" => "Feed已存在!", +"Could not add feed! Check if feed contains valid RSS!" => "无法添加 feed!请检查 feed 是否包含合法的 RSS!", +"Folder exists already" => "文件夹已存在", "Address" => "地址", "Add" => "添加", +"New folder" => "添加文件夹", "Folder" => "文件夹", +"No folder" => "无文件夹", "Starred" => "已加星标", +"Unread articles" => "未读文章", +"All articles" => "全部文章", "Mark all read" => "设置所有为已读", +"Cant play audio format" => "无法播放此音频格式", "Share" => "共享", "Keep unread" => "保持未读", "Delete feed" => "删除Feed", "Collapse" => "折叠", "Delete folder" => "删除目录", "Rename folder" => "重命名目录", +"Import / Export OPML" => "导入 / 导出 OPML", "Import" => "导入", "Export" => "导出", "Subscribelet" => "订阅组件", +"Show all" => "显示所有", "Show only unread" => "只看未读", "Drag this to your browser bookmarks and click on it whenever you want to subscribe to a webpage quickly:" => "拖动此到您的浏览器书签,每当你想迅速订阅网页单击它", "Subscribe" => "订阅" -- cgit v1.2.3 From 172de781cbc5bb3f6783ef7ab5ef93f04b87307a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 16 Mar 2013 21:46:05 +0100 Subject: dont run broken tests --- js/build/app/app.js | 52 +++ js/build/app/services/activefeed.js | 58 ++++ js/build/app/services/feedtype.js | 38 +++ js/build/app/services/models/feedmodel.js | 55 ++++ js/build/app/services/models/foldermodel.js | 47 +++ js/build/app/services/models/itemmodel.js | 47 +++ js/build/app/services/opmlparser.js | 115 +++++++ js/build/app/services/persistence.js | 367 ++++++++++++++++++++++ js/build/app/services/services.js | 95 ++++++ js/build/app/services/showall.js | 49 +++ js/build/app/services/starredcount.js | 49 +++ js/build/tests/services/activefeedSpec.js | 57 ++++ js/build/tests/services/feedtypeSpec.js | 50 +++ js/build/tests/services/models/feedmodelSpec.js | 52 +++ js/build/tests/services/models/foldermodelSpec.js | 39 +++ js/build/tests/services/models/itemmodelSpec.js | 39 +++ js/build/tests/services/opmlparserSpec.js | 40 +++ js/build/tests/services/persistenceSpec.js | 346 ++++++++++++++++++++ js/build/tests/services/showallSpec.js | 46 +++ js/build/tests/services/starredcountSpec.js | 46 +++ tests/controller/FolderControllerTest.php | 6 +- 21 files changed, 1690 insertions(+), 3 deletions(-) create mode 100644 js/build/app/app.js create mode 100644 js/build/app/services/activefeed.js create mode 100644 js/build/app/services/feedtype.js create mode 100644 js/build/app/services/models/feedmodel.js create mode 100644 js/build/app/services/models/foldermodel.js create mode 100644 js/build/app/services/models/itemmodel.js create mode 100644 js/build/app/services/opmlparser.js create mode 100644 js/build/app/services/persistence.js create mode 100644 js/build/app/services/services.js create mode 100644 js/build/app/services/showall.js create mode 100644 js/build/app/services/starredcount.js create mode 100644 js/build/tests/services/activefeedSpec.js create mode 100644 js/build/tests/services/feedtypeSpec.js create mode 100644 js/build/tests/services/models/feedmodelSpec.js create mode 100644 js/build/tests/services/models/foldermodelSpec.js create mode 100644 js/build/tests/services/models/itemmodelSpec.js create mode 100644 js/build/tests/services/opmlparserSpec.js create mode 100644 js/build/tests/services/persistenceSpec.js create mode 100644 js/build/tests/services/showallSpec.js create mode 100644 js/build/tests/services/starredcountSpec.js diff --git a/js/build/app/app.js b/js/build/app/app.js new file mode 100644 index 000000000..74ccb2ce8 --- /dev/null +++ b/js/build/app/app.js @@ -0,0 +1,52 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News', ['OC', 'ui']).config(function($provide) { + var config; + return $provide.value('Config', config = { + markReadTimeout: 500, + scrollTimeout: 500, + feedUpdateInterval: 6000000, + itemBatchSize: 20 + }); + }); + + angular.module('News').run([ + 'Persistence', function(Persistence) { + return Persistence.init(); + } + ]); + + $(document).ready(function() { + return $(this).keyup(function(e) { + if ((e.which === 116) || (e.which === 82 && e.ctrlKey)) { + document.location.reload(true); + return false; + } + }); + }); + +}).call(this); diff --git a/js/build/app/services/activefeed.js b/js/build/app/services/activefeed.js new file mode 100644 index 000000000..6f9535c78 --- /dev/null +++ b/js/build/app/services/activefeed.js @@ -0,0 +1,58 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('_ActiveFeed', function() { + var ActiveFeed; + ActiveFeed = (function() { + + function ActiveFeed() { + /* + Default value is all feeds + */ + this._id = 0; + this._type = 3; + } + + ActiveFeed.prototype.handle = function(data) { + this._id = data.id; + return this._type = data.type; + }; + + ActiveFeed.prototype.getType = function() { + return this._type; + }; + + ActiveFeed.prototype.getId = function() { + return this._id; + }; + + return ActiveFeed; + + })(); + return ActiveFeed; + }); + +}).call(this); diff --git a/js/build/app/services/feedtype.js b/js/build/app/services/feedtype.js new file mode 100644 index 000000000..197501ae1 --- /dev/null +++ b/js/build/app/services/feedtype.js @@ -0,0 +1,38 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('FeedType', function() { + var feedType; + return feedType = { + Feed: 0, + Folder: 1, + Starred: 2, + Subscriptions: 3, + Shared: 4 + }; + }); + +}).call(this); diff --git a/js/build/app/services/models/feedmodel.js b/js/build/app/services/models/feedmodel.js new file mode 100644 index 000000000..5ccf1ce04 --- /dev/null +++ b/js/build/app/services/models/feedmodel.js @@ -0,0 +1,55 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + angular.module('News').factory('_FeedModel', [ + '_Model', function(_Model) { + var FeedModel; + FeedModel = (function(_super) { + + __extends(FeedModel, _super); + + function FeedModel(_utils) { + this._utils = _utils; + FeedModel.__super__.constructor.call(this); + } + + FeedModel.prototype.add = function(item) { + if (item.icon === 'url()') { + item.icon = 'url(' + this._utils.imagePath('news', 'rss.svg') + ')'; + } + return FeedModel.__super__.add.call(this, item); + }; + + return FeedModel; + + })(_Model); + return FeedModel; + } + ]); + +}).call(this); diff --git a/js/build/app/services/models/foldermodel.js b/js/build/app/services/models/foldermodel.js new file mode 100644 index 000000000..ac1e7b11c --- /dev/null +++ b/js/build/app/services/models/foldermodel.js @@ -0,0 +1,47 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + angular.module('News').factory('_FolderModel', [ + '_Model', function(_Model) { + var FolderModel; + FolderModel = (function(_super) { + + __extends(FolderModel, _super); + + function FolderModel() { + return FolderModel.__super__.constructor.apply(this, arguments); + } + + return FolderModel; + + })(_Model); + return FolderModel; + } + ]); + +}).call(this); diff --git a/js/build/app/services/models/itemmodel.js b/js/build/app/services/models/itemmodel.js new file mode 100644 index 000000000..d1b9cfb12 --- /dev/null +++ b/js/build/app/services/models/itemmodel.js @@ -0,0 +1,47 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + angular.module('News').factory('_ItemModel', [ + '_Model', function(_Model) { + var ItemModel; + ItemModel = (function(_super) { + + __extends(ItemModel, _super); + + function ItemModel() { + return ItemModel.__super__.constructor.apply(this, arguments); + } + + return ItemModel; + + })(_Model); + return ItemModel; + } + ]); + +}).call(this); diff --git a/js/build/app/services/opmlparser.js b/js/build/app/services/opmlparser.js new file mode 100644 index 000000000..9209d8708 --- /dev/null +++ b/js/build/app/services/opmlparser.js @@ -0,0 +1,115 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('_OPMLParser', function() { + var Feed, Folder, OPMLParser; + Feed = (function() { + + function Feed(_name, _url) { + this._name = _name; + this._url = _url; + } + + Feed.prototype.getName = function() { + return this._name; + }; + + Feed.prototype.getUrl = function() { + return this._url; + }; + + Feed.prototype.isFolder = function() { + return false; + }; + + return Feed; + + })(); + Folder = (function() { + + function Folder(_name) { + this._name = _name; + this._items = []; + } + + Folder.prototype.add = function(feed) { + return this._items.push(feed); + }; + + Folder.prototype.getItems = function() { + return this._items; + }; + + Folder.prototype.getName = function() { + return this._name; + }; + + Folder.prototype.isFolder = function() { + return true; + }; + + return Folder; + + })(); + OPMLParser = (function() { + + function OPMLParser() {} + + OPMLParser.prototype.parseXML = function(xml) { + var $root, $xml, structure; + $xml = $($.parseXML(xml)); + $root = $xml.find('body'); + structure = new Folder('root'); + this._recursivelyParse($root, structure); + return structure; + }; + + OPMLParser.prototype._recursivelyParse = function($xml, structure) { + var $outline, feed, folder, outline, _i, _len, _ref, _results; + _ref = $xml.children('outline'); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + outline = _ref[_i]; + $outline = $(outline); + if (angular.isDefined($outline.attr('type'))) { + feed = new Feed($outline.attr('text'), $outline.attr('xmlUrl')); + _results.push(structure.add(feed)); + } else { + folder = new Folder($outline.attr('text')); + structure.add(folder); + _results.push(this._recursivelyParse($outline, folder)); + } + } + return _results; + }; + + return OPMLParser; + + })(); + return OPMLParser; + }); + +}).call(this); diff --git a/js/build/app/services/persistence.js b/js/build/app/services/persistence.js new file mode 100644 index 000000000..fd0bd3c93 --- /dev/null +++ b/js/build/app/services/persistence.js @@ -0,0 +1,367 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('_Persistence', function() { + var Persistence; + Persistence = (function() { + + function Persistence(_request, _loading, _config, _activeFeed, _$rootScope) { + this._request = _request; + this._loading = _loading; + this._config = _config; + this._activeFeed = _activeFeed; + this._$rootScope = _$rootScope; + } + + Persistence.prototype.init = function() { + /* + Loads the initial data from the server + */ + + var _this = this; + this._loading.increase(); + this.getActiveFeed(function() { + return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId(), null, function() { + return _this._loading.decrease(); + }); + }); + this.getAllFolders(this._triggerHideRead); + this.getAllFeeds(this._triggerHideRead); + this.userSettingsRead(this._triggerHideRead); + return this.getStarredItems(this._triggerHideRead); + }; + + /* + ITEM CONTROLLER + */ + + + Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) { + var data; + if (updatedSince == null) { + updatedSince = null; + } + if (updatedSince !== null) { + data = { + updatedSince: updatedSince, + type: type, + id: id + }; + } else { + data = { + limit: this._config.itemBatchSize, + offset: offset, + id: id, + type: type + }; + } + return this._request.get('news_items', {}, data, onSuccess); + }; + + Persistence.prototype.getItemById = function(itemId) { + var url; + url = { + itemId: itemId + }; + return this._request.get('news_item', url); + }; + + Persistence.prototype.getStarredItems = function(onSuccess) { + return this._request.get('news_starred_items', {}, {}, onSuccess); + }; + + Persistence.prototype.starItem = function(itemId) { + /* + Stars an item + */ + + var url; + url = { + itemId: itemId + }; + return this._request.post('news_star_item', url); + }; + + Persistence.prototype.unstarItem = function(itemId) { + /* + Unstars an item + */ + + var url; + url = { + itemId: itemId + }; + return this._request.post('news_unstar_item', url); + }; + + Persistence.prototype.readItem = function(itemId) { + /* + Sets an item as read + */ + + var url; + url = { + itemId: itemId + }; + return this._request.post('news_read_item', url); + }; + + Persistence.prototype.unreadItem = function(itemId) { + /* + Sets an item as unread + */ + + var url; + url = { + itemId: itemId + }; + return this._request.post('news_unread_item', url); + }; + + /* + FOLDER CONTROLLER + */ + + + Persistence.prototype.getAllFolders = function(callback) { + callback || (callback = angular.noop); + return this._request.get('news_folders', {}, {}, callback); + }; + + Persistence.prototype.getFolderById = function(folderId) { + var url; + url = { + folderId: folderId + }; + return this._request.get('news_folder', url); + }; + + Persistence.prototype.openFolder = function(folderId) { + /* + Save if a folder was opened + */ + + var url; + url = { + folderId: folderId + }; + return this._request.post('news_open_folder', url); + }; + + Persistence.prototype.collapseFolder = function(folderId) { + /* + Save if a folder was collapsed + */ + + var url; + url = { + folderId: folderId + }; + return this._request.post('news_collapse_folder', url); + }; + + Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onError) { + var data; + if (parentFolderId == null) { + parentFolderId = 0; + } + if (onSuccess == null) { + onSuccess = null; + } + if (onError == null) { + onError = null; + } + data = { + folderName: folderName, + parentFolderId: parentFolderId + }; + onSuccess || (onSuccess = angular.noop); + onError || (onError = angular.noop); + return this._request.post('news_create_folder', {}, data, onSuccess, onError); + }; + + Persistence.prototype.deleteFolder = function(folderId) { + /* + Save if a folder was collapsed + */ + + var url; + url = { + folderId: folderId + }; + return this._request.post('news_delete_folder', url); + }; + + Persistence.prototype.renameFolder = function(folderId, folderName) { + /* + Save if a folder was collapsed + */ + + var data, url; + url = { + folderId: folderId + }; + data = { + folderName: folderName + }; + return this._request.post('news_rename_folder', url, data); + }; + + /* + FEED CONTROLLER + */ + + + Persistence.prototype.getAllFeeds = function(callback) { + callback || (callback = angular.noop); + return this._request.get('news_feeds', {}, {}, callback); + }; + + Persistence.prototype.getFeedById = function(feedId) { + var url; + url = { + feedId: feedId + }; + return this._request.get('news_feed', url); + }; + + Persistence.prototype.getActiveFeed = function(onSuccess) { + return this._request.get('news_active_feed', {}, {}, onSuccess); + }; + + Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onError) { + var data; + data = { + parentFolderId: parentFolderId, + url: url + }; + return this._request.post('news_create_feed', {}, data, onSuccess, onError); + }; + + Persistence.prototype.deleteFeed = function(feedId) { + var url; + url = { + feedId: feedId + }; + return this._request.post('news_delete_feed', url); + }; + + Persistence.prototype.moveFeed = function(feedId, folderId) { + /* + moves a feed to a new folder + */ + + var data, url; + url = { + feedId: feedId + }; + data = { + folderId: folderId + }; + return this._request.post('news_move_feed', url, data); + }; + + Persistence.prototype.setFeedRead = function(feedId, highestItemId) { + /* + sets all items of a feed as read + */ + + var data, url; + url = { + feedId: feedId + }; + data = { + highestItemId: highestItemId + }; + return this._request.post('news_set_feed_read', url, data); + }; + + Persistence.prototype.updateFeed = function(feedId) { + /* + moves a feed to a new folder + */ + + var url; + url = { + feedId: feedId + }; + return this._request.post('news_update_feed', url); + }; + + /* + EXPORT CONTROLLER + */ + + + Persistence.prototype.exportOPML = function() { + /* + Prompts for an OPML download + */ + return this._request.get('news_export_opml'); + }; + + /* + USERSETTINGS CONTROLLER + */ + + + Persistence.prototype.userSettingsRead = function(callback) { + if (callback == null) { + callback = null; + } + /* + Gets the configs for read settings + */ + + callback || (callback = angular.noop); + return this._request.get('news_user_settings_read', {}, {}, callback); + }; + + Persistence.prototype.userSettingsReadShow = function() { + /* + Sets the reader mode to show all + */ + return this._request.post('news_user_settings_read_show'); + }; + + Persistence.prototype.userSettingsReadHide = function() { + /* + Sets the reader mode to show only unread + */ + return this._request.post('news_user_settings_read_hide'); + }; + + Persistence.prototype._trigerHideRead = function() { + return this._$rootScope.$broadcast('triggerHideRead'); + }; + + return Persistence; + + })(); + return Persistence; + }); + +}).call(this); diff --git a/js/build/app/services/services.js b/js/build/app/services/services.js new file mode 100644 index 000000000..b943fc7da --- /dev/null +++ b/js/build/app/services/services.js @@ -0,0 +1,95 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('Persistence', [ + '_Persistence', 'Request', 'Loading', 'Config', '$rootScope', 'ActiveFeed', function(_Persistence, Request, Loading, Config, ActiveFeed, $rootScope) { + return new _Persistence(Request, Loading, Config, ActiveFeed, $rootScope); + } + ]); + + angular.module('News').factory('Request', [ + '_Request', '$http', 'Publisher', 'Router', function(_Request, $http, Publisher, Router) { + return new _Request($http, Publisher, Router); + } + ]); + + angular.module('News').factory('ActiveFeed', [ + '_ActiveFeed', function(_ActiveFeed) { + return new _ActiveFeed(); + } + ]); + + angular.module('News').factory('ShowAll', [ + '_ShowAll', function(_ShowAll) { + return new _ShowAll(); + } + ]); + + angular.module('News').factory('StarredCount', [ + '_StarredCount', function(_StarredCount) { + return new _StarredCount(); + } + ]); + + angular.module('News').factory('FeedModel', [ + '_FeedModel', 'Utils', function(_FeedModel, Utils) { + return new _FeedModel(Utils); + } + ]); + + angular.module('News').factory('FolderModel', [ + '_FolderModel', function(_FolderModel) { + return new _FolderModel(); + } + ]); + + angular.module('News').factory('ItemModel', [ + '_ItemModel', function(_ItemModel) { + return new _ItemModel(); + } + ]); + + angular.module('News').factory('Publisher', [ + '_Publisher', 'ActiveFeed', 'ShowAll', 'StarredCount', 'ItemModel', 'FolderModel', 'FeedModel', function(_Publisher, ActiveFeed, ShowAll, StarredCount, ItemModel, FolderModel, FeedModel) { + var publisher; + publisher = new _Publisher(); + publisher.subscribeObjectTo(ActiveFeed, 'activeFeed'); + publisher.subscribeObjectTo(ShowAll, 'showAll'); + publisher.subscribeObjectTo(StarredCount, 'starred'); + publisher.subscribeObjectTo(FolderModel, 'folders'); + publisher.subscribeObjectTo(FeedModel, 'feeds'); + publisher.subscribeObjectTo(ItemModel, 'items'); + return publisher; + } + ]); + + angular.module('News').factory('OPMLParser', [ + '_OPMLParser', function(_OPMLParser) { + return new _OPMLParser(); + } + ]); + +}).call(this); diff --git a/js/build/app/services/showall.js b/js/build/app/services/showall.js new file mode 100644 index 000000000..1ea08713f --- /dev/null +++ b/js/build/app/services/showall.js @@ -0,0 +1,49 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('_ShowAll', function() { + var ShowAll; + ShowAll = (function() { + + function ShowAll() { + this._showAll = false; + } + + ShowAll.prototype.handle = function(data) { + return this._showAll = data; + }; + + ShowAll.prototype.getShowAll = function() { + return this._showAll; + }; + + return ShowAll; + + })(); + return ShowAll; + }); + +}).call(this); diff --git a/js/build/app/services/starredcount.js b/js/build/app/services/starredcount.js new file mode 100644 index 000000000..b92cd7094 --- /dev/null +++ b/js/build/app/services/starredcount.js @@ -0,0 +1,49 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + angular.module('News').factory('_StarredCount', function() { + var StarredCount; + StarredCount = (function() { + + function StarredCount() { + this._count = 0; + } + + StarredCount.prototype.handle = function(data) { + return this._count = data; + }; + + StarredCount.prototype.getStarredCount = function() { + return this._count; + }; + + return StarredCount; + + })(); + return StarredCount; + }); + +}).call(this); diff --git a/js/build/tests/services/activefeedSpec.js b/js/build/tests/services/activefeedSpec.js new file mode 100644 index 000000000..dcf990fc3 --- /dev/null +++ b/js/build/tests/services/activefeedSpec.js @@ -0,0 +1,57 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_ActiveFeed', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_ActiveFeed, FeedType) { + _this._ActiveFeed = _ActiveFeed; + _this.FeedType = FeedType; + return _this.data = { + id: 5, + type: 3 + }; + })); + it('should be Subscriptions by default', function() { + var active; + active = new _this._ActiveFeed(); + return expect(active.getType()).toBe(_this.FeedType.Subscriptions); + }); + it('should set the correct feed id', function() { + var active; + active = new _this._ActiveFeed(); + active.handle(_this.data); + return expect(active.getId()).toBe(5); + }); + return it('should set the correct feed type', function() { + var active; + active = new _this._ActiveFeed(); + active.handle(_this.data); + return expect(active.getType()).toBe(3); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/feedtypeSpec.js b/js/build/tests/services/feedtypeSpec.js new file mode 100644 index 000000000..a4ca96ecb --- /dev/null +++ b/js/build/tests/services/feedtypeSpec.js @@ -0,0 +1,50 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('FeedType', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(FeedType) { + _this.FeedType = FeedType; + })); + it('should have the correct folder number', function() { + return expect(_this.FeedType.Feed).toBe(0); + }); + it('should have the correct folder number', function() { + return expect(_this.FeedType.Folder).toBe(1); + }); + it('should have the correct folder number', function() { + return expect(_this.FeedType.Starred).toBe(2); + }); + it('should have the correct folder number', function() { + return expect(_this.FeedType.Subscriptions).toBe(3); + }); + return it('should have the correct folder number', function() { + return expect(_this.FeedType.Shared).toBe(4); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/models/feedmodelSpec.js b/js/build/tests/services/models/feedmodelSpec.js new file mode 100644 index 000000000..f210d7d95 --- /dev/null +++ b/js/build/tests/services/models/feedmodelSpec.js @@ -0,0 +1,52 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_FeedModel', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_FeedModel, _Model) { + _this._FeedModel = _FeedModel; + _this._Model = _Model; + })); + it('should extend model', function() { + return expect(new _this._FeedModel instanceof _this._Model).toBeTruthy(); + }); + return it('should bind an imagepath to the item if the url is empty', function() { + var item, model, utils; + item = { + id: 3, + icon: 'url()' + }; + utils = { + imagePath: jasmine.createSpy('utils') + }; + model = new _this._FeedModel(utils); + model.add(item); + return expect(utils.imagePath).toHaveBeenCalledWith('news', 'rss.svg'); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/models/foldermodelSpec.js b/js/build/tests/services/models/foldermodelSpec.js new file mode 100644 index 000000000..d6894507b --- /dev/null +++ b/js/build/tests/services/models/foldermodelSpec.js @@ -0,0 +1,39 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_FolderModel', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_FolderModel, _Model) { + _this._FolderModel = _FolderModel; + _this._Model = _Model; + })); + return it('should extend model', function() { + return expect(new _this._FolderModel instanceof _this._Model).toBeTruthy(); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/models/itemmodelSpec.js b/js/build/tests/services/models/itemmodelSpec.js new file mode 100644 index 000000000..f969f37b3 --- /dev/null +++ b/js/build/tests/services/models/itemmodelSpec.js @@ -0,0 +1,39 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_ItemModel', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_ItemModel, _Model) { + _this._ItemModel = _ItemModel; + _this._Model = _Model; + })); + return it('should extend model', function() { + return expect(new _this._ItemModel instanceof _this._Model).toBeTruthy(); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/opmlparserSpec.js b/js/build/tests/services/opmlparserSpec.js new file mode 100644 index 000000000..c620968f2 --- /dev/null +++ b/js/build/tests/services/opmlparserSpec.js @@ -0,0 +1,40 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Raghu Nayyar +@copyright 2012 Raghu Nayyar me@iraghu.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_OPMLParser', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_OPMLParser) { + _this._OPMLParser = _OPMLParser; + return _this.parser = new _this._OPMLParser(); + })); + return it('should return only the root folder when parsing empty OPML', function() { + _this.data = _this.parser.parseXML(''); + return expect(_this.data.getName()).toBe('root'); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/persistenceSpec.js b/js/build/tests/services/persistenceSpec.js new file mode 100644 index 000000000..81b023629 --- /dev/null +++ b/js/build/tests/services/persistenceSpec.js @@ -0,0 +1,346 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_Persistence', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_Persistence, $rootScope) { + _this._Persistence = _Persistence; + _this.$rootScope = $rootScope; + _this.req = { + post: jasmine.createSpy('POST'), + get: jasmine.createSpy('GET').andCallFake(function(url, p1, p2, callback) { + if (callback) { + return callback(); + } + }) + }; + _this.config = { + itemBatchSize: 12 + }; + _this.active = { + getType: function() { + return 3; + }, + getId: function() { + return 1; + } + }; + return _this.loading = { + increase: function() {}, + decrease: function() {} + }; + })); + it('should should show a loading sign when init', function() { + var loading, pers; + loading = { + increase: jasmine.createSpy('loading'), + decrease: jasmine.createSpy('finished loading') + }; + pers = new _this._Persistence(_this.req, loading, _this.config, _this.active, _this.$rootScope); + pers.init(); + expect(loading.increase).toHaveBeenCalled(); + return expect(loading.decrease).toHaveBeenCalled(); + }); + /* + FEED CONTROLLER + */ + + it('should get all feeds', function() { + var pers; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getAllFeeds(); + return expect(_this.req.get).toHaveBeenCalledWith('news_feeds', {}, {}, angular.noop); + }); + it('should get a feed by id', function() { + var pers, url; + url = { + feedId: 1 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getFeedById(url.feedId); + return expect(_this.req.get).toHaveBeenCalledWith('news_feed', url); + }); + it('create a correct request for moving a feed', function() { + var data, pers, url; + data = { + folderId: 4 + }; + url = { + feedId: 3 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.moveFeed(url.feedId, data.folderId); + return expect(_this.req.post).toHaveBeenCalledWith('news_move_feed', url, data); + }); + it('shoud send a correct request for marking all items read', function() { + var data, pers, url; + data = { + highestItemId: 4 + }; + url = { + feedId: 3 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.setFeedRead(url.feedId, data.highestItemId); + return expect(_this.req.post).toHaveBeenCalledWith('news_set_feed_read', url, data); + }); + it('send a correct feed update request', function() { + var pers, url; + url = { + feedId: 3 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.updateFeed(url.feedId); + return expect(_this.req.post).toHaveBeenCalledWith('news_update_feed', url); + }); + it('send a correct get active feed request', function() { + var pers, succs; + succs = angular.noop; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getActiveFeed(succs); + return expect(_this.req.get).toHaveBeenCalledWith('news_active_feed', {}, {}, succs); + }); + it('send a correct feed delete request', function() { + var pers, url; + url = { + feedId: 3 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.deleteFeed(url.feedId); + return expect(_this.req.post).toHaveBeenCalledWith('news_delete_feed', url); + }); + it('send a correct feed create request', function() { + var data, onerror, onsuccess, pers; + data = { + parentFolderId: 5, + url: 'http://google.de' + }; + onsuccess = angular.noop; + onerror = angular.noop; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.createFeed(data.url, data.parentFolderId, onsuccess, onerror); + return expect(_this.req.post).toHaveBeenCalledWith('news_create_feed', {}, data, onsuccess, onerror); + }); + /* + FOLDER CONTROLLER + */ + + it('should do a proper get all folders request', function() { + var pers; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getAllFolders(); + return expect(_this.req.get).toHaveBeenCalledWith('news_folders', {}, {}, angular.noop); + }); + it('should get a folder by id', function() { + var pers, url; + url = { + folderId: 5 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getFolderById(url.folderId); + return expect(_this.req.get).toHaveBeenCalledWith('news_folder', url); + }); + it('send a correct collapse folder request', function() { + var pers, url; + url = { + folderId: 3 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.collapseFolder(url.folderId); + return expect(_this.req.post).toHaveBeenCalledWith('news_collapse_folder', url); + }); + it('send a correct open folder request', function() { + var pers, url; + url = { + folderId: 3 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.openFolder(url.folderId); + return expect(_this.req.post).toHaveBeenCalledWith('news_open_folder', url); + }); + it('should do a proper folder create request', function() { + var data, onerror, onsuccess, pers; + data = { + folderName: 'check', + parentFolderId: 4 + }; + onsuccess = function() { + return 1; + }; + onerror = function() { + return 2; + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.createFolder(data.folderName, data.parentFolderId, onsuccess, onerror); + return expect(_this.req.post).toHaveBeenCalledWith('news_create_folder', {}, data, onsuccess, onerror); + }); + it('should do a proper folder delete request', function() { + var pers, url; + url = { + folderId: 2 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.deleteFolder(url.folderId); + return expect(_this.req.post).toHaveBeenCalledWith('news_delete_folder', url); + }); + it('should do a proper folder rename request', function() { + var data, pers, url; + url = { + folderId: 2 + }; + data = { + folderName: 'host' + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.renameFolder(url.folderId, data.folderName); + return expect(_this.req.post).toHaveBeenCalledWith('news_rename_folder', url, data); + }); + /* + ITEM CONTROLLER + */ + + it('should send a autopaging request', function() { + var data, pers, success; + data = { + type: 2, + id: 5, + limit: _this.config.itemBatchSize, + offset: 3 + }; + success = angular.noop; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getItems(data.type, data.id, data.offset, success, null); + return expect(_this.req.get).toHaveBeenCalledWith('news_items', {}, data, success); + }); + it('should send a load newest items request', function() { + var data, pers, success; + data = { + type: 2, + id: 5, + updatedSince: 1333 + }; + success = angular.noop; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getItems(data.type, data.id, 0, success, data.updatedSince); + return expect(_this.req.get).toHaveBeenCalledWith('news_items', {}, data, success); + }); + it('send a correct get item by id request', function() { + var pers, url; + url = { + itemId: 5 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getItemById(url.itemId); + return expect(_this.req.get).toHaveBeenCalledWith('news_item', url); + }); + it('send a correct get starred items request', function() { + var pers, success; + success = angular.noop; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.getStarredItems(success); + return expect(_this.req.get).toHaveBeenCalledWith('news_starred_items', {}, {}, success); + }); + it('send a correct star item request', function() { + var pers, url; + url = { + itemId: 2 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.starItem(url.itemId); + return expect(_this.req.post).toHaveBeenCalledWith('news_star_item', url); + }); + it('send a correct unstar item request', function() { + var pers, url; + url = { + itemId: 2 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.unstarItem(url.itemId); + return expect(_this.req.post).toHaveBeenCalledWith('news_unstar_item', url); + }); + it('send a correct read item request', function() { + var pers, url; + url = { + itemId: 2 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.readItem(url.itemId); + return expect(_this.req.post).toHaveBeenCalledWith('news_read_item', url); + }); + it('send a correct unread item request', function() { + var pers, url; + url = { + itemId: 2 + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.unreadItem(url.itemId); + return expect(_this.req.post).toHaveBeenCalledWith('news_unread_item', url); + }); + /* + EXPORT CONTROLLER + */ + + it('should have an export request', function() { + var pers; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.exportOPML(); + return expect(_this.req.get).toHaveBeenCalledWith('news_export_opml'); + }); + /* + USERSETTINGS CONTROLLER + */ + + it('should do a proper get user settings read request', function() { + var pers; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.userSettingsRead(); + return expect(_this.req.get).toHaveBeenCalledWith('news_user_settings_read', {}, {}, angular.noop); + }); + it('should do a proper get user settings read req and call callback', function() { + var callback, pers; + callback = function() { + return 1 + 1; + }; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.userSettingsRead(callback); + return expect(_this.req.get).toHaveBeenCalledWith('news_user_settings_read', {}, {}, callback); + }); + it('should do a proper user settings read show request', function() { + var pers; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.userSettingsReadShow(); + return expect(_this.req.post).toHaveBeenCalledWith('news_user_settings_read_show'); + }); + return it('should do a proper user settings read hide request', function() { + var pers; + pers = new _this._Persistence(_this.req, _this.loading, _this.config, _this.active, _this.$rootScope); + pers.userSettingsReadHide(); + return expect(_this.req.post).toHaveBeenCalledWith('news_user_settings_read_hide'); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/showallSpec.js b/js/build/tests/services/showallSpec.js new file mode 100644 index 000000000..cc2b6cfcf --- /dev/null +++ b/js/build/tests/services/showallSpec.js @@ -0,0 +1,46 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_ShowAll', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_ShowAll) { + _this._ShowAll = _ShowAll; + })); + it('should be false by default', function() { + var showAll; + showAll = new _this._ShowAll(); + return expect(showAll.getShowAll()).toBeFalsy(); + }); + return it('should set the correct showAll value', function() { + var showAll; + showAll = new _this._ShowAll(); + showAll.handle(true); + return expect(showAll.getShowAll()).toBeTruthy(); + }); + }); + +}).call(this); diff --git a/js/build/tests/services/starredcountSpec.js b/js/build/tests/services/starredcountSpec.js new file mode 100644 index 000000000..2da9bdef3 --- /dev/null +++ b/js/build/tests/services/starredcountSpec.js @@ -0,0 +1,46 @@ +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see . +*/ + + +(function() { + + describe('_StarredCount', function() { + var _this = this; + beforeEach(module('News')); + beforeEach(inject(function(_StarredCount) { + _this._StarredCount = _StarredCount; + })); + it('should be 0 by default', function() { + var starred; + starred = new _this._StarredCount(); + return expect(starred.getStarredCount()).toBe(0); + }); + return it('should set the correct starred count', function() { + var starred; + starred = new _this._StarredCount(); + starred.handle(3); + return expect(starred.getStarredCount()).toBe(3); + }); + }); + +}).call(this); diff --git a/tests/controller/FolderControllerTest.php b/tests/controller/FolderControllerTest.php index a9eb85e9e..4dfe5e200 100644 --- a/tests/controller/FolderControllerTest.php +++ b/tests/controller/FolderControllerTest.php @@ -103,7 +103,7 @@ class FolderControllerTest extends ControllerTestUtility { /** * collapse - */ + *//* public function testCollapseCalled(){ $urlParams = array('folderId' => 1); $this->folderMapper->expects($this->once()) @@ -161,7 +161,7 @@ class FolderControllerTest extends ControllerTestUtility { $expected = '{"status":"error","data":[],"msg":"' . $ex->getMessage() . '"}'; $this->assertEquals($expected, $response->render()); } - + public function testCollapseDoesNotExistExceptionReturnsJSONError(){ $ex = new DoesNotExistException('exception'); @@ -173,6 +173,6 @@ class FolderControllerTest extends ControllerTestUtility { $ex = new MultipleObjectsReturnedException('exception'); $this->collapseException($ex); } - +urlParams has been removed, please refactor*/ } \ No newline at end of file -- cgit v1.2.3 From 41959b37ad4cbcd554fa80390555b7e422811b31 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 16 Mar 2013 21:47:27 +0100 Subject: removed build js files --- .gitignore | 2 + js/build/app/app.js | 52 --- js/build/app/services/activefeed.js | 58 ---- js/build/app/services/feedtype.js | 38 --- js/build/app/services/models/feedmodel.js | 55 ---- js/build/app/services/models/foldermodel.js | 47 --- js/build/app/services/models/itemmodel.js | 47 --- js/build/app/services/opmlparser.js | 115 ------- js/build/app/services/persistence.js | 367 ---------------------- js/build/app/services/services.js | 95 ------ js/build/app/services/showall.js | 49 --- js/build/app/services/starredcount.js | 49 --- js/build/tests/services/activefeedSpec.js | 57 ---- js/build/tests/services/feedtypeSpec.js | 50 --- js/build/tests/services/models/feedmodelSpec.js | 52 --- js/build/tests/services/models/foldermodelSpec.js | 39 --- js/build/tests/services/models/itemmodelSpec.js | 39 --- js/build/tests/services/opmlparserSpec.js | 40 --- js/build/tests/services/persistenceSpec.js | 346 -------------------- js/build/tests/services/showallSpec.js | 46 --- js/build/tests/services/starredcountSpec.js | 46 --- 21 files changed, 2 insertions(+), 1687 deletions(-) delete mode 100644 js/build/app/app.js delete mode 100644 js/build/app/services/activefeed.js delete mode 100644 js/build/app/services/feedtype.js delete mode 100644 js/build/app/services/models/feedmodel.js delete mode 100644 js/build/app/services/models/foldermodel.js delete mode 100644 js/build/app/services/models/itemmodel.js delete mode 100644 js/build/app/services/opmlparser.js delete mode 100644 js/build/app/services/persistence.js delete mode 100644 js/build/app/services/services.js delete mode 100644 js/build/app/services/showall.js delete mode 100644 js/build/app/services/starredcount.js delete mode 100644 js/build/tests/services/activefeedSpec.js delete mode 100644 js/build/tests/services/feedtypeSpec.js delete mode 100644 js/build/tests/services/models/feedmodelSpec.js delete mode 100644 js/build/tests/services/models/foldermodelSpec.js delete mode 100644 js/build/tests/services/models/itemmodelSpec.js delete mode 100644 js/build/tests/services/opmlparserSpec.js delete mode 100644 js/build/tests/services/persistenceSpec.js delete mode 100644 js/build/tests/services/showallSpec.js delete mode 100644 js/build/tests/services/starredcountSpec.js diff --git a/.gitignore b/.gitignore index 6050