Skip to content

Commit a293e43

Browse files
committed
Do not expose CaptureClicks directly
1 parent c5ee436 commit a293e43

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

docs/a-elements.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ Just wrap these sections with a `CaptureClicks` component:
1313
var Router = require('react-router-component')
1414
var Locations = Router.Locations
1515
var Location = Router.Location
16-
var CaptureClicks = Router.CaptureClicks;
16+
var CaptureClicks = require('react-router-component/lib/CaptureClicks')
1717

1818
var Page = React.createClass({
1919
render: function() {
2020
return (
2121
<div>
2222
<ThirdPartyComponentWithAElements />
23-
<div dangerouslySetInnerHTML={{__html: '<a href="/message">Click me!</a>'}} />
23+
<div dangerouslySetInnerHTML={
24+
{__html: '<a href="/message">Click me!</a>'}
25+
} />
2426
</div>
2527
)
2628
}

index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
var Router = require('./lib/Router');
44
var Route = require('./lib/Route');
55
var Link = require('./lib/Link');
6-
var CaptureClicks = require('./lib/CaptureClicks');
76

87
var RouterMixin = require('./lib/RouterMixin');
98
var AsyncRouteRenderingMixin = require('./lib/AsyncRouteRenderingMixin');
@@ -16,7 +15,6 @@ var environment = require('./lib/environment');
1615
module.exports = {
1716
Locations: Router.Locations,
1817
Pages: Router.Pages,
19-
CaptureClicks: CaptureClicks,
2018

2119
Location: Route.Route,
2220
Page: Route.Route,

tests/browser.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var React = require('react');
44
var ReactTestUtils = require('react/lib/ReactTestUtils');
55
var EventConstants = require('react/lib/EventConstants');
66
var Router = require('../index');
7+
var CaptureClicks = require('../lib/CaptureClicks');
78

89
var historyAPI = (
910
window.history !== undefined &&
@@ -69,7 +70,7 @@ describe('Routing', function() {
6970
var App = React.createClass({
7071

7172
render: function() {
72-
return React.DOM.div({onClick: this.props.onClick},
73+
return div({onClick: this.props.onClick},
7374
Router.Locations({
7475
ref: 'router', className: 'App',
7576
onNavigation: this.props.navigationHandler,
@@ -98,7 +99,7 @@ describe('Routing', function() {
9899
handler: function(props) { return div(null, 'not_found') }
99100
})
100101
),
101-
Router.CaptureClicks({gotoURL: this.gotoURL},
102+
CaptureClicks({gotoURL: this.gotoURL},
102103
a({ref: 'anchor', href: '/__zuul/hi'}),
103104
a({ref: 'anchorUnhandled', href: '/goodbye'}),
104105
a({ref: 'anchorExternal', href: 'https://github.com/andreypopp/react-router-component'})
@@ -316,7 +317,7 @@ describe('Routing with async components', function() {
316317
if (this.context.router.hasPendingUpdate()) {
317318
mainSeenPendingUpdate = true;
318319
}
319-
return React.DOM.div(null, this.state.message ? this.state.message : 'loading...');
320+
return div(null, this.state.message ? this.state.message : 'loading...');
320321
}
321322
});
322323

@@ -333,7 +334,7 @@ describe('Routing with async components', function() {
333334
if (!this.state.message) {
334335
aboutWasInLoadingState = true;
335336
}
336-
return React.DOM.div(null, this.state.message ? this.state.message : 'loading...');
337+
return div(null, this.state.message ? this.state.message : 'loading...');
337338
}
338339
});
339340

@@ -405,7 +406,7 @@ describe('Nested routers', function() {
405406

406407
var NestedRouter = React.createClass({
407408
render: function() {
408-
return React.DOM.div(null,
409+
return div(null,
409410
Router.Locations(null,
410411
Router.Location({
411412
path: '/__zuul/nested/',
@@ -426,7 +427,7 @@ describe('Nested routers', function() {
426427
var App = React.createClass({
427428

428429
render: function() {
429-
return React.DOM.div(null,
430+
return div(null,
430431
Router.Locations({ref: 'router', className: 'App'},
431432
Router.Location({
432433
path: '/__zuul',
@@ -441,7 +442,7 @@ describe('Nested routers', function() {
441442
handler: NestedRouter
442443
})
443444
),
444-
Router.CaptureClicks({gotoURL: this.gotoURL},
445+
CaptureClicks({gotoURL: this.gotoURL},
445446
a({ref: 'anchor', href: '/__zuul/nested/page'}),
446447
a({ref: 'anchorNestedRoot', href: '/__zuul/nested/'}),
447448
a({ref: 'anchorUnhandled', href: '/__zuul/nested/404'})
@@ -515,7 +516,7 @@ describe('Contextual routers', function() {
515516
var SubCat = React.createClass({
516517

517518
render: function() {
518-
return React.DOM.div(null,
519+
return div(null,
519520
Router.Locations({ref: 'router', contextual: true},
520521
Router.Location({
521522
path: '/',
@@ -651,7 +652,7 @@ describe('Multiple active routers', function() {
651652
}
652653
})
653654
);
654-
return React.DOM.div({ref: 'content'}, router1, router2);
655+
return div({ref: 'content'}, router1, router2);
655656
}
656657
});
657658

@@ -795,7 +796,7 @@ describe('Contextual Hash routers', function() {
795796
var SubCat = React.createClass({
796797

797798
render: function() {
798-
return React.DOM.div(null,
799+
return div(null,
799800
Router.Locations({ref: 'router', contextual: true},
800801
Router.Location({
801802
path: '/',

0 commit comments

Comments
 (0)