mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(code-snippet): dispatch "expand" and "collapse" events (#1291)
* test(code-snippet): simply assertions * feat(code-snippet): dispatch "expand," "collapse" events * Run "yarn build:docs" * test(code-snippet): assert events
This commit is contained in:
parent
e3f72e6412
commit
1454eeae19
5 changed files with 37 additions and 56 deletions
|
@ -1,4 +1,9 @@
|
|||
<script>
|
||||
/**
|
||||
* @event {null} expand
|
||||
* @event {null} collapse
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the type of code snippet
|
||||
* @type {"single" | "inline" | "multi"}
|
||||
|
@ -117,6 +122,7 @@
|
|||
if (code === undefined) setShowMoreLess();
|
||||
if (code) tick().then(setShowMoreLess);
|
||||
}
|
||||
$: if (type === "multi") dispatch(expanded ? "expand" : "collapse");
|
||||
|
||||
onMount(() => {
|
||||
return () => clearTimeout(timeout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue