chore(jest): stub carbon-icons-svelte

This commit is contained in:
Eric Liu 2020-01-01 15:44:23 -08:00
commit 68622ba613
2 changed files with 48 additions and 0 deletions

View file

@ -92,6 +92,9 @@
"js",
"svelte"
],
"moduleNameMapper": {
"^carbon-icons-svelte*": "<rootDir>src/internal/Icon.stub.svelte"
},
"setupFilesAfterEnv": [
"regenerator-runtime/runtime",
"@testing-library/jest-dom/extend-expect"

View file

@ -0,0 +1,45 @@
<script>
let className = undefined;
export { className as class };
export let id = undefined;
export let tabindex = undefined;
export let focusable = false;
export let title = undefined;
export let style = 'will-change: transform;';
const preserveAspectRatio = 'xMidYMid meet';
$: ariaLabel = $$props['aria-label'];
$: ariaLabelledBy = $$props['aria-labelledby'];
$: labelled = ariaLabel || ariaLabelledBy || title;
$: attributes = {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
'aria-hidden': labelled ? undefined : true,
role: labelled ? 'img' : undefined,
focusable: tabindex === '0' ? true : focusable,
tabindex
};
</script>
<svg
on:click
on:mouseover
on:mouseenter
on:mouseleave
on:keyup
on:keydown
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 32 32"
width="16"
height="16"
class={className}
{preserveAspectRatio}
{style}
{id}
{...attributes}>
<slot>
{#if title}
<title>{title}</title>
{/if}
</slot>
</svg>