Skip to content

Commit 5ff316c

Browse files
committed
Remove decorator usage, fix tests
Duplicate warnings were not being logged, so tests would pass in isolation but not as a part of the suite. See: facebook/react#4302
1 parent cb62da8 commit 5ff316c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/utils/bootstrapUtilsSpec.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,23 @@ describe('bootstrapUtils', () => {
103103
it('should work with ES classes', () => {
104104
shouldWarn('expected one of ["minimal","tweed","plaid"]');
105105

106-
@bsStyles(['minimal', 'tweed', 'plaid'], 'plaid')
107106
class Component extends React.Component {
108107
render() { return <span />; }
109108
}
110109

111-
const instance = render(<Component />);
110+
const WrappedComponent = bsStyles(['minimal', 'tweed', 'plaid'], 'plaid')(Component);
111+
112+
const instance = render(<WrappedComponent />);
112113

113114
expect(instance.props.bsStyle).to.equal('plaid');
114115

115-
render(<Component bsStyle="not-plaid" />);
116+
render(<WrappedComponent bsStyle="not-plaid" />);
116117
});
117118

118119
it('should work with createClass', () => {
119-
shouldWarn('expected one of ["minimal","boss","plaid"]');
120+
shouldWarn('expected one of ["minimal","boss","plaid","tweed"]');
120121

121-
const Component = bsStyles(['minimal', 'boss', 'plaid'], 'plaid')(
122+
const Component = bsStyles(['minimal', 'boss', 'plaid', 'tweed'], 'plaid')(
122123
React.createClass({
123124
render() { return <span />; }
124125
})
@@ -178,22 +179,23 @@ describe('bootstrapUtils', () => {
178179
it('should work with es6 classes', () => {
179180
shouldWarn('expected one of ["smallish","micro","planet"]');
180181

181-
@bsSizes(['smallish', 'micro', 'planet'], 'smallish')
182182
class Component extends React.Component {
183183
render() { return <span />; }
184184
}
185185

186-
const instance = render(<Component />);
186+
const WrappedComponent = bsSizes(['smallish', 'micro', 'planet'], 'smallish')(Component);
187+
188+
const instance = render(<WrappedComponent />);
187189

188190
expect(instance.props.bsSize).to.equal('smallish');
189191

190-
render(<Component bsSize="not-smallish" />);
192+
render(<WrappedComponent bsSize="not-smallish" />);
191193
});
192194

193195
it('should work with createClass', () => {
194-
shouldWarn('expected one of ["smallish","micro","planet"]');
196+
shouldWarn('expected one of ["smallish","micro","planet","big"]');
195197

196-
const Component = bsSizes(['smallish', 'micro', 'planet'], 'smallish')(
198+
const Component = bsSizes(['smallish', 'micro', 'planet', 'big'], 'smallish')(
197199
React.createClass({
198200
render() { return <span />; }
199201
})

0 commit comments

Comments
 (0)