Skip to content

Commit

Permalink
Convert display selector width style
Browse files Browse the repository at this point in the history
- just inline it in the component, since it's super minor

+ update Enzyme tests to RTL, snapshot full popover
  • Loading branch information
cee-chen committed Sep 4, 2024
1 parent 0bdf395 commit 2e3b8d3
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -1,78 +1,251 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`useDataGridDisplaySelector displaySelector renders a toolbar button/popover allowing users to customize display settings 1`] = `
<Fragment>
<EuiPopover
anchorPosition="downRight"
button={
<EuiToolTip
content="Display options"
delay="long"
display="inlineBlock"
position="top"
<body>
<div>
<div
class="euiPopover emotion-euiPopover-inline-block"
data-test-subj="dataGridDisplaySelectorPopover"
>
<span
class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock"
>
<EuiButtonIcon
<button
aria-label="Display options"
color="text"
class="euiButtonIcon emotion-euiButtonIcon-xs-empty-text"
data-test-subj="dataGridDisplaySelectorButton"
iconType="controlsHorizontal"
onClick={[Function]}
size="xs"
/>
</EuiToolTip>
}
closePopover={[Function]}
data-test-subj="dataGridDisplaySelectorPopover"
display="inline-block"
hasArrow={true}
isOpen={false}
ownFocus={true}
panelClassName="euiDataGrid__displayPopoverPanel"
panelPaddingSize="s"
repositionToCrossAxis={true}
type="button"
>
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="controlsHorizontal"
/>
</button>
</span>
</div>
</div>
<div
data-euiportal="true"
>
<EuiI18n
defaults={
[
"Density",
"Compact",
"Normal",
"Expanded",
]
}
tokens={
[
"euiDisplaySelector.densityLabel",
"euiDisplaySelector.labelCompact",
"euiDisplaySelector.labelNormal",
"euiDisplaySelector.labelExpanded",
]
}
>
<Component />
</EuiI18n>
<EuiI18n
defaults={
[
"Row height",
"Single",
"Auto fit",
"Custom",
"Lines per row",
]
}
tokens={
[
"euiDisplaySelector.rowHeightLabel",
"euiDisplaySelector.labelSingle",
"euiDisplaySelector.labelAuto",
"euiDisplaySelector.labelCustom",
"euiDisplaySelector.lineCountLabel",
]
}
<div
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="-1"
/>
<div
data-focus-lock-disabled="disabled"
>
<Component />
</EuiI18n>
</EuiPopover>
</Fragment>
<div
aria-describedby="generated-id"
aria-live="off"
aria-modal="true"
class="euiPanel euiPanel--plain euiPanel--paddingSmall euiPopover__panel euiDataGrid__displayPopoverPanel emotion-euiPanel-grow-m-s-plain-euiPopover__panel-light-hasTransform"
data-autofocus="true"
data-popover-panel="true"
role="dialog"
style="top: 16px; left: -22px; will-change: transform, opacity; z-index: 2000;"
tabindex="0"
>
<div
class="euiPopover__arrow emotion-euiPopoverArrow-bottom"
data-popover-arrow="bottom"
style="left: 10px; top: 0px;"
/>
<p
class="emotion-euiScreenReaderOnly"
id="generated-id"
>
You are in a dialog. Press Escape, or tap/click outside the dialog to close.
</p>
<div>
<div
class="euiFormRow euiFormRow--hasLabel emotion-euiFormRow-columnCompressed"
id="generated-id-row"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label emotion-euiFormLabel"
for="generated-id"
id="generated-id-label"
>
Density
</label>
</div>
<div
class="euiFormRow__fieldWrapper"
>
<fieldset
class="euiButtonGroup emotion-euiButtonGroup-fullWidth"
data-test-subj="densityButtonGroup"
id="generated-id"
>
<legend
class="emotion-euiScreenReaderOnly"
>
Density
</legend>
<div
class="euiButtonGroup__buttons emotion-euiButtonGroup__buttons-fullWidth-compressed"
>
<button
aria-pressed="false"
class="euiButtonGroupButton emotion-euiButtonDisplay-s-defaultMinWidth-euiButtonGroupButton-compressed-empty-text"
data-test-subj="compact"
title="Compact"
type="button"
>
<span
class="emotion-euiButtonDisplayContent-euiButtonGroupButton__content-compressed"
>
<span
class="eui-textTruncate emotion-euiButtonGroupButton__text"
data-text="Compact"
>
Compact
</span>
</span>
</button>
<button
aria-pressed="false"
class="euiButtonGroupButton emotion-euiButtonDisplay-s-defaultMinWidth-euiButtonGroupButton-compressed-empty-text"
data-test-subj="normal"
title="Normal"
type="button"
>
<span
class="emotion-euiButtonDisplayContent-euiButtonGroupButton__content-compressed"
>
<span
class="eui-textTruncate emotion-euiButtonGroupButton__text"
data-text="Normal"
>
Normal
</span>
</span>
</button>
<button
aria-pressed="false"
class="euiButtonGroupButton emotion-euiButtonDisplay-s-defaultMinWidth-euiButtonGroupButton-compressed-empty-text"
data-test-subj="expanded"
title="Expanded"
type="button"
>
<span
class="emotion-euiButtonDisplayContent-euiButtonGroupButton__content-compressed"
>
<span
class="eui-textTruncate emotion-euiButtonGroupButton__text"
data-text="Expanded"
>
Expanded
</span>
</span>
</button>
</div>
</fieldset>
</div>
</div>
<div
class="euiFormRow euiFormRow--hasLabel emotion-euiFormRow-columnCompressed"
id="generated-id-row"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label emotion-euiFormLabel"
for="generated-id"
id="generated-id-label"
>
Row height
</label>
</div>
<div
class="euiFormRow__fieldWrapper"
>
<fieldset
class="euiButtonGroup emotion-euiButtonGroup-fullWidth"
data-test-subj="rowHeightButtonGroup"
id="generated-id"
>
<legend
class="emotion-euiScreenReaderOnly"
>
Row height
</legend>
<div
class="euiButtonGroup__buttons emotion-euiButtonGroup__buttons-fullWidth-compressed"
>
<button
aria-pressed="true"
class="euiButtonGroupButton euiButtonGroupButton-isSelected emotion-euiButtonDisplay-s-defaultMinWidth-euiButtonGroupButton-compressed-fill-text"
data-test-subj="undefined"
title="Single"
type="button"
>
<span
class="emotion-euiButtonDisplayContent-euiButtonGroupButton__content-compressed"
>
<span
class="eui-textTruncate emotion-euiButtonGroupButton__text"
data-text="Single"
>
Single
</span>
</span>
</button>
<button
aria-pressed="false"
class="euiButtonGroupButton emotion-euiButtonDisplay-s-defaultMinWidth-euiButtonGroupButton-compressed-empty-text"
data-test-subj="auto"
title="Auto fit"
type="button"
>
<span
class="emotion-euiButtonDisplayContent-euiButtonGroupButton__content-compressed"
>
<span
class="eui-textTruncate emotion-euiButtonGroupButton__text"
data-text="Auto fit"
>
Auto fit
</span>
</span>
</button>
<button
aria-pressed="false"
class="euiButtonGroupButton emotion-euiButtonDisplay-s-defaultMinWidth-euiButtonGroupButton-compressed-empty-text"
data-test-subj="lineCount"
title="Custom"
type="button"
>
<span
class="emotion-euiButtonDisplayContent-euiButtonGroupButton__content-compressed"
>
<span
class="eui-textTruncate emotion-euiButtonGroupButton__text"
data-text="Custom"
>
Custom
</span>
</span>
</button>
</div>
</fieldset>
</div>
</div>
</div>
</div>
</div>
<div
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="-1"
/>
</div>
</body>
`;
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
.euiDataGrid__displayPopoverPanel {
width: $euiFormMaxWidth + $euiSize;
}
Loading

0 comments on commit 2e3b8d3

Please sign in to comment.