Skip to content

Commit

Permalink
Fix primefaces#6184: Handle null originalEvent in Jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Mar 21, 2024
1 parent 25438e6 commit 252b86f
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1728,10 +1728,10 @@ export const Calendar = React.memo(
originalEvent: event,
value: newValue,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export const Checkbox = React.memo(
value: props.value,
checked: value,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
type: 'checkbox',
Expand Down
8 changes: 4 additions & 4 deletions components/lib/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export const Chips = React.memo(
originalEvent: event,
value: values,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down Expand Up @@ -200,10 +200,10 @@ export const Chips = React.memo(
originalEvent: event,
value: items,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,10 +700,10 @@ export const Dropdown = React.memo(
originalEvent: event,
value: undefined,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,10 +981,10 @@ export const InputNumber = React.memo(
originalEvent: event,
value: value,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/inputswitch/InputSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export const InputSwitch = React.memo(
originalEvent: event,
value,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
8 changes: 4 additions & 4 deletions components/lib/listbox/ListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ export const ListBox = React.memo(
originalEvent: event,
value,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down Expand Up @@ -509,10 +509,10 @@ export const ListBox = React.memo(
originalEvent: event,
value,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ export const MultiSelect = React.memo(
value,
selectedOption,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/multistatecheckbox/MultiStateCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export const MultiStateCheckbox = React.memo(
originalEvent: event,
value: newValue,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export const RadioButton = React.memo(
value: props.value,
checked: value,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
type: 'radio',
Expand Down
8 changes: 4 additions & 4 deletions components/lib/rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export const Rating = React.memo(
originalEvent: event,
value: i,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand All @@ -67,10 +67,10 @@ export const Rating = React.memo(
originalEvent: event,
value: null,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/treeselect/TreeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ export const TreeSelect = React.memo(
originalEvent: event,
value: undefined,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/tristatecheckbox/TriStateCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export const TriStateCheckbox = React.memo(
originalEvent: event,
value: newValue,
stopPropagation: () => {
event.stopPropagation();
event?.stopPropagation();
},
preventDefault: () => {
event.preventDefault();
event?.preventDefault();
},
target: {
name: props.name,
Expand Down

0 comments on commit 252b86f

Please sign in to comment.