Skip to content

Commit 2573291

Browse files
committed
[react-native] Add unit test to ReactNativeAttributePayload
1 parent 190cc99 commit 2573291

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/react-native-renderer/src/__tests__/ReactNativeAttributePayload-test.internal.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ describe('ReactNativeAttributePayload', () => {
204204
).toEqual({foo: null}); // this should ideally be null. heuristic.
205205
});
206206

207+
it('handles attributes defined multiple times', () => {
208+
const validAttributes = {foo: true, style: {foo: true}};
209+
expect(diff({}, {foo: 4, style: {foo: 2}}, validAttributes)).toEqual({
210+
foo: 2,
211+
});
212+
expect(diff({foo: 4}, {style: {foo: 2}}, validAttributes)).toEqual({
213+
foo: 2,
214+
});
215+
expect(diff({style: {foo: 2}}, {foo: 4}, validAttributes)).toEqual({
216+
foo: 4,
217+
});
218+
});
219+
207220
// Function properties are just markers to native that events should be sent.
208221
it('should convert functions to booleans', () => {
209222
// Note that if the property changes from one function to another, we don't

0 commit comments

Comments
 (0)