Skip to content

Commit

Permalink
[EuiCode][EuiCodeBlock] Reinstate testenv mocks (#5464)
Browse files Browse the repository at this point in the history
* reinstate code testenv mocks

* add language data attr

* CL
  • Loading branch information
thompsongl authored Dec 13, 2021
1 parent 58b9ca3 commit 42f41f7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- Added `magnifyWithExclamation` icon ([#5455](https://github.com/elastic/eui/pull/5455))

**Bug fixes**

- Reinstated `EuiCode` and `EuiCodeBlock` `testenv` mocking ([#5464](https://github.com/elastic/eui/pull/5464))

## [`43.0.0`](https://github.com/elastic/eui/tree/v43.0.0)

- Updated the organization of `EuiDataGrid`'s toolbar/grid controls ([#5334](https://github.com/elastic/eui/pull/5334))
Expand Down
20 changes: 20 additions & 0 deletions src/components/code/code.testenv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
export const EuiCode = ({
children,
'data-test-subj': dataTestSubj,
language,
}: any) => {
return (
<code data-test-subj={dataTestSubj} data-code-language={language}>
{children}
</code>
);
};
32 changes: 32 additions & 0 deletions src/components/code/code_block.testenv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
export const EuiCodeBlock = ({
children,
'data-test-subj': dataTestSubj,
language,
}: any) => {
return (
<div>
<pre>
<code data-test-subj={dataTestSubj} data-code-language={language}>
{children}
</code>
</pre>
</div>
);
};

export const FONT_SIZES: Array<'s' | 'm' | 'l'> = ['s', 'm', 'l'];
export const PADDING_SIZES: Array<'s' | 'm' | 'l' | 'none'> = [
'none',
's',
'm',
'l',
];

0 comments on commit 42f41f7

Please sign in to comment.