Skip to content

Commit d052156

Browse files
Remove object assign from examples
1 parent 1ccef8c commit d052156

17 files changed

+86
-100
lines changed

components/combobox/__examples__/base-custom-menu-item.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: (
5758
<Icon
5859
assistiveText="Account"
@@ -61,8 +62,8 @@ const accountsWithIcon = accounts.map((elem) =>
6162
name={elem.type}
6263
/>
6364
),
64-
})
65-
);
65+
},
66+
}));
6667

6768
const CustomMenuItem = (props) => (
6869
<span>

components/combobox/__examples__/base-inherit-menu-width.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ const accounts = [
4646
},
4747
];
4848

49-
const accountsWithIcon = accounts.map((elem) =>
50-
Object.assign(elem, {
49+
const accountsWithIcon = accounts.map((elem) => ({
50+
...elem,
51+
...{
5152
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
52-
})
53-
);
53+
},
54+
}));
5455

5556
class Example extends React.Component {
5657
constructor (props) {

components/combobox/__examples__/base-menu-separator.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ const accounts = [
5353
},
5454
];
5555

56-
const accountsWithIcon = accounts.map((elem) =>
57-
Object.assign(elem, {
56+
const accountsWithIcon = accounts.map((elem) => ({
57+
...elem,
58+
...{
5859
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
59-
})
60-
);
60+
},
61+
}));
6162

6263
class Example extends React.Component {
6364
constructor (props) {

components/combobox/__examples__/base-menu-subheader.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ const accounts = [
5959
},
6060
];
6161

62-
const accountsWithIcon = accounts.map((elem) =>
63-
Object.assign(elem, {
62+
const accountsWithIcon = accounts.map((elem) => ({
63+
...elem,
64+
...{
6465
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
65-
})
66-
);
66+
},
67+
}));
6768

6869
class Example extends React.Component {
6970
constructor (props) {

components/combobox/__examples__/base-predefined-options-only.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ const accounts = [
5252
},
5353
];
5454

55-
const accountsWithIcon = accounts.map((elem) =>
56-
Object.assign(elem, {
55+
const accountsWithIcon = accounts.map((elem) => ({
56+
...elem,
57+
...{
5758
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
58-
})
59-
);
59+
},
60+
}));
6061

6162
class Example extends React.Component {
6263
constructor (props) {

components/combobox/__examples__/base.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/inline-multiple.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/inline-single.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/readonly-single-selection-custom-menu-item.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: (
5758
<Icon
5859
assistiveText="Account"
@@ -61,8 +62,8 @@ const accountsWithIcon = accounts.map((elem) =>
6162
name={elem.type}
6263
/>
6364
),
64-
})
65-
);
65+
},
66+
}));
6667

6768
const CustomMenuItem = (props) => (
6869
<span className="slds-media">

components/combobox/__examples__/required-input-error-state.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/snapshot/base-open-class-name.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ const accounts = [
2525
},
2626
];
2727

28-
const accountsWithIcon = accounts.map((elem) =>
29-
Object.assign(elem, {
28+
const accountsWithIcon = accounts.map((elem) => ({
29+
...elem,
30+
...{
3031
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
31-
})
32-
);
32+
},
33+
}));
3334

3435
class Example extends React.Component {
3536
constructor (props) {

components/combobox/__examples__/snapshot/base-open.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ const accounts = [
2020
},
2121
];
2222

23-
const accountsWithIcon = accounts.map((elem) =>
24-
Object.assign(elem, {
23+
const accountsWithIcon = accounts.map((elem) => ({
24+
...elem,
25+
...{
2526
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
26-
})
27-
);
27+
},
28+
}));
2829

2930
class Example extends React.Component {
3031
constructor (props) {

components/combobox/__examples__/snapshot/base-selected.jsx

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ const accounts = [
2020
},
2121
];
2222

23-
const accountsWithIcon = accounts.map((elem) =>
24-
Object.assign(elem, {
23+
const accountsWithIcon = accounts.map((elem) => ({
24+
...elem,
25+
...{
2526
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
26-
})
27-
);
27+
},
28+
}));
2829

2930
class Example extends React.Component {
3031
constructor (props) {
3132
super(props);
3233

3334
this.state = {
3435
inputValue: '',
35-
selection: [accounts[1]],
36+
selection: [accountsWithIcon[1]],
3637
};
3738
}
3839

@@ -45,37 +46,6 @@ class Example extends React.Component {
4546
placeholder: 'Search Salesforce',
4647
}}
4748
menuPosition="relative"
48-
onChange={(event, { value }) => {
49-
console.log('onChange', value);
50-
this.setState({ inputValue: value });
51-
}}
52-
onRequestRemoveSelectedOption={(event, data) => {
53-
this.setState({
54-
inputValue: '',
55-
selection: [],
56-
});
57-
}}
58-
onSubmit={(event, { value }) => {
59-
console.log('onSubmit', value);
60-
this.setState({
61-
selection: [
62-
{
63-
label: value,
64-
icon: (
65-
<Icon
66-
assistiveText="Account"
67-
category="standard"
68-
name="account"
69-
/>
70-
),
71-
},
72-
],
73-
});
74-
}}
75-
onSelect={(event, data) => {
76-
console.log('onSelect', data);
77-
this.setState({ selection: data.selection });
78-
}}
7949
options={accountsWithIcon}
8050
selection={this.state.selection}
8151
value={

components/combobox/__examples__/snapshot/inline-multiple-selection-selected.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/snapshot/inline-multiple-selection.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/snapshot/inline-single-selection-selected.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

components/combobox/__examples__/snapshot/inline-single-selection.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ const accounts = [
5151
},
5252
];
5353

54-
const accountsWithIcon = accounts.map((elem) =>
55-
Object.assign(elem, {
54+
const accountsWithIcon = accounts.map((elem) => ({
55+
...elem,
56+
...{
5657
icon: <Icon assistiveText="Account" category="standard" name={elem.type} />,
57-
})
58-
);
58+
},
59+
}));
5960

6061
class Example extends React.Component {
6162
constructor (props) {

0 commit comments

Comments
 (0)