All files / src/push-button PushButton.svelte

42.05% Statements 90/214
37.7% Branches 46/122
31.03% Functions 18/58
44.26% Lines 81/183

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56      1x 1x 1x 1x 1x             1x                         1x   1x 8x     1x 1x 1x   1x   1x     1x 1x     12x                  
{#if $$slots.default}
	<Button
		class="push-button {className}"
		aria-pressed="{pressed}"
		{...props}
		{success}
		{warning}
		{danger}
		{round}
		{icon}
		bind:this="{_this}"
		on:mousedown="{onMouseDown}">
			<slot></slot>
	</Button>
{:else}
	<Button
		class="push-button {className}"
		aria-pressed="{pressed}"
		{...props}
		{success}
		{warning}
		{danger}
		{round}
		{icon}
		bind:this="{_this}"
		on:mousedown="{onMouseDown}"/>
{/if}
<script>
import { createEventDispatcher } from 'svelte';
import { Button } from '../button';
import { pluck } from '../util';
 
export let _this = undefined;
export let pressed = false;
 
export let success = false;
export let warning = false;
export let danger = false;
 
export let icon = undefined;	// name of the icon
export let round = undefined;	// round button
 
let className = '';
export { className as class };
 
$:props = pluck($$props, ['id', 'title', 'disabled']);
 
 
const dispatch = createEventDispatcher();
 
function onMouseDown (e) {
	pressed = !pressed;
	dispatch('click', e);
}
</script>