diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-05-19 18:26:36 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-06-03 16:09:08 +0200 |
commit | 364cd42b9bb92eb42f0adce613185e0bb8771672 (patch) | |
tree | 4161fb41affa5ff3c6871959e302192e615116a9 /server/sonar-web/src/main/js/apps/projects/__tests__ | |
parent | 2ecead20c72c9348966fb7605e81df637b429e83 (diff) | |
download | sonarqube-364cd42b9bb92eb42f0adce613185e0bb8771672.tar.gz sonarqube-364cd42b9bb92eb42f0adce613185e0bb8771672.zip |
move tests
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/__tests__')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projects/__tests__/projects-test.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/__tests__/projects-test.js b/server/sonar-web/src/main/js/apps/projects/__tests__/projects-test.js new file mode 100644 index 00000000000..51f0ba2945c --- /dev/null +++ b/server/sonar-web/src/main/js/apps/projects/__tests__/projects-test.js @@ -0,0 +1,54 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import React from 'react'; +import TestUtils from 'react-addons-test-utils'; +import { expect } from 'chai'; +import sinon from 'sinon'; + +import Projects from '../projects'; + +describe('Projects', function () { + describe('Projects', () => { + it('should render list of projects with no selection', () => { + const projects = [ + { id: '1', key: 'a', name: 'A', qualifier: 'TRK' }, + { id: '2', key: 'b', name: 'B', qualifier: 'TRK' } + ]; + + const result = TestUtils.renderIntoDocument( + <Projects projects={projects} selection={[]} refresh={sinon.spy()}/>); + expect(TestUtils.scryRenderedDOMComponentsWithTag(result, 'tr')).to.have.length(2); + expect(TestUtils.scryRenderedDOMComponentsWithClass(result, 'icon-checkbox-checked')).to.be.empty; + }); + + it('should render list of projects with one selected', () => { + const projects = [ + { id: '1', key: 'a', name: 'A', qualifier: 'TRK' }, + { id: '2', key: 'b', name: 'B', qualifier: 'TRK' } + ]; + const selection = ['1']; + + const result = TestUtils.renderIntoDocument( + <Projects projects={projects} selection={selection} refresh={sinon.spy()}/>); + expect(TestUtils.scryRenderedDOMComponentsWithTag(result, 'tr')).to.have.length(2); + expect(TestUtils.scryRenderedDOMComponentsWithClass(result, 'icon-checkbox-checked')).to.have.length(1); + }); + }); +}); |