-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(code_block): improve the unit test suite
- add back snapshot tests for initial render and virtualization - simplify some assertions - add unit tests for the: transparentBackground, overflowHeight, paddingSize and fontSize
- Loading branch information
1 parent
9299032
commit 6b5bc29
Showing
2 changed files
with
195 additions
and
11 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
packages/eui/src/components/code/__snapshots__/code_block.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiCodeBlock Virtualization renders a virtualized code block 1`] = ` | ||
<div | ||
class="euiCodeBlock testClass1 testClass2 emotion-euiCodeBlock-s-hasControls-euiTestCss" | ||
style="block-size: 50%;" | ||
> | ||
<div | ||
data-eui="EuiAutoSizer" | ||
> | ||
<pre | ||
class="euiCodeBlock__pre emotion-euiCodeBlock__pre-pre-padding-controlsOffset" | ||
style="position: relative; block-size: 600px; inline-size: 600px; overflow: auto; will-change: transform; direction: ltr;" | ||
tabindex="0" | ||
> | ||
<code | ||
aria-label="aria-label" | ||
class="euiCodeBlock__code emotion-euiCodeBlock__code-isVirtualized" | ||
data-code-language="text" | ||
data-test-subj="test subject string" | ||
style="block-size: 36px; inline-size: 100%;" | ||
> | ||
<span | ||
class="euiCodeBlock__line emotion-euiCodeBlock__line" | ||
style="position: absolute; inset-inline-start: 0; inset-block-start: 0; block-size: 18px; inline-size: 100%;" | ||
> | ||
var some = 'code'; | ||
</span> | ||
<span | ||
class="euiCodeBlock__line emotion-euiCodeBlock__line" | ||
style="position: absolute; inset-inline-start: 0; inset-block-start: 18px; block-size: 18px; inline-size: 100%;" | ||
> | ||
console.log(some); | ||
</span> | ||
</code> | ||
</pre> | ||
</div> | ||
<div | ||
class="euiCodeBlock__controls emotion-euiCodeBlock__controls-l" | ||
> | ||
<button | ||
aria-label="Expand" | ||
class="euiButtonIcon euiCodeBlock__fullScreenButton emotion-euiButtonIcon-xs-empty-text" | ||
type="button" | ||
> | ||
<span | ||
aria-hidden="true" | ||
class="euiButtonIcon__icon" | ||
color="inherit" | ||
data-euiicon-type="fullScreen" | ||
/> | ||
</button> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`EuiCodeBlock renders a code block 1`] = ` | ||
<div | ||
class="euiCodeBlock testClass1 testClass2 emotion-euiCodeBlock-s-euiTestCss" | ||
> | ||
<pre | ||
class="euiCodeBlock__pre emotion-euiCodeBlock__pre-preWrap-padding" | ||
tabindex="-1" | ||
> | ||
<code | ||
aria-label="aria-label" | ||
class="euiCodeBlock__code emotion-euiCodeBlock__code" | ||
data-code-language="text" | ||
data-test-subj="test subject string" | ||
> | ||
<span | ||
class="euiCodeBlock__line emotion-euiCodeBlock__line" | ||
> | ||
var some = 'code'; | ||
</span> | ||
<span | ||
class="euiCodeBlock__line emotion-euiCodeBlock__line" | ||
> | ||
console.log(some); | ||
</span> | ||
</code> | ||
</pre> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters