diff --git a/.size-snapshot.json b/.size-snapshot.json index 02c4f2d9..4a34c249 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,18 +1,18 @@ { "dist/react-powerplug.umd.js": { - "bundled": 23340, - "minified": 9379, - "gzipped": 2578 + "bundled": 23769, + "minified": 9469, + "gzipped": 2596 }, "dist/react-powerplug.cjs.js": { - "bundled": 20442, - "minified": 10525, - "gzipped": 2470 + "bundled": 20833, + "minified": 10881, + "gzipped": 2485 }, "dist/react-powerplug.esm.js": { - "bundled": 19780, - "minified": 9965, - "gzipped": 2334, + "bundled": 20171, + "minified": 10321, + "gzipped": 2348, "treeshaked": { "rollup": { "code": 365, diff --git a/src/components/Counter.js b/src/components/Counter.js index 5f57c247..6cba1d85 100644 --- a/src/components/Counter.js +++ b/src/components/Counter.js @@ -20,7 +20,7 @@ const Counter = ({ initial = 0, onChange, ...props }) => ( dec: () => setState(add(-1)), incBy: value => setState(add(value)), decBy: value => setState(add(-value)), - set: value => setState(s => ({ on: set(value, s.on) })), + set: value => setState(s => ({ count: set(value, s.count) })), }) } diff --git a/tests/components/Counter.test.js b/tests/components/Counter.test.js index d40c6399..b37889eb 100644 --- a/tests/components/Counter.test.js +++ b/tests/components/Counter.test.js @@ -21,6 +21,12 @@ test('', () => { lastCallArg(renderFn).decBy(3) expect(renderFn).lastCalledWith(expect.objectContaining({ count: 2 })) + + lastCallArg(renderFn).set(10) + expect(renderFn).lastCalledWith(expect.objectContaining({ count: 10 })) + + lastCallArg(renderFn).set(count => count + 10) + expect(renderFn).lastCalledWith(expect.objectContaining({ count: 20 })) }) test('', () => {