aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/tests
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-30 16:22:18 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-30 16:22:26 +0200
commitfafae1e8626571fdb1fdbd1a25dcb5f4fdb117d7 (patch)
treef0126647e1207dacd89b1f0cd56d8d004d9f8f71 /server/sonar-web/tests
parent0a325ad503de115158a31306f69d65cf0a06b167 (diff)
downloadsonarqube-fafae1e8626571fdb1fdbd1a25dcb5f4fdb117d7.tar.gz
sonarqube-fafae1e8626571fdb1fdbd1a25dcb5f4fdb117d7.zip
add web tests
Diffstat (limited to 'server/sonar-web/tests')
-rw-r--r--server/sonar-web/tests/apps/permission-templates-test.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/server/sonar-web/tests/apps/permission-templates-test.js b/server/sonar-web/tests/apps/permission-templates-test.js
index d7cc02fdf8b..b79adde98a5 100644
--- a/server/sonar-web/tests/apps/permission-templates-test.js
+++ b/server/sonar-web/tests/apps/permission-templates-test.js
@@ -4,8 +4,8 @@ import Defaults from '../../src/main/js/apps/permission-templates/permission-tem
import SetDefaults from '../../src/main/js/apps/permission-templates/permission-template-set-defaults';
let TestUtils = React.addons.TestUtils;
-let chai = require('chai');
-let expect = chai.expect;
+let expect = require('chai').expect;
+let sinon = require('sinon');
describe('Permission Templates', function () {
describe('Defaults', () => {
@@ -29,6 +29,16 @@ describe('Permission Templates', function () {
expect(TestUtils.scryRenderedDOMComponentsWithClass(result, 'icon-qualifier-vw')).to.have.length(1);
});
+ it('should not display qualifiers', () => {
+ let permissionTemplate = { defaultFor: [] },
+ topQualifiers = ['TRK', 'VW'];
+ let result = TestUtils.renderIntoDocument(
+ <Defaults permissionTemplate={permissionTemplate} topQualifiers={topQualifiers}/>
+ );
+ expect(TestUtils.scryRenderedDOMComponentsWithClass(result, 'icon-qualifier-trk')).to.be.empty;
+ expect(TestUtils.scryRenderedDOMComponentsWithClass(result, 'icon-qualifier-vw')).to.be.empty;
+ });
+
it('should omit "project" if there is only one qualifier', () => {
let permissionTemplate = { defaultFor: ['TRK'] },
topQualifiers = ['TRK'];
@@ -40,7 +50,7 @@ describe('Permission Templates', function () {
});
describe('SetDefaults', () => {
- var refresh = function () {};
+ var refresh = sinon.spy();
it('should display a dropdown with one option', () => {
let permissionTemplate = { defaultFor: ['VW'] },