Skip to content

Commit a99219c

Browse files
committed
fix(css): return undefined if there is no className
1 parent 74be141 commit a99219c

File tree

5 files changed

+8
-19
lines changed

5 files changed

+8
-19
lines changed

packages/react-core/src/components/Alert/__tests__/__snapshots__/AlertActionLink.test.tsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
exports[`Matches the snapshot 1`] = `
44
<DocumentFragment>
5-
<button
6-
class=""
7-
>
5+
<button>
86
Test
97
</button>
108
<p>

packages/react-core/src/components/List/__tests__/Generated/__snapshots__/ListItem.test.tsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
exports[`ListItem should match snapshot (auto-generated) 1`] = `
44
<DocumentFragment>
5-
<li
6-
class=""
7-
>
5+
<li>
86
<span>
97
ReactNode
108
</span>

packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
exports[`SearchInput advanced search 1`] = `
44
<DocumentFragment>
5-
<div
6-
class=""
7-
>
5+
<div>
86
<div
97
class="pf-v6-c-input-group"
108
>
@@ -145,7 +143,6 @@ exports[`SearchInput advanced search 1`] = `
145143
exports[`SearchInput advanced search with custom attributes 1`] = `
146144
<DocumentFragment>
147145
<div
148-
class=""
149146
data-testid="test-id"
150147
>
151148
<div
@@ -478,9 +475,7 @@ exports[`SearchInput advanced search with custom attributes 1`] = `
478475

479476
exports[`SearchInput renders search input in strict mode 1`] = `
480477
<DocumentFragment>
481-
<div
482-
class=""
483-
>
478+
<div>
484479
<div
485480
class="pf-v6-c-input-group"
486481
>

packages/react-core/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroupItemElement.test.tsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
exports[`empty 1`] = `
44
<DocumentFragment>
5-
<span
6-
class=""
7-
/>
5+
<span/>
86
</DocumentFragment>
97
`;
108

packages/react-styles/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
*
33
* @param {any} args list of objects, string, or arrays to reduce
44
*/
5-
export function css(...args: any): string {
6-
// Adapted from https://github.com/JedWatson/classnames/blob/master/index.js
5+
export function css(...args: any): string | undefined {
6+
// Adapted from https://github.com/JedWatson/classnames/blob/main/index.js
77
const classes = [] as string[];
88
const hasOwn = {}.hasOwnProperty;
99

@@ -26,5 +26,5 @@ export function css(...args: any): string {
2626
}
2727
});
2828

29-
return classes.join(' ');
29+
return classes.join(' ') || undefined;
3030
}

0 commit comments

Comments
 (0)