Skip to content

Commit c458f96

Browse files
author
Eric Olkowski
committed
Removed detached class per Core updates
1 parent d63bd4f commit c458f96

File tree

4 files changed

+3
-42
lines changed

4 files changed

+3
-42
lines changed

packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export interface ExpandableSectionProps extends Omit<React.HTMLProps<HTMLDivElem
6868
* animation will not occur.
6969
*/
7070
direction?: 'up' | 'down';
71-
hasDetachedAnimations?: boolean;
7271
}
7372

7473
interface ExpandableSectionState {
@@ -204,7 +203,6 @@ class ExpandableSection extends Component<ExpandableSectionProps, ExpandableSect
204203
// eslint-disable-next-line @typescript-eslint/no-unused-vars
205204
truncateMaxLines,
206205
direction,
207-
hasDetachedAnimations,
208206
...props
209207
} = this.props;
210208

@@ -257,8 +255,6 @@ class ExpandableSection extends Component<ExpandableSectionProps, ExpandableSect
257255
</div>
258256
);
259257

260-
const shouldApplyDetachedAnimations = hasDetachedAnimations && isDetached;
261-
262258
return (
263259
<div
264260
className={css(
@@ -267,10 +263,7 @@ class ExpandableSection extends Component<ExpandableSectionProps, ExpandableSect
267263
displaySize === 'lg' && styles.modifiers.displayLg,
268264
isWidthLimited && styles.modifiers.limitWidth,
269265
isIndented && styles.modifiers.indented,
270-
shouldApplyDetachedAnimations && 'pf-m-detached',
271-
shouldApplyDetachedAnimations &&
272-
direction &&
273-
(direction === 'up' ? styles.modifiers.expandTop : 'pf-m-expand-bottom'),
266+
isDetached && direction && (direction === 'up' ? styles.modifiers.expandTop : 'pf-m-expand-bottom'),
274267
variant === ExpandableSectionVariant.truncate && styles.modifiers.truncate,
275268
className
276269
)}

packages/react-core/src/components/ExpandableSection/ExpandableSectionToggle.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ export interface ExpandableSectionToggleProps extends Omit<React.HTMLProps<HTMLD
2828
isExpanded?: boolean;
2929
/** Callback function to toggle the expandable content. */
3030
onToggle?: (isExpanded: boolean) => void;
31-
/** Flag indicating that the expandable section and expandable toggle are detached from one another. */
32-
isDetached?: boolean;
3331
}
3432

3533
export const ExpandableSectionToggle: React.FunctionComponent<ExpandableSectionToggleProps> = ({
@@ -41,14 +39,12 @@ export const ExpandableSectionToggle: React.FunctionComponent<ExpandableSectionT
4139
toggleId,
4240
direction = 'down',
4341
hasTruncatedContent = false,
44-
isDetached = true,
4542
...props
4643
}: ExpandableSectionToggleProps) => (
4744
<div
4845
className={css(
4946
styles.expandableSection,
5047
isExpanded && styles.modifiers.expanded,
51-
isDetached && 'pf-m-detached',
5248
hasTruncatedContent && styles.modifiers.truncate,
5349
className
5450
)}

packages/react-core/src/components/ExpandableSection/__tests__/ExpandableSection.test.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,6 @@ test('Renders with ARIA attributes when contentId and toggleId are passed', () =
130130
expect(wrapper).toContainHTML('aria-controls="content-id"');
131131
});
132132

133-
test(`Does not render with class pf-m-detached by default`, () => {
134-
render(<ExpandableSection>Test content</ExpandableSection>);
135-
136-
expect(screen.getByText('Test content').parentElement).not.toHaveClass('pf-m-detached');
137-
});
138-
139-
test(`Renders with class pf-m-detached when isDetached is true`, () => {
140-
render(<ExpandableSection isDetached>Test content</ExpandableSection>);
141-
142-
expect(screen.getByText('Test content').parentElement).toHaveClass('pf-m-detached');
143-
});
144-
145133
test(`Does not render with classes pf-m-expand-top nor pf-m-expand-bottom by default`, () => {
146134
render(<ExpandableSection>Test content</ExpandableSection>);
147135

@@ -156,13 +144,13 @@ test(`Does not render with classes pf-m-expand-top nor pf-m-expand-bottom when o
156144
expect(screen.getByText('Test content').parentElement).not.toHaveClass('pf-m-expand-bottom');
157145
});
158146

159-
test(`Does not render with class pf-m-expand-top when only direction="up"`, () => {
147+
test(`Does not render with class pf-m-expand-top when direction="up" and isDetached is false`, () => {
160148
render(<ExpandableSection direction="up">Test content</ExpandableSection>);
161149

162150
expect(screen.getByText('Test content').parentElement).not.toHaveClass('pf-m-expand-top');
163151
});
164152

165-
test(`Does not render with class pf-m-expand-bottom when only direction="down"`, () => {
153+
test(`Does not render with class pf-m-expand-bottom when direction="down" and isDetached is false`, () => {
166154
render(<ExpandableSection direction="down">Test content</ExpandableSection>);
167155

168156
expect(screen.getByText('Test content').parentElement).not.toHaveClass('pf-m-expand-bottom');

packages/react-core/src/components/ExpandableSection/__tests__/ExpandableSectionToggle.test.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,3 @@ test('Renders with children', () => {
1414

1515
expect(screen.getByRole('button')).toHaveTextContent('Toggle test');
1616
});
17-
18-
test('Renders with class pf-m-detached by default', () => {
19-
render(<ExpandableSectionToggle data-testid="section-wrapper">Toggle test</ExpandableSectionToggle>);
20-
21-
expect(screen.getByTestId('section-wrapper')).toHaveClass('pf-m-detached');
22-
});
23-
24-
test('Does not render with class pf-m-detached when isDetached is false', () => {
25-
render(
26-
<ExpandableSectionToggle isDetached={false} data-testid="section-wrapper">
27-
Toggle test
28-
</ExpandableSectionToggle>
29-
);
30-
31-
expect(screen.getByTestId('section-wrapper')).not.toHaveClass('pf-m-detached');
32-
});

0 commit comments

Comments
 (0)