Skip to content

Commit be680e0

Browse files
committed
Fix Composite set not accepting null parameter
Change-Id: Ib0e2ba6402988ed5e6472a1d36c20555ee6bac05
1 parent 7e42d3d commit be680e0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/tabris/widgets/Composite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default class Composite extends Widget {
5656
}
5757

5858
set(props) {
59-
if (('children' in props) && !(props.children instanceof Function)) {
59+
if (props && ('children' in props) && !(props.children instanceof Function)) {
6060
throw new Error('You may not override children with a non-function');
6161
}
6262
return super.set(props);

test/tabris/widgets/Widget.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ describe('Widget', function() {
6868
expect(widget).to.be.instanceof(Widget);
6969
});
7070

71+
it('accepts set(null)', function() {
72+
expect(() => widget.set(null)).not.to.throw(Error);
73+
});
74+
7175
it('translates background color to a color shader', function() {
7276
widget.set({background: 'rgba(1, 2, 3, 0.5)'});
7377

0 commit comments

Comments
 (0)