diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-19 02:22:02 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-19 02:22:02 +0200 |
commit | 90584316b8f275fcad904b644676544eb0322636 (patch) | |
tree | 35ead28e8f0cdccc1771464442bb83ce5b558cc6 /js/tests | |
parent | ded252d29e99e068ea341506129e47a05e053a24 (diff) |
add test for firstrun page
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/e2e/main.js | 15 | ||||
-rw-r--r-- | js/tests/unit/controller/AppControllerSpec.js | 45 | ||||
-rw-r--r-- | js/tests/unit/service/LoadingSpec.js | 1 | ||||
-rw-r--r-- | js/tests/unit/service/PublisherSpec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/service/SettingsSpec.js | 30 |
5 files changed, 96 insertions, 1 deletions
diff --git a/js/tests/e2e/main.js b/js/tests/e2e/main.js index 3beb4c8af..328556326 100644 --- a/js/tests/e2e/main.js +++ b/js/tests/e2e/main.js @@ -11,7 +11,8 @@ describe('news page', function () { 'use strict'; beforeEach(function () { - browser.get('http://localhost/owncloud/index.php/apps/news/'); + browser.ignoreSynchronization = true; + browser.waitForAngular(); }); it('should go to the news page', function () { @@ -20,4 +21,16 @@ describe('news page', function () { }); }); + + it('should show the first run page', function () { + var firstRun, + greeting; + + firstRun = browser.findElement(By.id('first-run')); + greeting = firstRun.findElement(By.tagName('h1')); + + expect(firstRun.isDisplayed()).toBe(true); + expect(greeting.getText()).toBe('Welcome to the ownCloud News app!'); + }); + });
\ No newline at end of file diff --git a/js/tests/unit/controller/AppControllerSpec.js b/js/tests/unit/controller/AppControllerSpec.js new file mode 100644 index 000000000..b7dad7492 --- /dev/null +++ b/js/tests/unit/controller/AppControllerSpec.js @@ -0,0 +1,45 @@ +/** + * 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('AppController', function () { + 'use strict'; + + var controller; + + beforeEach(module('News')); + + beforeEach(inject(function ($controller) { + controller = $controller('AppController'); + })); + + + it('should expose Loading', inject(function (Loading) { + expect(controller.loading).toBe(Loading); + })); + + + it('should expose set firstrun if no feeds and folders', inject(function () { + expect(controller.isFirstRun()).toBe(true); + })); + + + it('should expose set firstrun if feeds', inject(function (Feed) { + Feed.add({url: 'test'}); + + expect(controller.isFirstRun()).toBe(false); + })); + + + it('should expose set firstrun if folders', inject(function (Folder) { + Folder.add({name: 'test'}); + + expect(controller.isFirstRun()).toBe(false); + })); + +});
\ No newline at end of file diff --git a/js/tests/unit/service/LoadingSpec.js b/js/tests/unit/service/LoadingSpec.js index f8146b87f..2033f33cc 100644 --- a/js/tests/unit/service/LoadingSpec.js +++ b/js/tests/unit/service/LoadingSpec.js @@ -15,6 +15,7 @@ describe('Loading', function () { it('should be not load by default', inject(function (Loading) { expect(Loading.isLoading('global')).toBe(false); expect(Loading.isLoading('content')).toBe(false); + expect(Loading.isLoading('autopaging')).toBe(false); })); it('should set loading', inject(function (Loading) { diff --git a/js/tests/unit/service/PublisherSpec.js b/js/tests/unit/service/PublisherSpec.js index f7fa67796..2b9206c93 100644 --- a/js/tests/unit/service/PublisherSpec.js +++ b/js/tests/unit/service/PublisherSpec.js @@ -24,7 +24,13 @@ describe('Publisher', function () { }); expect(obj.receive).toHaveBeenCalledWith('tom'); + })); + + it('should not broadcast to not subscribed channels', inject(function (Publisher) { + Publisher.publishAll({ + test: 'tom' + }); })); });
\ No newline at end of file diff --git a/js/tests/unit/service/SettingsSpec.js b/js/tests/unit/service/SettingsSpec.js new file mode 100644 index 000000000..65dc4bf2f --- /dev/null +++ b/js/tests/unit/service/SettingsSpec.js @@ -0,0 +1,30 @@ +/** + * 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('Settings', function () { + 'use strict'; + + beforeEach(module('News')); + + it('should receive default settings', inject(function (Settings) { + Settings.receive({ + 'showAll': true + }); + + expect(Settings.get('showAll')).toBe(true); + })); + + + it('should set values', inject(function (Settings) { + Settings.set('showAll', true); + + expect(Settings.get('showAll')).toBe(true); + })); + +});
\ No newline at end of file |