From f3a77c7d997056fd166d500a7c855288e4adf163 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Oct 2015 08:32:37 +0200 Subject: Add js tests for empty content page --- settings/tests/js/appsSpec.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'settings/tests') diff --git a/settings/tests/js/appsSpec.js b/settings/tests/js/appsSpec.js index d6558746373..d2ca1fb5c8b 100644 --- a/settings/tests/js/appsSpec.js +++ b/settings/tests/js/appsSpec.js @@ -24,6 +24,7 @@ describe('OC.Settings.Apps tests', function() { beforeEach(function() { var $el = $('
' + + '' + '
' + // dummy template for testing '
{{name}}
' + @@ -66,15 +67,26 @@ describe('OC.Settings.Apps tests', function() { ]); }); - it('does not filter when no query passed', function() { - Apps.filter(''); - expect(getResultsFromDom().length).toEqual(4); - }); it('returns no results when query does not match anything', function() { + expect(getResultsFromDom().length).toEqual(4); + expect($('#apps-list:not(.hidden)').length).toEqual(1); + expect($('#apps-list-empty:not(.hidden)').length).toEqual(0); + Apps.filter('absurdity'); expect(getResultsFromDom().length).toEqual(0); + expect($('#apps-list:not(.hidden)').length).toEqual(0); + expect($('#apps-list-empty:not(.hidden)').length).toEqual(1); + + Apps.filter(''); + expect(getResultsFromDom().length).toEqual(4); + expect($('#apps-list:not(.hidden)').length).toEqual(1); + expect($('#apps-list-empty:not(.hidden)').length).toEqual(0); + expect(getResultsFromDom().length).toEqual(4); }); it('returns relevant results when query matches name', function() { + expect($('#apps-list:not(.hidden)').length).toEqual(1); + expect($('#apps-list-empty:not(.hidden)').length).toEqual(0); + var results; Apps.filter('app'); results = getResultsFromDom(); @@ -82,6 +94,9 @@ describe('OC.Settings.Apps tests', function() { expect(results[0]).toEqual('appone'); expect(results[1]).toEqual('apptwo'); expect(results[2]).toEqual('appthree'); + + expect($('#apps-list:not(.hidden)').length).toEqual(1); + expect($('#apps-list-empty:not(.hidden)').length).toEqual(0); }); it('returns relevant result when query matches name', function() { var results; -- cgit v1.2.3