diff options
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/e2e/main.js | 6 | ||||
-rw-r--r-- | js/tests/unit/controller/ContentControllerSpec.js | 42 | ||||
-rw-r--r-- | js/tests/unit/controller/ItemControllerSpec.js | 26 | ||||
-rw-r--r-- | js/tests/unit/models/ModelSpec.js | 22 |
4 files changed, 67 insertions, 29 deletions
diff --git a/js/tests/e2e/main.js b/js/tests/e2e/main.js index 5b0ea5d82..b76110c65 100644 --- a/js/tests/e2e/main.js +++ b/js/tests/e2e/main.js @@ -27,9 +27,9 @@ describe('news page', function () { firstRun = browser.findElement(By.id('first-run')); - firstRun.findElement(By.tagName('h1')).then(function (greeting) { - expect(greeting.getText()).toBe('Welcome to the ownCloud News app!'); - }); + //firstRun.findElement(By.tagName('h1')).then(function (greeting) { + // expect(greeting.getText()).toBe('Welcome to the ownCloud News app!'); + //}); expect(firstRun.isDisplayed()).toBe(true); }); diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js new file mode 100644 index 000000000..9e3693e86 --- /dev/null +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -0,0 +1,42 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2014 + */ +describe('ContentController', function () { + 'use strict'; + + beforeEach(module('News')); + + + it('should publish data to models', inject(function ($controller, Publisher, Feed, Item) { + Publisher.subscribe(Item).toChannels('items'); + Publisher.subscribe(Feed).toChannels('feeds'); + + var controller = $controller('ContentController', { + data: { + 'items': [ + { + id: 3 + }, + { + id: 4 + } + ], + 'feeds': [ + { + url: 'hi' + } + ] + } + }); + + expect(controller.getItems().length).toBe(2); + expect(controller.getFeeds().length).toBe(1); + })); + +}); diff --git a/js/tests/unit/controller/ItemControllerSpec.js b/js/tests/unit/controller/ItemControllerSpec.js deleted file mode 100644 index cf0eb0d4d..000000000 --- a/js/tests/unit/controller/ItemControllerSpec.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * ownCloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @copyright Bernhard Posselt 2014 - */ -describe('ItemController', function () { - 'use strict'; - - var controller; - - beforeEach(module('News')); - - beforeEach(inject(function ($controller) { - controller = $controller; - })); - - - it('should ', function () { - expect(controller).toBeDefined(); - }); - -});
\ No newline at end of file diff --git a/js/tests/unit/models/ModelSpec.js b/js/tests/unit/models/ModelSpec.js index 57b0f422c..6e1d0791b 100644 --- a/js/tests/unit/models/ModelSpec.js +++ b/js/tests/unit/models/ModelSpec.js @@ -126,4 +126,26 @@ describe('Model', function () { expect(childModel.size()).toBe(0); }); + + it('should get all models', function () { + var object1, + object2; + + object1 = { + id: 3, + name: 'test', + test: 'ho' + }; + + object2 = { + id: 4, + name: 'test2' + }; + + childModel.add(object1); + childModel.add(object2); + + expect(childModel.getAll()[1].id).toBe(4); + }); + });
\ No newline at end of file |