From 5efc832bc0b873c2e2030bc4f88861e0f862f75b Mon Sep 17 00:00:00 2001 From: Mauro Bartolomeoli Date: Thu, 23 Feb 2017 15:28:15 +0100 Subject: [PATCH] Fixes #934: react migrated to 15.4.2 --- package.json | 22 +-- web/client/components/I18N/Localized.jsx | 2 +- .../I18N/__tests__/18N.HTML-test.jsx | 2 +- .../I18N/__tests__/FlagButton-test.jsx | 2 +- .../I18N/__tests__/LangBar-test.jsx | 5 +- .../I18N/__tests__/LangSelector-test.jsx | 5 +- .../I18N/__tests__/Localized-test.jsx | 2 +- .../TOC/__tests__/DefaultGroup-test.jsx | 5 +- .../TOC/__tests__/DefaultLayer-test.jsx | 6 +- .../components/TOC/__tests__/Node-test.jsx | 2 +- .../components/TOC/__tests__/TOC-test.jsx | 2 +- .../__tests__/BackgroundSwitcher-test.jsx | 5 +- .../__tests__/GroupChildren-test.jsx | 2 +- .../fragments/__tests__/WMSLegend-test.jsx | 2 +- .../legend/__tests__/Legend-test.jsx | 5 +- .../settings/__tests__/Display-test.jsx | 2 +- .../settings/__tests__/General-test.jsx | 2 +- .../settings/__tests__/WMSStyle-test.jsx | 2 +- web/client/components/app/StandardRouter.jsx | 2 +- .../app/__tests__/StandardApp-test.jsx | 2 +- .../app/__tests__/StandardRouter-test.jsx | 3 +- .../buttons/__tests__/ImageButton-test.jsx | 2 +- .../buttons/__tests__/InfoButton-test.jsx | 39 +---- .../buttons/__tests__/ToggleButton-test.jsx | 9 +- .../buttons/__tests__/ZoomButton-test.jsx | 8 +- .../__tests__/ZoomToMaxExtentButton-test.jsx | 8 +- .../catalog/__tests__/RecordGrid-test.jsx | 4 +- .../catalog/__tests__/RecordItem-test.jsx | 4 +- .../__tests__/FeatureGrid-test.jsx | 2 +- .../identify/__tests__/DefaultViewer-test.jsx | 14 +- .../identify/__tests__/GeocodeViewer-test.jsx | 5 +- .../data/identify/__tests__/Identify-test.jsx | 120 +++++++++++--- .../viewers/__tests__/viewers-test.jsx | 2 +- .../row/__tests__/PropertiesViewer-test.jsx | 7 +- .../data/query/__tests__/ComboField-test.jsx | 5 +- .../data/query/__tests__/DateField-test.jsx | 4 +- .../data/query/__tests__/FilterField-test.jsx | 10 +- .../data/query/__tests__/NumberField-test.jsx | 2 +- .../__tests__/SimpleFilterFiled-test.jsx | 2 +- .../data/query/__tests__/TextField-test.jsx | 2 +- .../template/jsx/__tests__/Template-test.jsx | 10 +- .../help/__tests__/HelpBadge-test.jsx | 6 +- .../help/__tests__/HelpTextPanel-test.jsx | 2 +- .../help/__tests__/HelpToggleBtn-test.jsx | 2 +- .../help/__tests__/HelpWrapper-test.jsx | 2 +- .../__tests__/ActiveRuleModal-test.jsx | 2 +- .../__tests__/RuleAttributeSelect-test.jsx | 2 +- .../__tests__/RuleAttributes-test.jsx | 2 +- .../rulesmanager/__tests__/RuleTable-test.jsx | 2 +- .../__tests__/RuleTableControls-test.jsx | 2 +- .../__tests__/RuleTablePagination-test.jsx | 2 +- .../__tests__/RuleTablePanel-test.jsx | 2 +- .../__tests__/RulesFiltersPanel-test.jsx | 2 +- .../__tests__/RulesManager-test.jsx | 2 +- .../cesium/__tests__/Layer-test-chrome.jsx | 36 ++-- .../map/cesium/__tests__/Map-test-chrome.jsx | 22 ++- .../leaflet/__tests__/DrawSupport-test.jsx | 61 ++++--- .../HighlightFeatureSupport-test.jsx | 4 +- .../map/leaflet/__tests__/Layer-test.jsx | 24 ++- .../map/leaflet/__tests__/Locate-test.jsx | 2 +- .../map/leaflet/__tests__/Map-test.jsx | 27 ++- .../__tests__/MeasurementSupport-test.jsx | 155 +++++++++++------- .../map/leaflet/__tests__/Overview-test.jsx | 2 +- .../map/leaflet/__tests__/ScaleBar-test.jsx | 2 +- .../snapshot/__tests__/GrabMap-test.jsx | 6 +- .../snapshot/__tests__/Preview-test.jsx | 6 +- .../HighlightFeatureSupport-test.jsx | 8 +- .../map/openlayers/__tests__/Layer-test.jsx | 50 +++--- .../map/openlayers/__tests__/Locate-test.jsx | 2 +- .../map/openlayers/__tests__/Map-test.jsx | 56 +++++-- .../__tests__/MeasurementSupport-test.jsx | 52 +++--- .../openlayers/__tests__/Overview-test.jsx | 2 +- .../openlayers/__tests__/ScaleBar-test.jsx | 2 +- .../snapshot/__tests__/GrabMap-test.jsx | 14 +- .../snapshot/__tests__/Preview-test.jsx | 10 +- .../Snapshot/__tests__/SnapshotPanel-test.jsx | 6 +- .../locate/__tests__/LocateBtn-test.jsx | 2 +- .../__tests__/MeasureComponent-test.jsx | 78 ++++----- .../mouseposition/MousePositionLabelDM.jsx | 4 +- .../mouseposition/MousePositionLabelDMS.jsx | 6 +- .../mouseposition/MousePositionLabelDMSNW.jsx | 6 +- .../__tests__/CRSSelector-test.js | 6 +- .../__tests__/MousePosition-test.js | 2 +- .../__tests__/HistoryBar-test.jsx | 2 +- .../scale/__tests__/ScaleBox-test.jsx | 6 +- .../search/__tests__/SearchBar-test.jsx | 58 ++++--- .../__tests__/NominatimResult-test.jsx | 5 +- .../__tests__/NominatimResultList-test.jsx | 5 +- .../maps/__tests__/MapCard-test.jsx | 4 +- .../maps/__tests__/MapGrid-test.jsx | 2 +- .../maps/__tests__/MapItem-test.jsx | 4 +- .../maps/__tests__/MapList-test.jsx | 2 +- .../misc/__tests__/ConfirmDialog-test.jsx | 2 +- .../FeatureInfoFormatSelector-test.jsx | 6 +- .../misc/__tests__/GridCard-test.jsx | 4 +- .../misc/__tests__/HtmlRenderer-test.jsx | 2 +- .../misc/__tests__/LinkToPage-test.jsx | 2 +- .../misc/__tests__/PaginationToolbar-test.jsx | 3 +- .../__tests__/GlobalSpinner-test.jsx | 2 +- .../__tests__/InlineSpinner-test.jsx | 2 +- .../print/__tests__/Choice-test.jsx | 2 +- .../components/print/__tests__/Font-test.jsx | 2 +- .../print/__tests__/MapPreview-test.jsx | 2 +- .../print/__tests__/PrintOption-test.jsx | 2 +- .../print/__tests__/PrintOptions-test.jsx | 2 +- .../print/__tests__/PrintPreview-test.jsx | 2 +- .../print/__tests__/PrintSubmit-test.jsx | 2 +- .../components/print/__tests__/Sheet-test.jsx | 2 +- .../style/__tests__/ScaleDenominator-test.jsx | 2 +- web/client/examples/mouseposition/app.jsx | 5 +- .../examples/print/containers/Print.jsx | 2 +- 111 files changed, 684 insertions(+), 476 deletions(-) diff --git a/package.json b/package.json index 26305de3d5..c328d42ea0 100644 --- a/package.json +++ b/package.json @@ -47,9 +47,9 @@ "ncp": "2.0.0", "parallelshell": "1.2.0", "raw-loader": "0.5.1", - "react-addons-css-transition-group": "0.14.8", - "react-addons-test-utils": "0.14.8", - "react-hot-loader": "1.3.0", + "react-addons-css-transition-group": "15.4.2", + "react-addons-test-utils": "15.4.2", + "react-hot-loader": "1.3.1", "react-motion": "0.4.4", "react-router": "2.4.0", "react-router-redux": "2.1.0", @@ -100,23 +100,23 @@ "lodash.castarray": "4.4.0", "moment": "2.13.0", "node-uuid": "1.4.3", - "object-assign": "3.0.0", + "object-assign": "4.1.1", "ogc-schemas": "2.6.1", "openlayers": "3.15.1", "pdfviewer": "0.3.2", "proj4": "2.3.14", "qrcode.react": "0.6.1", - "react": "0.14.8", - "react-addons-shallow-compare": "0.14.8", + "react": "15.4.2", + "react-addons-shallow-compare": "15.4.2", "react-bootstrap": "0.28.1", "react-codemirror": "0.2.6", "react-color": "2.4.0", "react-confirm-button": "0.0.2", "react-copy-to-clipboard": "4.1.0", - "react-dnd": "2.1.3", - "react-dnd-html5-backend": "2.1.2", + "react-dnd": "2.2.3", + "react-dnd-html5-backend": "2.2.3", "react-dock": "0.2.3", - "react-dom": "0.14.8", + "react-dom": "15.4.2", "react-draggable": "1.3.4", "react-dropzone": "3.4.0", "react-intl": "2.2.3", @@ -129,10 +129,10 @@ "react-selectize": "2.0.3", "react-share": "1.8.0", "react-sidebar": "2.1.2", - "react-sortable-items": "0.0.12", + "react-sortable-items": "https://github.com/geosolutions-it/react-sortable-items/tarball/react15", "react-spinkit": "1.1.6", "react-swipeable-views": "0.6.3", - "react-widgets": "3.1.7", + "react-widgets": "3.4.6", "redux": "3.6.0", "redux-logger": "2.6.1", "redux-observable": "0.13.0", diff --git a/web/client/components/I18N/Localized.jsx b/web/client/components/I18N/Localized.jsx index c789ee66ca..22a6086960 100644 --- a/web/client/components/I18N/Localized.jsx +++ b/web/client/components/I18N/Localized.jsx @@ -28,7 +28,7 @@ const Localized = React.createClass({ render() { let { children } = this.props; - if (this.props.messages) { + if (this.props.messages && this.props.locale) { if (typeof children === 'function') { children = children(); } diff --git a/web/client/components/I18N/__tests__/18N.HTML-test.jsx b/web/client/components/I18N/__tests__/18N.HTML-test.jsx index de73677acb..8f6e52c529 100644 --- a/web/client/components/I18N/__tests__/18N.HTML-test.jsx +++ b/web/client/components/I18N/__tests__/18N.HTML-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var I18N = require('../I18N'); var Localized = require('../Localized'); diff --git a/web/client/components/I18N/__tests__/FlagButton-test.jsx b/web/client/components/I18N/__tests__/FlagButton-test.jsx index 884edf67de..945c9e3505 100644 --- a/web/client/components/I18N/__tests__/FlagButton-test.jsx +++ b/web/client/components/I18N/__tests__/FlagButton-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var FlagButton = require('../FlagButton'); diff --git a/web/client/components/I18N/__tests__/LangBar-test.jsx b/web/client/components/I18N/__tests__/LangBar-test.jsx index 5cdc2786f6..27cf68a866 100644 --- a/web/client/components/I18N/__tests__/LangBar-test.jsx +++ b/web/client/components/I18N/__tests__/LangBar-test.jsx @@ -7,10 +7,11 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var LangBar = require('../LangBar'); var LocaleUtils = require('../../../utils/LocaleUtils'); +const TestUtils = require('react-addons-test-utils'); describe('LangBar', () => { beforeEach((done) => { @@ -45,7 +46,7 @@ describe('LangBar', () => { const select = cmpDom.getElementsByTagName("button").item(0); select.value = "it-IT"; - React.addons.TestUtils.Simulate.click(select, {target: {value: 'it-IT'}}); + TestUtils.Simulate.click(select, {target: {value: 'it-IT'}}); // select.children[1].click(); expect(newLang).toBe('it-IT'); diff --git a/web/client/components/I18N/__tests__/LangSelector-test.jsx b/web/client/components/I18N/__tests__/LangSelector-test.jsx index fca11c66c0..a438e704f4 100644 --- a/web/client/components/I18N/__tests__/LangSelector-test.jsx +++ b/web/client/components/I18N/__tests__/LangSelector-test.jsx @@ -7,9 +7,10 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var LangSelector = require('../LangSelector'); +const TestUtils = require('react-addons-test-utils'); describe('LangSelector', () => { beforeEach((done) => { @@ -53,7 +54,7 @@ describe('LangSelector', () => { const select = cmpDom.getElementsByTagName("select").item(0); select.value = "it-IT"; - React.addons.TestUtils.Simulate.change(select, {target: {value: 'it-IT'}}); + TestUtils.Simulate.change(select, {target: {value: 'it-IT'}}); // select.children[1].click(); expect(newLang).toBe('it-IT'); diff --git a/web/client/components/I18N/__tests__/Localized-test.jsx b/web/client/components/I18N/__tests__/Localized-test.jsx index b0841f3b08..341330ab25 100644 --- a/web/client/components/I18N/__tests__/Localized-test.jsx +++ b/web/client/components/I18N/__tests__/Localized-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var Localized = require('../Localized'); var Message = require('../Message'); diff --git a/web/client/components/TOC/__tests__/DefaultGroup-test.jsx b/web/client/components/TOC/__tests__/DefaultGroup-test.jsx index faa49fa34e..d77e970d97 100644 --- a/web/client/components/TOC/__tests__/DefaultGroup-test.jsx +++ b/web/client/components/TOC/__tests__/DefaultGroup-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var Group = require('../DefaultGroup'); @@ -51,12 +51,11 @@ describe('test Group module component', () => { const domNode = ReactDOM.findDOMNode(comp); expect(domNode).toExist(); - const children = domNode.children; expect(children.length).toBe(2); const container = children.item(0); - expect(container.children.length).toBe(2); + expect(container.children.length).toBe(1); }); it('test Group creation with filter', () => { diff --git a/web/client/components/TOC/__tests__/DefaultLayer-test.jsx b/web/client/components/TOC/__tests__/DefaultLayer-test.jsx index 51a7558e25..6e4111c99c 100644 --- a/web/client/components/TOC/__tests__/DefaultLayer-test.jsx +++ b/web/client/components/TOC/__tests__/DefaultLayer-test.jsx @@ -6,13 +6,13 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var Layer = require('../DefaultLayer'); // var ConfirmButton = require('../../buttons/ConfirmButton'); var expect = require('expect'); -const TestUtils = React.addons.TestUtils; +const TestUtils = require('react-addons-test-utils'); describe('test DefaultLayer module component', () => { beforeEach((done) => { @@ -104,7 +104,7 @@ describe('test DefaultLayer module component', () => { expect(checkbox).toExist(); checkbox.checked = !l.visibility; - React.addons.TestUtils.Simulate.change(checkbox, { + TestUtils.Simulate.change(checkbox, { target: { checked: !l.visibility } diff --git a/web/client/components/TOC/__tests__/Node-test.jsx b/web/client/components/TOC/__tests__/Node-test.jsx index a6df479d11..c68ca59fa0 100644 --- a/web/client/components/TOC/__tests__/Node-test.jsx +++ b/web/client/components/TOC/__tests__/Node-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var Node = require('../Node'); diff --git a/web/client/components/TOC/__tests__/TOC-test.jsx b/web/client/components/TOC/__tests__/TOC-test.jsx index 718aa85861..e2373c0bc4 100644 --- a/web/client/components/TOC/__tests__/TOC-test.jsx +++ b/web/client/components/TOC/__tests__/TOC-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var TOC = require('../TOC'); diff --git a/web/client/components/TOC/background/__tests__/BackgroundSwitcher-test.jsx b/web/client/components/TOC/background/__tests__/BackgroundSwitcher-test.jsx index e1b0fa55ef..fb64a65b94 100644 --- a/web/client/components/TOC/background/__tests__/BackgroundSwitcher-test.jsx +++ b/web/client/components/TOC/background/__tests__/BackgroundSwitcher-test.jsx @@ -7,11 +7,13 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var BackgroundSwitcher = require('../BackgroundSwitcher'); var {Thumbnail} = require('react-bootstrap'); +const TestUtils = require('react-addons-test-utils'); + describe("test the BakckgroundSwitcher", () => { beforeEach((done) => { document.body.innerHTML = '
'; @@ -53,7 +55,6 @@ describe("test the BakckgroundSwitcher", () => { }); it('test select handler', () => { - var TestUtils = React.addons.TestUtils; const testHandlers = { propertiesChangeHandler: (pressed) => {return pressed; } }; diff --git a/web/client/components/TOC/fragments/__tests__/GroupChildren-test.jsx b/web/client/components/TOC/fragments/__tests__/GroupChildren-test.jsx index bf55562d7e..6d4cb290f3 100644 --- a/web/client/components/TOC/fragments/__tests__/GroupChildren-test.jsx +++ b/web/client/components/TOC/fragments/__tests__/GroupChildren-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var GroupChildren = require('../GroupChildren'); var Node = require('../../Node'); diff --git a/web/client/components/TOC/fragments/__tests__/WMSLegend-test.jsx b/web/client/components/TOC/fragments/__tests__/WMSLegend-test.jsx index f08e6b9fba..0d887288a8 100644 --- a/web/client/components/TOC/fragments/__tests__/WMSLegend-test.jsx +++ b/web/client/components/TOC/fragments/__tests__/WMSLegend-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var WMSLegend = require('../WMSLegend'); diff --git a/web/client/components/TOC/fragments/legend/__tests__/Legend-test.jsx b/web/client/components/TOC/fragments/legend/__tests__/Legend-test.jsx index df3d3c4e7a..204eed1c33 100644 --- a/web/client/components/TOC/fragments/legend/__tests__/Legend-test.jsx +++ b/web/client/components/TOC/fragments/legend/__tests__/Legend-test.jsx @@ -7,10 +7,12 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var Legend = require('../Legend'); +const TestUtils = require('react-addons-test-utils'); + describe("test the Layer legend", () => { beforeEach((done) => { document.body.innerHTML = '
'; @@ -44,7 +46,6 @@ describe("test the Layer legend", () => { }); it('test legend content', () => { - var TestUtils = React.addons.TestUtils; let layer = { "type": "wms", "url": "http://test2/reflector/open/service", diff --git a/web/client/components/TOC/fragments/settings/__tests__/Display-test.jsx b/web/client/components/TOC/fragments/settings/__tests__/Display-test.jsx index b3c5d722d4..bad4f090f1 100644 --- a/web/client/components/TOC/fragments/settings/__tests__/Display-test.jsx +++ b/web/client/components/TOC/fragments/settings/__tests__/Display-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ReactTestUtils = require('react-addons-test-utils'); var Display = require('../Display'); diff --git a/web/client/components/TOC/fragments/settings/__tests__/General-test.jsx b/web/client/components/TOC/fragments/settings/__tests__/General-test.jsx index eb1d0e358d..a74b36b9d1 100644 --- a/web/client/components/TOC/fragments/settings/__tests__/General-test.jsx +++ b/web/client/components/TOC/fragments/settings/__tests__/General-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ReactTestUtils = require('react-addons-test-utils'); var General = require('../General'); diff --git a/web/client/components/TOC/fragments/settings/__tests__/WMSStyle-test.jsx b/web/client/components/TOC/fragments/settings/__tests__/WMSStyle-test.jsx index 907e066abd..21986fcaf9 100644 --- a/web/client/components/TOC/fragments/settings/__tests__/WMSStyle-test.jsx +++ b/web/client/components/TOC/fragments/settings/__tests__/WMSStyle-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ReactTestUtils = require('react-addons-test-utils'); var WMSStyle = require('../WMSStyle'); diff --git a/web/client/components/app/StandardRouter.jsx b/web/client/components/app/StandardRouter.jsx index 99159daeb0..d47046cff3 100644 --- a/web/client/components/app/StandardRouter.jsx +++ b/web/client/components/app/StandardRouter.jsx @@ -23,7 +23,7 @@ const StandardRouter = React.createClass({ getDefaultProps() { return { plugins: {}, - locale: {messages: {}, current: ''}, + locale: {messages: {}, current: 'en-US'}, pages: [] }; }, diff --git a/web/client/components/app/__tests__/StandardApp-test.jsx b/web/client/components/app/__tests__/StandardApp-test.jsx index 35b9f21291..bcbeb56b45 100644 --- a/web/client/components/app/__tests__/StandardApp-test.jsx +++ b/web/client/components/app/__tests__/StandardApp-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ const expect = require('expect'); -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const StandardApp = require('../StandardApp'); diff --git a/web/client/components/app/__tests__/StandardRouter-test.jsx b/web/client/components/app/__tests__/StandardRouter-test.jsx index cafa1893d1..7e4f49b37e 100644 --- a/web/client/components/app/__tests__/StandardRouter-test.jsx +++ b/web/client/components/app/__tests__/StandardRouter-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ const expect = require('expect'); -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const {Provider} = require('react-redux'); @@ -65,7 +65,6 @@ describe('StandardApp', () => { }]; const app = ReactDOM.render(, document.getElementById("container")); expect(app).toExist(); - const dom = ReactDOM.findDOMNode(app); expect(dom.getElementsByClassName('mycomponent').length).toBe(1); diff --git a/web/client/components/buttons/__tests__/ImageButton-test.jsx b/web/client/components/buttons/__tests__/ImageButton-test.jsx index 8c9682a7bf..ad3e9a7b9d 100644 --- a/web/client/components/buttons/__tests__/ImageButton-test.jsx +++ b/web/client/components/buttons/__tests__/ImageButton-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ImageButton = require('../ImageButton'); diff --git a/web/client/components/buttons/__tests__/InfoButton-test.jsx b/web/client/components/buttons/__tests__/InfoButton-test.jsx index bb3777cd66..fa88fa8021 100644 --- a/web/client/components/buttons/__tests__/InfoButton-test.jsx +++ b/web/client/components/buttons/__tests__/InfoButton-test.jsx @@ -5,7 +5,7 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var InfoButton = require('../InfoButton'); var expect = require('expect'); @@ -36,12 +36,7 @@ describe('This test for InfoButton', () => { const btn = btnList.item(0); expect(btn.className).toBe("btn btn-md btn-info"); - - const btnItems = btn.getElementsByTagName("span"); - expect(btnItems.length).toBe(3); - expect(btnItems.item(0).innerHTML).toBe(""); - expect(btnItems.item(1).innerHTML).toBe(""); - expect(btnItems.item(2).innerHTML).toBe("Info"); + expect(btn.innerText).toBe("Info"); }); it('checks if a click on button shows a modal window', () => { @@ -106,11 +101,7 @@ describe('This test for InfoButton', () => { const aboutDom = ReactDOM.findDOMNode(about); const btn = aboutDom.getElementsByTagName('button').item(0); - const btnItems = btn.getElementsByTagName("span"); - expect(btnItems.length).toBe(3); - expect(btnItems.item(0).innerHTML).toBe(""); - expect(btnItems.item(1).innerHTML).toBe(""); - expect(btnItems.item(2).innerHTML).toBe(customText); + expect(btn.innerText).toBe(customText); }); it('checks the button icon', () => { @@ -118,12 +109,10 @@ describe('This test for InfoButton', () => { const about = ReactDOM.render(, document.getElementById("container")); const aboutDom = ReactDOM.findDOMNode(about); const btn = aboutDom.getElementsByTagName('button').item(0); - const btnItems = btn.getElementsByTagName("span"); - expect(btnItems.length).toBe(3); + expect(btnItems.length).toBe(1); expect(btnItems.item(0).className).toBe("glyphicon glyphicon-" + icon); - expect(btnItems.item(1).innerHTML).toBe(" "); - expect(btnItems.item(2).innerHTML).toBe("Info"); + expect(btn.innerText.indexOf("Info") !== -1).toBe(true); }); it('checks if the button contains only icon', () => { @@ -131,12 +120,10 @@ describe('This test for InfoButton', () => { const about = ReactDOM.render(, document.getElementById("container")); const aboutDom = ReactDOM.findDOMNode(about); const btn = aboutDom.getElementsByTagName('button').item(0); - const btnItems = btn.getElementsByTagName("span"); - expect(btnItems.length).toBe(3); + expect(btnItems.length).toBe(1); expect(btnItems.item(0).className).toBe("glyphicon glyphicon-" + icon); - expect(btnItems.item(1).innerHTML).toBe(""); - expect(btnItems.item(2).innerHTML).toBe(""); + expect(btn.innerText).toBe(""); }); it('checks if the button contains at least the default text', () => { @@ -144,11 +131,7 @@ describe('This test for InfoButton', () => { const aboutDom = ReactDOM.findDOMNode(about); const btn = aboutDom.getElementsByTagName('button').item(0); - const btnItems = btn.getElementsByTagName("span"); - expect(btnItems.length).toBe(3); - expect(btnItems.item(0).innerHTML).toBe(""); - expect(btnItems.item(1).innerHTML).toBe(""); - expect(btnItems.item(2).innerHTML).toBe("Info"); + expect(btn.innerText).toBe("Info"); }); it('checks if the button contains at least the custom text', () => { @@ -157,11 +140,7 @@ describe('This test for InfoButton', () => { const aboutDom = ReactDOM.findDOMNode(about); const btn = aboutDom.getElementsByTagName('button').item(0); - const btnItems = btn.getElementsByTagName("span"); - expect(btnItems.length).toBe(3); - expect(btnItems.item(0).innerHTML).toBe(""); - expect(btnItems.item(1).innerHTML).toBe(""); - expect(btnItems.item(2).innerHTML).toBe(customText); + expect(btn.innerText).toBe(customText); }); it('checks the custom title for the window', () => { diff --git a/web/client/components/buttons/__tests__/ToggleButton-test.jsx b/web/client/components/buttons/__tests__/ToggleButton-test.jsx index 0990bd401c..8b11ca47fd 100644 --- a/web/client/components/buttons/__tests__/ToggleButton-test.jsx +++ b/web/client/components/buttons/__tests__/ToggleButton-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ToggleButton = require('../ToggleButton'); @@ -56,11 +56,8 @@ describe("test the ToggleButton", () => { expect(tbNode).toExist(); const btnItems = tbNode.getElementsByTagName('span'); - expect(btnItems.length).toBe(3); - - expect(btnItems[0].innerHTML).toBe(""); - expect(btnItems[1].innerHTML).toBe(" "); - expect(btnItems[2].innerHTML).toBe("button"); + expect(btnItems.length).toBe(1); + expect(tbNode.innerText.indexOf("button") !== -1).toBe(true); }); it('test button state', () => { diff --git a/web/client/components/buttons/__tests__/ZoomButton-test.jsx b/web/client/components/buttons/__tests__/ZoomButton-test.jsx index 93ff7daaec..2703507c80 100644 --- a/web/client/components/buttons/__tests__/ZoomButton-test.jsx +++ b/web/client/components/buttons/__tests__/ZoomButton-test.jsx @@ -5,7 +5,7 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ZoomButton = require('../ZoomButton'); var expect = require('expect'); @@ -72,11 +72,9 @@ describe('This test for ZoomButton', () => { expect(zmeBtnNode).toExist(); const btnItems = zmeBtnNode.getElementsByTagName('span'); - expect(btnItems.length).toBe(3); + expect(btnItems.length).toBe(1); - expect(btnItems[0].innerHTML).toBe(""); - expect(btnItems[1].innerHTML).toBe(" "); - expect(btnItems[2].innerHTML).toBe("button"); + expect(zmeBtnNode.innerText.indexOf("button") !== -1).toBe(true); }); it('test if click on button launches the proper action', () => { diff --git a/web/client/components/buttons/__tests__/ZoomToMaxExtentButton-test.jsx b/web/client/components/buttons/__tests__/ZoomToMaxExtentButton-test.jsx index cf4b3b6f2c..9d537da44e 100644 --- a/web/client/components/buttons/__tests__/ZoomToMaxExtentButton-test.jsx +++ b/web/client/components/buttons/__tests__/ZoomToMaxExtentButton-test.jsx @@ -5,7 +5,7 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var ZoomToMaxExtentButton = require('../ZoomToMaxExtentButton'); var expect = require('expect'); @@ -72,11 +72,9 @@ describe('This test for ZoomToMaxExtentButton', () => { expect(zmeBtnNode).toExist(); const btnItems = zmeBtnNode.getElementsByTagName('span'); - expect(btnItems.length).toBe(3); + expect(btnItems.length).toBe(1); - expect(btnItems[0].innerHTML).toBe(""); - expect(btnItems[1].innerHTML).toBe(" "); - expect(btnItems[2].innerHTML).toBe("button"); + expect(zmeBtnNode.innerText.indexOf("button") !== -1).toBe(true); }); it('test if click on button launches the proper action', () => { diff --git a/web/client/components/catalog/__tests__/RecordGrid-test.jsx b/web/client/components/catalog/__tests__/RecordGrid-test.jsx index c49d5a71c8..bf6445d7dd 100644 --- a/web/client/components/catalog/__tests__/RecordGrid-test.jsx +++ b/web/client/components/catalog/__tests__/RecordGrid-test.jsx @@ -5,12 +5,12 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const RecordGrid = require('../RecordGrid.jsx'); const expect = require('expect'); -const TestUtils = require('react/addons').addons.TestUtils; +const TestUtils = require('react-addons-test-utils'); const sampleCatalogURL = "http://test.com/catalog"; const sampleRecord = { identifier: "test-identifier", diff --git a/web/client/components/catalog/__tests__/RecordItem-test.jsx b/web/client/components/catalog/__tests__/RecordItem-test.jsx index 09350c5771..7f0f4bdea2 100644 --- a/web/client/components/catalog/__tests__/RecordItem-test.jsx +++ b/web/client/components/catalog/__tests__/RecordItem-test.jsx @@ -5,13 +5,13 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const ReactItem = require('../RecordItem.jsx'); const expect = require('expect'); const assign = require('object-assign'); -const TestUtils = require('react/addons').addons.TestUtils; +const TestUtils = require('react-addons-test-utils'); const sampleRecord = { identifier: "test-identifier", diff --git a/web/client/components/data/featuregrid/__tests__/FeatureGrid-test.jsx b/web/client/components/data/featuregrid/__tests__/FeatureGrid-test.jsx index 09ce46f72a..0676413c9a 100644 --- a/web/client/components/data/featuregrid/__tests__/FeatureGrid-test.jsx +++ b/web/client/components/data/featuregrid/__tests__/FeatureGrid-test.jsx @@ -33,7 +33,7 @@ describe("Test FeatureGrid Component", () => { expect(comp).toExist(); let btns = document.getElementsByTagName("button"); btns[btns.length - 1].click(); - comp.setProps({paging: true, features: function() { return data.features; }, columnDefs: columnDef}); + // comp.setProps({paging: true, features: function() { return data.features; }, columnDefs: columnDef}); }); it('Test FeatureGrid rendering with column def', () => { let comp = ReactDOM.render( diff --git a/web/client/components/data/identify/__tests__/DefaultViewer-test.jsx b/web/client/components/data/identify/__tests__/DefaultViewer-test.jsx index 74ad9cf6bb..9bdec59090 100644 --- a/web/client/components/data/identify/__tests__/DefaultViewer-test.jsx +++ b/web/client/components/data/identify/__tests__/DefaultViewer-test.jsx @@ -42,7 +42,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("mycontainer").length).toBe(1); }); @@ -60,7 +60,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("mycontainer").length).toBe(1); }); @@ -90,7 +90,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("panel").length).toBe(2); expect(dom.getElementsByClassName("alert").length).toBe(1); }); @@ -102,7 +102,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("alert").length).toBe(1); }); @@ -124,7 +124,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("alert").length).toBe(0); }); @@ -135,7 +135,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("alert").length).toBe(0); }); @@ -155,7 +155,7 @@ describe('DefaultViewer', () => { ); expect(viewer).toExist(); - const dom = React.findDOMNode(viewer); + const dom = ReactDOM.findDOMNode(viewer); expect(dom.getElementsByClassName("custom").length).toBe(1); expect(dom.innerHTML.indexOf('myresponse') !== -1).toBe(true); }); diff --git a/web/client/components/data/identify/__tests__/GeocodeViewer-test.jsx b/web/client/components/data/identify/__tests__/GeocodeViewer-test.jsx index a5f54352d4..5ef236d8ba 100644 --- a/web/client/components/data/identify/__tests__/GeocodeViewer-test.jsx +++ b/web/client/components/data/identify/__tests__/GeocodeViewer-test.jsx @@ -5,13 +5,15 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const GeocodeViewer = require('../GeocodeViewer.jsx'); const expect = require('expect'); +const TestUtils = require('react-addons-test-utils'); + class Wrapper extends React.Component { render() { return this.props.children; @@ -54,7 +56,6 @@ describe('GeocodeViewer', () => { }); it('test click handler and modal', () => { - var TestUtils = React.addons.TestUtils; const testHandlers = { clickHandler: (pressed) => {return pressed; } }; diff --git a/web/client/components/data/identify/__tests__/Identify-test.jsx b/web/client/components/data/identify/__tests__/Identify-test.jsx index 9f1a647ba6..78f0657191 100644 --- a/web/client/components/data/identify/__tests__/Identify-test.jsx +++ b/web/client/components/data/identify/__tests__/Identify-test.jsx @@ -75,13 +75,19 @@ describe('Identify', () => { const spyMousePointer = expect.spyOn(testHandlers, 'changeMousePointer'); - const identify = ReactDOM.render( + ReactDOM.render( , document.getElementById("container") ); - identify.setProps({enabled: true}); + ReactDOM.render( + , + document.getElementById("container") + ); expect(spyMousePointer.calls.length).toEqual(1); - identify.setProps({enabled: false}); + ReactDOM.render( + , + document.getElementById("container") + ); expect(spyMousePointer.calls.length).toEqual(2); }); @@ -92,14 +98,21 @@ describe('Identify', () => { const spySendRequest = expect.spyOn(testHandlers, 'sendRequest'); - const identify = ReactDOM.render( + ReactDOM.render( + true} + enabled={true} layers={[{}, {}]} sendRequest={testHandlers.sendRequest} buildRequest={() => ({url: "myurl"})} + />, + document.getElementById("container") + ); + ReactDOM.render( true} + point={{pixel: {x: 1, y: 1}}} enabled={true} layers={[{}, {}]} sendRequest={testHandlers.sendRequest} buildRequest={() => ({url: "myurl"})} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}}}); expect(spySendRequest.calls.length).toEqual(2); }); @@ -110,14 +123,21 @@ describe('Identify', () => { const spySendRequest = expect.spyOn(testHandlers, 'sendRequest'); - const identify = ReactDOM.render( + ReactDOM.render( + true} + enabled={true} layers={[{}, {}]} localRequest={testHandlers.sendRequest} buildRequest={() => ({url: ""})} + />, + document.getElementById("container") + ); + ReactDOM.render( true} + point={{pixel: {x: 1, y: 1}}} enabled={true} layers={[{}, {}]} localRequest={testHandlers.sendRequest} buildRequest={() => ({url: ""})} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}}}); expect(spySendRequest.calls.length).toEqual(2); }); @@ -128,14 +148,21 @@ describe('Identify', () => { const spySendRequest = expect.spyOn(testHandlers, 'sendRequest'); - const identify = ReactDOM.render( + ReactDOM.render( true} enabled={false} layers={[{}, {}]} sendRequest={testHandlers.sendRequest} buildRequest={() => ({})} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}}}); + ReactDOM.render( + true} + point={{pixel: {x: 1, y: 1}}} + enabled={false} layers={[{}, {}]} sendRequest={testHandlers.sendRequest} buildRequest={() => ({})} + />, + document.getElementById("container") + ); expect(spySendRequest.calls.length).toEqual(0); }); @@ -146,14 +173,21 @@ describe('Identify', () => { const spySendRequest = expect.spyOn(testHandlers, 'sendRequest'); - const identify = ReactDOM.render( + ReactDOM.render( layer.type === "wms"} enabled={true} layers={[{type: "wms"}, {type: "osm"}]} sendRequest={testHandlers.sendRequest} buildRequest={() => ({url: "myurl"})} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}}}); + ReactDOM.render( + layer.type === "wms"} + point={{pixel: {x: 1, y: 1}}} + enabled={true} layers={[{type: "wms"}, {type: "osm"}]} sendRequest={testHandlers.sendRequest} buildRequest={() => ({url: "myurl"})} + />, + document.getElementById("container") + ); expect(spySendRequest.calls.length).toEqual(1); }); @@ -166,16 +200,30 @@ describe('Identify', () => { const spyShowMarker = expect.spyOn(testHandlers, 'showMarker'); const spyHideMarker = expect.spyOn(testHandlers, 'hideMarker'); - const identify = ReactDOM.render( + ReactDOM.render( + true} + enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} + />, + document.getElementById("container") + ); + ReactDOM.render( true} + point={{pixel: {x: 1, y: 1}}} enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}}}); expect(spyShowMarker.calls.length).toEqual(1); - identify.setProps({enabled: false}); + ReactDOM.render( + true} + point={{pixel: {x: 1, y: 1}}} + enabled={false} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} + />, + document.getElementById("container") + ); expect(spyHideMarker.calls.length).toEqual(1); }); @@ -186,16 +234,30 @@ describe('Identify', () => { const spyPurgeResults = expect.spyOn(testHandlers, 'purgeResults'); - const identify = ReactDOM.render( + ReactDOM.render( true} enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}}}); + ReactDOM.render( + true} + point={{pixel: {x: 1, y: 1}}} + enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} + />, + document.getElementById("container") + ); expect(spyPurgeResults.calls.length).toEqual(1); - identify.setProps({enabled: false}); + ReactDOM.render( + true} + point={{pixel: {x: 1, y: 1}}} + enabled={false} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} + />, + document.getElementById("container") + ); expect(spyPurgeResults.calls.length).toEqual(2); }); @@ -206,17 +268,35 @@ describe('Identify', () => { const spyPurgeResults = expect.spyOn(testHandlers, 'purgeResults'); - const identify = ReactDOM.render( + ReactDOM.render( + true} + enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} + multiSelection={true} + />, + document.getElementById("container") + ); + ReactDOM.render( true} + point={{pixel: {x: 1, y: 1}}} + modifiers={{ctrl: false}} enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} multiSelection={true} />, document.getElementById("container") ); - identify.setProps({point: {pixel: {x: 1, y: 1}, modifiers: {ctrl: false}}}); expect(spyPurgeResults.calls.length).toEqual(1); - identify.setProps({point: {pixel: {x: 1, y: 1}, modifiers: {ctrl: true}}}); + ReactDOM.render( + true} + point={{pixel: {x: 1, y: 1}}} + modifiers={{ctrl: true}} + enabled={true} layers={[{}, {}]} {...testHandlers} buildRequest={() => ({})} + multiSelection={true} + />, + document.getElementById("container") + ); expect(spyPurgeResults.calls.length).toEqual(1); }); diff --git a/web/client/components/data/identify/viewers/__tests__/viewers-test.jsx b/web/client/components/data/identify/viewers/__tests__/viewers-test.jsx index c2f21e4454..4b8dd9941e 100644 --- a/web/client/components/data/identify/viewers/__tests__/viewers-test.jsx +++ b/web/client/components/data/identify/viewers/__tests__/viewers-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var HTMLViewer = require('../HTMLViewer'); var JSONViewer = require('../JSONViewer'); diff --git a/web/client/components/data/identify/viewers/row/__tests__/PropertiesViewer-test.jsx b/web/client/components/data/identify/viewers/row/__tests__/PropertiesViewer-test.jsx index 6555fc2e7c..b5204a145b 100644 --- a/web/client/components/data/identify/viewers/row/__tests__/PropertiesViewer-test.jsx +++ b/web/client/components/data/identify/viewers/row/__tests__/PropertiesViewer-test.jsx @@ -7,7 +7,7 @@ */ var expect = require('expect'); -var React = require('react/addons'); +var React = require('react'); var ReactDOM = require('react-dom'); var PropertiesViewer = require('../PropertiesViewer'); @@ -63,10 +63,7 @@ describe('PropertiesViewer', () => { let testKey = testKeys[i]; let testVal = testProps[testKey]; return prev - && child.childNodes.length === 3 - && child.childNodes.item(0).innerHTML === testKey - && child.childNodes.item(1).innerHTML === " " - && child.childNodes.item(2).innerHTML === testVal; + && child.innerText === testKey + " " + testVal; }, true)).toBe(true); }); diff --git a/web/client/components/data/query/__tests__/ComboField-test.jsx b/web/client/components/data/query/__tests__/ComboField-test.jsx index e427d74581..6563b2a098 100644 --- a/web/client/components/data/query/__tests__/ComboField-test.jsx +++ b/web/client/components/data/query/__tests__/ComboField-test.jsx @@ -51,16 +51,13 @@ describe('ComboField', () => { expect(comboFieldDOMNode).toExist(); let childNodes = comboFieldDOMNode.actual.childNodes; - expect(childNodes.length).toBe(3); + expect(childNodes.length).toBe(2); let rwDropdownlist = comboFieldDOMNode.actual.getElementsByClassName('rw-dropdownlist-picker rw-select rw-btn')[0]; expect(rwDropdownlist).toExist(); let rwInput = comboFieldDOMNode.actual.getElementsByClassName('rw-input')[0]; expect(rwInput).toExist(); - - let rwPopup = comboFieldDOMNode.actual.getElementsByClassName('rw-popup-container rw-popup-animating')[0]; - expect(rwPopup).toExist(); }); it('creates the ComboField with an exception message', () => { diff --git a/web/client/components/data/query/__tests__/DateField-test.jsx b/web/client/components/data/query/__tests__/DateField-test.jsx index 7d642022fe..54e35b53ee 100644 --- a/web/client/components/data/query/__tests__/DateField-test.jsx +++ b/web/client/components/data/query/__tests__/DateField-test.jsx @@ -46,7 +46,7 @@ describe('DateField', () => { expect(dateFieldDOMNode).toExist(); let childNodes = dateFieldDOMNode.actual.getElementsByTagName('DIV'); - expect(childNodes.length).toBe(5); + expect(childNodes.length).toBe(2); let dateRow = childNodes[0]; expect(dateRow).toExist(); @@ -75,7 +75,7 @@ describe('DateField', () => { expect(dateFieldDOMNode).toExist(); let childNodes = dateFieldDOMNode.actual.getElementsByTagName('DIV'); - expect(childNodes.length).toBe(11); + expect(childNodes.length).toBe(5); let dateRow = childNodes[0]; expect(dateRow).toExist(); diff --git a/web/client/components/data/query/__tests__/FilterField-test.jsx b/web/client/components/data/query/__tests__/FilterField-test.jsx index 92c08a57a9..d1c0624d3a 100644 --- a/web/client/components/data/query/__tests__/FilterField-test.jsx +++ b/web/client/components/data/query/__tests__/FilterField-test.jsx @@ -100,15 +100,15 @@ describe('FilterField', () => { expect(childNodes.length).toBe(1); const inputFields = filterFieldDOMNode.actual.getElementsByClassName('rw-input'); - expect(inputFields.length).toBe(4); + expect(inputFields.length).toBe(3); const attributeSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[0]; expect(attributeSelect.childNodes[0].nodeValue).toBe("Attribute1"); - const operatorSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[2]; + const operatorSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[1]; expect(operatorSelect.childNodes[0].nodeValue).toBe("="); - const valueSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[3]; + const valueSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[2]; expect(valueSelect.childNodes[0].nodeValue).toBe("attribute1"); }); @@ -173,12 +173,12 @@ describe('FilterField', () => { expect(childNodes.length).toBe(1); const inputFields = filterFieldDOMNode.actual.getElementsByClassName('rw-input'); - expect(inputFields.length).toBe(4); + expect(inputFields.length).toBe(3); const attributeSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[0]; expect(attributeSelect.childNodes[0].nodeValue).toBe("Attribute1"); - const operatorSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[2]; + const operatorSelect = filterFieldDOMNode.actual.getElementsByClassName('rw-input')[1]; expect(operatorSelect.childNodes[0].nodeValue).toBe("="); const valueSelectContainer = filterFieldDOMNode.actual.getElementsByClassName('col-xs-5')[0].childNodes[0]; diff --git a/web/client/components/data/query/__tests__/NumberField-test.jsx b/web/client/components/data/query/__tests__/NumberField-test.jsx index cc9a59362c..df8fb736fc 100644 --- a/web/client/components/data/query/__tests__/NumberField-test.jsx +++ b/web/client/components/data/query/__tests__/NumberField-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ const expect = require('expect'); -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const NumberField = require('../NumberField'); diff --git a/web/client/components/data/query/__tests__/SimpleFilterFiled-test.jsx b/web/client/components/data/query/__tests__/SimpleFilterFiled-test.jsx index 074fcfb00f..5d116e9ba3 100644 --- a/web/client/components/data/query/__tests__/SimpleFilterFiled-test.jsx +++ b/web/client/components/data/query/__tests__/SimpleFilterFiled-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ const expect = require('expect'); -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const SimpleFilterField = require('../SimpleFilterField'); diff --git a/web/client/components/data/query/__tests__/TextField-test.jsx b/web/client/components/data/query/__tests__/TextField-test.jsx index 4d78962760..3894f78cdb 100644 --- a/web/client/components/data/query/__tests__/TextField-test.jsx +++ b/web/client/components/data/query/__tests__/TextField-test.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ const expect = require('expect'); -const React = require('react/addons'); +const React = require('react'); const ReactDOM = require('react-dom'); const TextField = require('../TextField'); diff --git a/web/client/components/data/template/jsx/__tests__/Template-test.jsx b/web/client/components/data/template/jsx/__tests__/Template-test.jsx index f4afdf0290..aa4f34a71e 100644 --- a/web/client/components/data/template/jsx/__tests__/Template-test.jsx +++ b/web/client/components/data/template/jsx/__tests__/Template-test.jsx @@ -5,7 +5,7 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ -var React = require('react/addons'); +var React = require('react'); var expect = require('expect'); var ReactDOM = require('react-dom'); var Template = require('../Template'); @@ -60,7 +60,9 @@ describe("Test JSX Template", () => { expect(cmpDom).toExist(); expect(cmpDom.id).toExist(); expect(cmpDom.id).toBe("template"); - comp.setProps({model: {id: "template-update" }}); + comp = ReactDOM.render( +