-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow Localized with no children #230
Changes from 2 commits
b2eb075
57b4cf9
145cee3
9478fb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,13 +45,11 @@ suite('Localized - validation', function() { | |
}); | ||
|
||
test('without a child', function() { | ||
function render() { | ||
shallow( | ||
<Localized />, | ||
{ context: { l10n: new ReactLocalization([]) } } | ||
); | ||
} | ||
assert.throws(render, /a single React element child/); | ||
const wrapper = shallow( | ||
<Localized />, | ||
{ context: { l10n: new ReactLocalization([]) } } | ||
); | ||
assert.equal(wrapper.length, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please bring this test back and add a new one in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test is still there -- I've just changed it not to check for an exception as it doesn't throw one anymore. I've added a few test cases for fallback string children (with/without message) and empty children (with/without message) as suggested. |
||
}); | ||
|
||
test('with multiple children', function() { | ||
|
@@ -64,7 +62,7 @@ suite('Localized - validation', function() { | |
{ context: { l10n: new ReactLocalization([]) } } | ||
); | ||
} | ||
assert.throws(render, /a single React element child/); | ||
assert.throws(render, /a single React node child/); | ||
}); | ||
|
||
test('without id', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep the previous version with
elem
, please. It makes it clearer that there should only be one child element. Same comment applies to other places in this PR.