function (bundle) {
return bundle
.require('react', { expose: 'react' })
+ .require('react-dom', { expose: 'react-dom' })
.require('backbone', { expose: 'backbone' })
.require('backbone.marionette', { expose: 'backbone.marionette' })
.require('moment/min/moment-with-locales', { expose: 'moment' });
function (bundle) {
return bundle
.external('react')
+ .external('react-dom')
.external('backbone')
.external('backbone.marionette')
.external('moment');
function (bundle) {
return bundle
.external('react')
+ .external('react-dom')
.external('backbone')
.external('backbone.marionette')
.require('moment/min/moment-with-locales', { expose: 'moment' })
.pipe(gulpif(production, buffer()))
.pipe(gulpif(production, uglify()))
.pipe(gulp.dest(path.join(output, 'js')));
-};
\ No newline at end of file
+};
"jsdom": "6.5.1",
"mocha": "2.3.3",
"moment": "2.10.6",
- "react": "0.13.3",
+ "react": "^0.14.0",
+ "react-addons-test-utils": "^0.14.0",
+ "react-dom": "^0.14.0",
"sinon": "1.15.4",
"sinon-chai": "2.8.0",
"underscore": "1.8.3",
import React from 'react';
+import ReactDOM from 'react-dom';
import Main from './main';
window.sonarqube.appStarted.then(options => {
let el = document.querySelector(options.el);
- React.render(<Main options={options}/>, el);
+ ReactDOM.render(<Main options={options}/>, el);
});
onDateChange(newDate) {
if (newDate === DATE.CUSTOM) {
- let minDateRaw = React.findDOMNode(this.refs.minDate).value,
- maxDateRaw = React.findDOMNode(this.refs.maxDate).value,
+ let minDateRaw = this.refs.minDate.value,
+ maxDateRaw = this.refs.maxDate.value,
minDate = moment(minDateRaw, DATE_FORMAT, true),
maxDate = moment(maxDateRaw, DATE_FORMAT, true);
this.props.onDateChange(newDate,
onSelect: this.onDateInputChange
};
if ($.fn.datepicker) {
- $(React.findDOMNode(this.refs.minDate)).datepicker(opts);
- $(React.findDOMNode(this.refs.maxDate)).datepicker(opts);
+ $(this.refs.minDate).datepicker(opts);
+ $(this.refs.maxDate).datepicker(opts);
}
},
},
onSearch() {
- let searchInput = React.findDOMNode(this.refs.searchInput),
+ let searchInput = this.refs.searchInput,
query = searchInput.value;
this.props.onSearch(query);
},
import React from 'react';
+import ReactDOM from 'react-dom';
import Main from './main';
import '../../helpers/handlebars-helpers';
window.sonarqube.appStarted.then(options => {
var el = document.querySelector(options.el);
- React.render(<Main/>, el);
+ ReactDOM.render(<Main/>, el);
});
import $ from 'jquery';
import _ from 'underscore';
import React from 'react';
+import ReactDOM from 'react-dom';
import { Overview } from './main';
class App {
_.extend(opts.component, options.component);
$('html').toggleClass('dashboard-page', opts.component.hasSnapshot);
let el = document.querySelector(opts.el);
- React.render(<Overview {...opts}/>, el);
+ ReactDOM.render(<Overview {...opts}/>, el);
}
}
}
handleMetricChange () {
- let metric = React.findDOMNode(this.refs.metricSelect).value;
+ let metric = this.refs.metricSelect.value;
this.setState({ currentMetric: metric }, this.requestTimeMachineData);
}
import React from 'react';
+import ReactDOM from 'react-dom';
import Main from './main';
import '../../helpers/handlebars-helpers';
window.sonarqube.appStarted.then(options => {
var el = document.querySelector(options.el);
- React.render(<Main topQualifiers={options.rootQualifiers}/>, el);
+ ReactDOM.render(<Main topQualifiers={options.rootQualifiers}/>, el);
});
return (
<td key={p.key}>
<table>
+ <tbody>
<tr>
<td className="spacer-right">Users</td>
<td className="spacer-left bordered-left">{p.usersCount}</td>
data-toggle="tooltip" href="#"></a>
</td>
</tr>
+ </tbody>
</table>
</td>
);
import $ from 'jquery';
import React from 'react';
+import ReactDOM from 'react-dom';
import Main from './main';
import '../../helpers/handlebars-helpers';
window.sonarqube.appStarted.then(options => {
requestPermissionTemplates().done(r => {
var el = document.querySelector(options.el);
- React.render(<Main permissionTemplates={r.permissionTemplates} componentId={options.componentId}/>, el);
+ ReactDOM.render(<Main permissionTemplates={r.permissionTemplates} componentId={options.componentId}/>, el);
});
});
return (
<td key={p.key}>
<table>
+ <tbody>
<tr>
<td className="spacer-right">Users</td>
<td className="spacer-left bordered-left">{p.usersCount}</td>
data-toggle="tooltip" href="#"></a>
</td>
</tr>
+ </tbody>
</table>
</td>
);
},
search() {
- let q = React.findDOMNode(this.refs.input).value;
+ let q = this.refs.input.value;
this.props.search(q);
},
import React from 'react';
+import ReactDOM from 'react-dom';
import Main from './main';
import {getCurrentUser} from '../../api/users';
import '../../helpers/handlebars-helpers';
let el = document.querySelector(options.el),
hasProvisionPermission = user.permissions.global.indexOf('provisioning') !== -1,
topLevelQualifiers = options.rootQualifiers;
- React.render(<Main hasProvisionPermission={hasProvisionPermission}
+ ReactDOM.render(<Main hasProvisionPermission={hasProvisionPermission}
topLevelQualifiers={topLevelQualifiers}/>, el);
});
});
},
search() {
- let q = React.findDOMNode(this.refs.input).value;
+ let q = this.refs.input.value;
this.props.onSearch(q);
},
return (
<div className="panel panel-vertical bordered-bottom spacer-bottom">
<table className="data">
+ <tbody>
<tr>
<td className="thin text-middle">
{this.renderCheckbox()}
</button>
</td>
</tr>
+ </tbody>
</table>
{this.renderGhostsDescription()}
</div>
import React from 'react';
+import ReactDOM from 'react-dom';
import Main from './main';
window.sonarqube.appStarted.then(options => {
var el = document.querySelector(options.el);
- React.render(<Main/>, el);
+ ReactDOM.render(<Main/>, el);
});
},
onChange() {
- let newValue = React.findDOMNode(this.refs.select).value;
+ let newValue = this.refs.select.value;
setLogLevel(newValue).then(() => {
this.setState({ level: newValue });
});
<td><ItemValue value={this.props.value[key]}/></td>
</tr>;
});
- return <table className="data">{rows}</table>;
+ return <table className="data"><tbody>{rows}</tbody></table>;
}
});
import React from 'react';
+import ReactDOM from 'react-dom';
export const ResizeMixin = {
componentDidMount () {
},
handleResize () {
- let boundingClientRect = React.findDOMNode(this).parentNode.getBoundingClientRect();
+ let boundingClientRect = ReactDOM.findDOMNode(this).parentNode.getBoundingClientRect();
let newWidth = this.props.width || boundingClientRect.width;
let newHeight = this.props.height || boundingClientRect.height;
this.setState({ width: newWidth, height: newHeight });
import $ from 'jquery';
import React from 'react';
+import ReactDOM from 'react-dom';
export const TooltipsMixin = {
componentDidMount () {
initTooltips () {
if ($.fn.tooltip) {
- $('[data-toggle="tooltip"]', React.findDOMNode(this))
+ $('[data-toggle="tooltip"]', ReactDOM.findDOMNode(this))
.tooltip({ container: 'body', placement: 'bottom', html: true });
}
}
},
search() {
- let query = React.findDOMNode(this.refs.search).value;
+ let query = this.refs.search.value;
this.props.search(query);
},
import React from 'react';
+import ReactDOM from 'react-dom';
import GlobalNav from './global/global-nav';
import ComponentNav from './component/component-nav';
import SettingsNav from './settings/settings-nav';
return getGlobalNavigation().then(r => {
const el = document.getElementById('global-navigation');
if (el) {
- React.render(<GlobalNav {...options} {...r}/>, el);
+ ReactDOM.render(<GlobalNav {...options} {...r}/>, el);
}
return r;
});
return getComponentNavigation(options.componentKey).then(r => {
const el = document.getElementById('context-navigation');
if (el) {
- React.render(<ComponentNav component={r} conf={r.configuration || {}}/>, el);
+ ReactDOM.render(<ComponentNav component={r} conf={r.configuration || {}}/>, el);
}
return r;
});
return getSettingsNavigation().then(r => {
const el = document.getElementById('context-navigation');
if (el) {
- React.render(<SettingsNav {...options}/>, el);
+ ReactDOM.render(<SettingsNav {...options}/>, el);
}
return r;
});
import $ from 'jquery';
import _ from 'underscore';
import React from 'react';
+import ReactDOM from 'react-dom';
import {STATUSES} from '../../../apps/background-tasks/constants';
import {getTasksForComponent} from '../../../api/ce';
import ComponentNavFavorite from './component-nav-favorite';
},
initTooltips() {
- $('[data-toggle="tooltip"]', React.findDOMNode(this)).tooltip({
+ $('[data-toggle="tooltip"]', ReactDOM.findDOMNode(this)).tooltip({
container: 'body',
placement: 'bottom',
delay: { show: 0, hide: 1000 },
},
renderSearchView() {
- let searchContainer = React.findDOMNode(this.refs.container);
+ let searchContainer = this.refs.container;
this.searchView = new SearchView({
model: new Backbone.Model(this.props),
hide: this.closeSearch
},
onClickOutside(e) {
- if (!contains(React.findDOMNode(this.refs.dropdown), e.target)) {
+ if (!contains(this.refs.dropdown, e.target)) {
this.closeSearch();
}
},
/* eslint no-unused-expressions: 0 */
-import React from 'react/addons';
+import React from 'react';
+import ReactDOM from 'react-dom';
+import TestUtils from 'react-addons-test-utils';
+
import Header from '../../src/main/js/apps/background-tasks/header';
import Stats from '../../src/main/js/apps/background-tasks/stats';
import Search from '../../src/main/js/apps/background-tasks/search';
import {STATUSES, CURRENTS, DEBOUNCE_DELAY} from '../../src/main/js/apps/background-tasks/constants';
import {formatDuration} from '../../src/main/js/apps/background-tasks/helpers';
-let TestUtils = React.addons.TestUtils;
let chai = require('chai');
let expect = chai.expect;
let sinon = require('sinon');
onCurrentsChange={spy}
onDateChange={spy}
onSearch={searchSpy}/>);
- let searchInput = React.findDOMNode(TestUtils.findRenderedDOMComponentWithClass(component, 'search-box-input'));
+ let searchInput = ReactDOM.findDOMNode(TestUtils.findRenderedDOMComponentWithClass(component, 'search-box-input'));
searchInput.value = 'some search query';
TestUtils.Simulate.change(searchInput);
setTimeout(() => {
onCurrentsChange={spy}
onDateChange={spy}
refresh={reloadSpy}/>);
- let reloadButton = React.findDOMNode(component.refs.reloadButton);
+ let reloadButton = component.refs.reloadButton;
expect(reloadSpy).to.not.have.been.called;
TestUtils.Simulate.click(reloadButton);
expect(reloadSpy).to.have.been.called;
describe('Pending', () => {
it('should show zero pending', () => {
let result = TestUtils.renderIntoDocument(<Stats pendingCount="0"/>),
- pendingCounter = React.findDOMNode(result.refs.pendingCount);
+ pendingCounter = result.refs.pendingCount;
expect(pendingCounter.textContent).to.contain('0');
});
it('should show 5 pending', () => {
let result = TestUtils.renderIntoDocument(<Stats pendingCount="5"/>),
- pendingCounter = React.findDOMNode(result.refs.pendingCount);
+ pendingCounter = result.refs.pendingCount;
expect(pendingCounter.textContent).to.contain('5');
});
it('should not show cancel pending button', () => {
let result = TestUtils.renderIntoDocument(<Stats pendingCount="0"/>),
- cancelPending = React.findDOMNode(result.refs.cancelPending);
+ cancelPending = result.refs.cancelPending;
expect(cancelPending).to.not.be.ok;
});
it('should show cancel pending button', () => {
let result = TestUtils.renderIntoDocument(<Stats pendingCount="5"/>),
- cancelPending = React.findDOMNode(result.refs.cancelPending);
+ cancelPending = result.refs.cancelPending;
expect(cancelPending).to.be.ok;
});
it('should trigger cancelling pending', () => {
let spy = sinon.spy();
let result = TestUtils.renderIntoDocument(<Stats pendingCount="5" cancelPending={spy}/>),
- cancelPending = React.findDOMNode(result.refs.cancelPending);
+ cancelPending = result.refs.cancelPending;
expect(spy).to.not.have.been.called;
TestUtils.Simulate.click(cancelPending);
expect(spy).to.have.been.called;
describe('Failures', () => {
it('should show zero failures', () => {
let result = TestUtils.renderIntoDocument(<Stats failuresCount="0"/>),
- failureCounter = React.findDOMNode(result.refs.failureCount);
+ failureCounter = result.refs.failureCount;
expect(failureCounter.textContent).to.contain('0');
});
it('should show 5 failures', () => {
let result = TestUtils.renderIntoDocument(<Stats failuresCount="5"/>),
- failureCounter = React.findDOMNode(result.refs.failureCount);
+ failureCounter = result.refs.failureCount;
expect(failureCounter.textContent).to.contain('5');
});
it('should not show link to failures', () => {
let result = TestUtils.renderIntoDocument(<Stats failuresCount="0"/>),
- failureCounter = React.findDOMNode(result.refs.failureCount);
+ failureCounter = result.refs.failureCount;
expect(failureCounter.tagName.toLowerCase()).to.not.equal('a');
});
it('should show link to failures', () => {
let result = TestUtils.renderIntoDocument(<Stats failuresCount="5"/>),
- failureCounter = React.findDOMNode(result.refs.failureCount);
+ failureCounter = result.refs.failureCount;
expect(failureCounter.tagName.toLowerCase()).to.equal('a');
});
it('should trigger filtering failures', () => {
let spy = sinon.spy();
let result = TestUtils.renderIntoDocument(<Stats failuresCount="5" showFailures={spy}/>),
- failureCounter = React.findDOMNode(result.refs.failureCount);
+ failureCounter = result.refs.failureCount;
expect(spy).to.not.have.been.called;
TestUtils.Simulate.click(failureCounter);
expect(spy).to.have.been.called;
describe('In Progress Duration', () => {
it('should show duration', () => {
let result = TestUtils.renderIntoDocument(<Stats inProgressDuration="173"/>),
- inProgressDuration = React.findDOMNode(result.refs.inProgressDuration);
+ inProgressDuration = result.refs.inProgressDuration;
expect(inProgressDuration.textContent).to.include('173ms');
});
it('should format duration', () => {
let result = TestUtils.renderIntoDocument(<Stats inProgressDuration="1073"/>),
- inProgressDuration = React.findDOMNode(result.refs.inProgressDuration);
+ inProgressDuration = result.refs.inProgressDuration;
expect(inProgressDuration.textContent).to.include('1s');
});
it('should not show duration', () => {
let result = TestUtils.renderIntoDocument(<Stats/>),
- inProgressDuration = React.findDOMNode(result.refs.inProgressDuration);
+ inProgressDuration = result.refs.inProgressDuration;
expect(inProgressDuration).to.not.be.ok;
});
});
/* eslint no-unused-expressions: 0 */
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+
import Defaults from '../../src/main/js/apps/permission-templates/permission-template-defaults';
import SetDefaults from '../../src/main/js/apps/permission-templates/permission-template-set-defaults';
-let TestUtils = React.addons.TestUtils;
let expect = require('chai').expect;
let sinon = require('sinon');
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+
import Projects from '../../src/main/js/apps/projects/projects';
-let TestUtils = React.addons.TestUtils;
let expect = require('chai').expect;
let sinon = require('sinon');
-import React from 'react/addons';
+import React from 'react';
+import ReactDOM from 'react-dom';
+import TestUtils from 'react-addons-test-utils';
+
import ItemValue from '../../src/main/js/apps/system/item-value';
-let TestUtils = React.addons.TestUtils;
let expect = require('chai').expect;
let sinon = require('sinon');
describe('Item Value', function () {
it('should render string', () => {
let result = TestUtils.renderIntoDocument(<ItemValue value="/some/path/as/an/example"/>);
- let content = React.findDOMNode(TestUtils.findRenderedDOMComponentWithTag(result, 'code'));
+ let content = ReactDOM.findDOMNode(TestUtils.findRenderedDOMComponentWithTag(result, 'code'));
expect(content.textContent).to.equal('/some/path/as/an/example');
});
it('should set initial value', () => {
let result = TestUtils.renderIntoDocument(<ItemValue value="DEBUG" name="Logs Level"/>);
- let select = React.findDOMNode(TestUtils.findRenderedDOMComponentWithTag(result, 'select'));
+ let select = ReactDOM.findDOMNode(TestUtils.findRenderedDOMComponentWithTag(result, 'select'));
expect(select.value).to.equal('DEBUG');
});
it('should change value', () => {
let result = TestUtils.renderIntoDocument(<ItemValue value="INFO" name="Logs Level"/>);
- let select = React.findDOMNode(TestUtils.findRenderedDOMComponentWithTag(result, 'select'));
+ let select = ReactDOM.findDOMNode(TestUtils.findRenderedDOMComponentWithTag(result, 'select'));
select.value = 'TRACE';
TestUtils.Simulate.change(select);
expect(fetchUrl).to.equal('/api/system/change_log_level');
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
import { expect } from 'chai';
import { BarChart } from '../../../src/main/js/components/charts/bar-chart';
-let TestUtils = React.addons.TestUtils;
-
-
describe('Bar Chart', function () {
it('should display bars', function () {
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
import { expect } from 'chai';
import { BubbleChart } from '../../../src/main/js/components/charts/bubble-chart';
-let TestUtils = React.addons.TestUtils;
-
-
describe('Bubble Chart', function () {
it('should display bubbles', function () {
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
import { expect } from 'chai';
import { LineChart } from '../../../src/main/js/components/charts/line-chart';
-let TestUtils = React.addons.TestUtils;
-
-
describe('Line Chart', function () {
it('should display line', function () {
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
import { expect } from 'chai';
import { Treemap } from '../../../src/main/js/components/charts/treemap';
-let TestUtils = React.addons.TestUtils;
-
-
describe('Treemap', function () {
it('should display', function () {
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
import { expect } from 'chai';
import { WordCloud } from '../../../src/main/js/components/charts/word-cloud';
-let TestUtils = React.addons.TestUtils;
-
-
describe('Word Cloud', function () {
it('should display', function () {
-import React from 'react/addons';
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
import ComponentNavBreadcrumbs from '../src/main/js/main/nav/component/component-nav-breadcrumbs';
-let TestUtils = React.addons.TestUtils;
+
let expect = require('chai').expect;
+
describe('Nav', function () {
describe('ComponentNavBreadcrumbs', () => {
- it('should not render unless `props.breadcrumbs`', function () {
- var result = React.renderToStaticMarkup(React.createElement(ComponentNavBreadcrumbs, null));
- expect(result).to.equal('<noscript></noscript>');
- });
-
it('should not render breadcrumbs with one element', function () {
var breadcrumbs = [
{ key: 'my-project', name: 'My Project', qualifier: 'TRK' }