summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-01-13 14:47:06 +0100
committerGitHub <noreply@github.com>2017-01-13 14:47:06 +0100
commit0f792fedefb0b31367e59b1d5abe1db20371d04f (patch)
tree1bdf4b937454a8cd972434c43725f5d940466524
parent91beb178a7cf00749cdaab3c8eefa2536e53976d (diff)
parentdd88e70dffc9f7f4dbd83fdb2f2408af8827eb4c (diff)
downloadnextcloud-server-0f792fedefb0b31367e59b1d5abe1db20371d04f.tar.gz
nextcloud-server-0f792fedefb0b31367e59b1d5abe1db20371d04f.zip
Merge pull request #3060 from nextcloud/cleanup-js-tests
Cleanup js tests
-rw-r--r--core/js/tests/specs/coreSpec.js4
-rw-r--r--core/js/tests/specs/l10nSpec.js7
-rw-r--r--tests/karma.config.js9
3 files changed, 17 insertions, 3 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index 370ebc6ba2d..d83c0cd9a38 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -967,8 +967,9 @@ describe('Core base tests', function() {
fadeOutStub.restore();
});
it('hides the first notification when calling hide without arguments', function() {
- var $row1 = OC.Notification.show('One');
+ OC.Notification.show('One');
var $row2 = OC.Notification.show('Two');
+ spyOn(console, 'warn');
var $el = $('#notification');
var $rows = $el.find('.row');
@@ -976,6 +977,7 @@ describe('Core base tests', function() {
OC.Notification.hide();
+ expect(console.warn).toHaveBeenCalled();
$rows = $el.find('.row');
expect($rows.length).toEqual(1);
expect($rows.eq(0).is($row2)).toEqual(true);
diff --git a/core/js/tests/specs/l10nSpec.js b/core/js/tests/specs/l10nSpec.js
index 2ceb2f4a916..064b27aa34a 100644
--- a/core/js/tests/specs/l10nSpec.js
+++ b/core/js/tests/specs/l10nSpec.js
@@ -21,6 +21,7 @@ describe('OC.L10N tests', function() {
describe('text translation', function() {
beforeEach(function() {
+ spyOn(console, 'warn');
OC.L10N.register(TEST_APP, {
'Hello world!': 'Hallo Welt!',
'Hello {name}, the weather is {weather}': 'Hallo {name}, das Wetter ist {weather}',
@@ -78,8 +79,10 @@ describe('OC.L10N tests', function() {
}
it('generates plural for default text when translation does not exist', function() {
+ spyOn(console, 'warn');
OC.L10N.register(TEST_APP, {
});
+ expect(console.warn).toHaveBeenCalled();
expect(
n(TEST_APP, 'download %n file', 'download %n files', 0)
).toEqual('download 0 files');
@@ -94,10 +97,12 @@ describe('OC.L10N tests', function() {
).toEqual('download 1024 files');
});
it('generates plural with default function when no forms specified', function() {
+ spyOn(console, 'warn');
OC.L10N.register(TEST_APP, {
'_download %n file_::_download %n files_':
['%n Datei herunterladen', '%n Dateien herunterladen']
});
+ expect(console.warn).toHaveBeenCalled();
checkPlurals();
});
it('generates plural with generated function when forms is specified', function() {
@@ -150,9 +155,11 @@ describe('OC.L10N tests', function() {
it('calls callback if translation already available', function() {
var promiseStub = sinon.stub();
var callbackStub = sinon.stub();
+ spyOn(console, 'warn');
OC.L10N.register(TEST_APP, {
'Hello world!': 'Hallo Welt!'
});
+ expect(console.warn).toHaveBeenCalled();
OC.L10N.load(TEST_APP, callbackStub).then(promiseStub);
expect(callbackStub.calledOnce).toEqual(true);
expect(promiseStub.calledOnce).toEqual(true);
diff --git a/tests/karma.config.js b/tests/karma.config.js
index afb1fa81463..c499451c7dc 100644
--- a/tests/karma.config.js
+++ b/tests/karma.config.js
@@ -220,11 +220,15 @@ module.exports = function(config) {
// serve images to avoid warnings
files.push({pattern: 'core/img/**/*', watched: false, included: false, served: true});
+ files.push({pattern: 'core/css/images/*', watched: false, included: false, served: true});
// include core CSS
files.push({pattern: 'core/css/*.css', watched: true, included: true, served: true});
files.push({pattern: 'tests/css/*.css', watched: true, included: true, served: true});
+ // Allow fonts
+ files.push({pattern: 'core/fonts/*', watched: false, included: false, served: true});
+
config.set({
// base path, that will be used to resolve files and exclude
@@ -245,8 +249,9 @@ module.exports = function(config) {
// prevent warnings for images
'/base/tests/img/': 'http://localhost:9876/base/core/img/',
'/base/tests/css/': 'http://localhost:9876/base/core/css/',
+ '/base/core/css/images/': 'http://localhost:9876/base/core/css/images/',
'/actions/': 'http://localhost:9876/base/core/img/actions/',
- '/context.html//core/fonts/': 'http://localhost:9876/base/core/fonts/'
+ '/base/core/fonts/': 'http://localhost:9876/base/core/fonts/'
},
// test results reporter to use
@@ -267,7 +272,7 @@ module.exports = function(config) {
reporters: [
{ type: 'html' },
{ type: 'cobertura' },
- { type: 'lcovonly' },
+ { type: 'lcovonly' }
]
},