Revert "Merge branch 'master' of https://github.com/pushkine/svelte"

This reverts commit 25a631a78f, reversing
changes made to e68ebb40b0.
pull/4886/head
pushkine 5 years ago
parent 25a631a78f
commit 125ac529e8

@ -9,7 +9,7 @@ title: Template syntax
A lowercase tag, like `<div>`, denotes a regular HTML element. A capitalised tag, such as `<Widget>` or `<Namespace.Widget>`, indicates a *component*.
```html
```sv
<script>
import Widget from './Widget.svelte';
</script>
@ -26,7 +26,7 @@ A lowercase tag, like `<div>`, denotes a regular HTML element. A capitalised tag
By default, attributes work exactly like their HTML counterparts.
```html
```sv
<div class="foo">
<button disabled>can't touch this</button>
</div>
@ -36,7 +36,7 @@ By default, attributes work exactly like their HTML counterparts.
As in HTML, values may be unquoted.
```html
```sv
<input type=checkbox>
```
@ -44,7 +44,7 @@ As in HTML, values may be unquoted.
Attribute values can contain JavaScript expressions.
```html
```sv
<a href="page/{p}">page {p}</a>
```
@ -52,15 +52,26 @@ Attribute values can contain JavaScript expressions.
Or they can *be* JavaScript expressions.
```html
```sv
<button disabled={!clickable}>...</button>
```
---
An expression might include characters that would cause syntax highlighting to fail in regular HTML, so quoting the value is permitted. The quotes do not affect how the value is parsed:
Boolean attributes are included on the element if their value is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) and excluded if it's [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy).
All other attributes are included unless their value is [nullish](https://developer.mozilla.org/en-US/docs/Glossary/Nullish) (`null` or `undefined`).
```html
<input required={false} placeholder="This input field is not required">
<div title={null}>This div has no title attribute</div>
```
---
An expression might include characters that would cause syntax highlighting to fail in regular HTML, so quoting the value is permitted. The quotes do not affect how the value is parsed:
```sv
<button disabled="{number !== 42}">...</button>
```
@ -68,7 +79,7 @@ An expression might include characters that would cause syntax highlighting to f
When the attribute name and value match (`name={name}`), they can be replaced with `{name}`.
```html
```sv
<!-- These are equivalent -->
<button disabled={disabled}>...</button>
<button {disabled}>...</button>
@ -80,7 +91,7 @@ By convention, values passed to components are referred to as *properties* or *p
As with elements, `name={name}` can be replaced with the `{name}` shorthand.
```html
```sv
<Widget foo={bar} answer={42} text="hello"/>
```
@ -90,7 +101,7 @@ As with elements, `name={name}` can be replaced with the `{name}` shorthand.
An element or component can have multiple spread attributes, interspersed with regular ones.
```html
```sv
<Widget {...things}/>
```
@ -98,10 +109,19 @@ An element or component can have multiple spread attributes, interspersed with r
*`$$props`* references all props that are passed to a component including ones that are not declared with `export`. It is useful in rare cases, but not generally recommended, as it is difficult for Svelte to optimise.
```html
```sv
<Widget {...$$props}/>
```
---
*`$$restProps`* contains only the props which are *not* declared with `export`. It can be used to pass down other unknown attributes to an element in a component.
```html
<input {...$$restProps}>
```
---
### Text expressions
@ -113,7 +133,7 @@ An element or component can have multiple spread attributes, interspersed with r
Text can also contain JavaScript expressions:
```html
```sv
<h1>Hello {name}!</h1>
<p>{a} + {b} = {a + b}.</p>
```
@ -125,7 +145,7 @@ Text can also contain JavaScript expressions:
You can use HTML comments inside components.
```html
```sv
<!-- this is a comment! -->
<h1>Hello world</h1>
```
@ -134,7 +154,7 @@ You can use HTML comments inside components.
Comments beginning with `svelte-ignore` disable warnings for the next block of markup. Usually these are accessibility warnings; make sure that you're disabling them for a good reason.
```html
```sv
<!-- svelte-ignore a11y-autofocus -->
<input bind:value={name} autofocus>
```
@ -156,7 +176,7 @@ Comments beginning with `svelte-ignore` disable warnings for the next block of m
Content that is conditionally rendered can be wrapped in an if block.
```html
```sv
{#if answer === 42}
<p>what was the question?</p>
{/if}
@ -166,7 +186,7 @@ Content that is conditionally rendered can be wrapped in an if block.
Additional conditions can be added with `{:else if expression}`, optionally ending in an `{:else}` clause.
```html
```sv
{#if porridge.temperature > 100}
<p>too hot!</p>
{:else if 80 > porridge.temperature}
@ -186,6 +206,9 @@ Additional conditions can be added with `{:else if expression}`, optionally endi
{#each expression as name, index}...{/each}
```
```sv
{#each expression as name (key)}...{/each}
```
```sv
{#each expression as name, index (key)}...{/each}
```
```sv
@ -196,7 +219,7 @@ Additional conditions can be added with `{:else if expression}`, optionally endi
Iterating over lists of values can be done with an each block.
```html
```sv
<h1>Shopping list</h1>
<ul>
{#each items as item}
@ -211,7 +234,7 @@ You can use each blocks to iterate over any array or array-like value — that i
An each block can also specify an *index*, equivalent to the second argument in an `array.map(...)` callback:
```html
```sv
{#each items as item, i}
<li>{i + 1}: {item.name} x {item.qty}</li>
{/each}
@ -221,7 +244,12 @@ An each block can also specify an *index*, equivalent to the second argument in
If a *key* expression is provided — which must uniquely identify each list item — Svelte will use it to diff the list when data changes, rather than adding or removing items at the end. The key can be any object, but strings and numbers are recommended since they allow identity to persist when the objects themselves change.
```html
```sv
{#each items as item (item.id)}
<li>{item.name} x {item.qty}</li>
{/each}
<!-- or with additional index value -->
{#each items as item, i (item.id)}
<li>{i + 1}: {item.name} x {item.qty}</li>
{/each}
@ -231,7 +259,7 @@ If a *key* expression is provided — which must uniquely identify each list ite
You can freely use destructuring and rest patterns in each blocks.
```html
```sv
{#each items as { id, name, qty }, i (id)}
<li>{i + 1}: {name} x {qty}</li>
{/each}
@ -249,7 +277,7 @@ You can freely use destructuring and rest patterns in each blocks.
An each block can also have an `{:else}` clause, which is rendered if the list is empty.
```html
```sv
{#each todos as todo}
<p>{todo.text}</p>
{:else}
@ -274,7 +302,7 @@ An each block can also have an `{:else}` clause, which is rendered if the list i
Await blocks allow you to branch on the three possible states of a Promise — pending, fulfilled or rejected.
```html
```sv
{#await promise}
<!-- promise is pending -->
<p>waiting for the promise to resolve...</p>
@ -291,7 +319,7 @@ Await blocks allow you to branch on the three possible states of a Promise — p
The `catch` block can be omitted if you don't need to render anything when the promise rejects (or no error is possible).
```html
```sv
{#await promise}
<!-- promise is pending -->
<p>waiting for the promise to resolve...</p>
@ -305,7 +333,7 @@ The `catch` block can be omitted if you don't need to render anything when the p
If you don't care about the pending state, you can also omit the initial block.
```html
```sv
{#await promise then value}
<p>The value is {value}</p>
{/await}
@ -326,7 +354,7 @@ The expression should be valid standalone HTML — `{@html "<div>"}content{@html
> Svelte does not sanitize expressions before injecting HTML. If the data comes from an untrusted source, you must sanitize it, or you are exposing your users to an XSS vulnerability.
```html
```sv
<div class="blog-post">
<h1>{post.title}</h1>
{@html post.content}
@ -349,7 +377,7 @@ The `{@debug ...}` tag offers an alternative to `console.log(...)`. It logs the
It accepts a comma-separated list of variable names (not arbitrary expressions).
```html
```sv
<script>
let user = {
firstname: 'Ada',
@ -366,7 +394,7 @@ It accepts a comma-separated list of variable names (not arbitrary expressions).
`{@debug ...}` accepts a comma-separated list of variable names (not arbitrary expressions).
```html
```sv
<!-- Compiles -->
{@debug user}
{@debug user1, user2, user3}
@ -400,7 +428,7 @@ on:eventname|modifiers={handler}
Use the `on:` directive to listen to DOM events.
```html
```sv
<script>
let count = 0;
@ -418,7 +446,7 @@ Use the `on:` directive to listen to DOM events.
Handlers can be declared inline with no performance penalty. As with attributes, directive values may be quoted for the sake of syntax highlighters.
```html
```sv
<button on:click="{() => count += 1}">
count: {count}
</button>
@ -428,7 +456,7 @@ Handlers can be declared inline with no performance penalty. As with attributes,
Add *modifiers* to DOM events with the `|` character.
```html
```sv
<form on:submit|preventDefault={handleSubmit}>
<!-- the `submit` event's default is prevented,
so the page won't reload -->
@ -442,6 +470,7 @@ The following modifiers are available:
* `passive` — improves scrolling performance on touch/wheel events (Svelte will add it automatically where it's safe to do so)
* `capture` — fires the handler during the *capture* phase instead of the *bubbling* phase
* `once` — remove the handler after the first time it runs
* `self` — only trigger handler if event.target is the element itself
Modifiers can be chained together, e.g. `on:click|once|capture={...}`.
@ -449,7 +478,7 @@ Modifiers can be chained together, e.g. `on:click|once|capture={...}`.
If the `on:` directive is used without a value, the component will *forward* the event, meaning that a consumer of the component can listen for it.
```html
```sv
<button on:click>
The component itself will emit the click event
</button>
@ -459,7 +488,7 @@ If the `on:` directive is used without a value, the component will *forward* the
It's possible to have multiple event listeners for the same event:
```html
```sv
<script>
let counter = 0;
function increment() {
@ -486,7 +515,7 @@ Data ordinarily flows down, from parent to child. The `bind:` directive allows d
The simplest bindings reflect the value of a property, such as `input.value`.
```html
```sv
<input bind:value={name}>
<textarea bind:value={text}></textarea>
@ -497,7 +526,7 @@ The simplest bindings reflect the value of a property, such as `input.value`.
If the name matches the value, you can use a shorthand.
```html
```sv
<!-- These are equivalent -->
<input bind:value={value}>
<input bind:value>
@ -507,7 +536,7 @@ If the name matches the value, you can use a shorthand.
Numeric input values are coerced; even though `input.value` is a string as far as the DOM is concerned, Svelte will treat it as a number. If the input is empty or invalid (in the case of `type="number"`), the value is `undefined`.
```html
```sv
<input type="number" bind:value={num}>
<input type="range" bind:value={num}>
```
@ -519,7 +548,7 @@ Numeric input values are coerced; even though `input.value` is a string as far a
A `<select>` value binding corresponds to the `value` property on the selected `<option>`, which can be any value (not just strings, as is normally the case in the DOM).
```html
```sv
<select bind:value={selected}>
<option value={a}>a</option>
<option value={b}>b</option>
@ -531,7 +560,7 @@ A `<select>` value binding corresponds to the `value` property on the selected `
A `<select multiple>` element behaves similarly to a checkbox group.
```html
```sv
<select multiple bind:value={fillings}>
<option value="Rice">Rice</option>
<option value="Beans">Beans</option>
@ -544,7 +573,7 @@ A `<select multiple>` element behaves similarly to a checkbox group.
When the value of an `<option>` matches its text content, the attribute can be omitted.
```html
```sv
<select multiple bind:value={fillings}>
<option>Rice</option>
<option>Beans</option>
@ -557,7 +586,7 @@ When the value of an `<option>` matches its text content, the attribute can be o
Elements with the `contenteditable` attribute support `innerHTML` and `textContent` bindings.
```html
```sv
<div contenteditable="true" bind:innerHTML={html}></div>
```
@ -574,16 +603,17 @@ Media elements (`<audio>` and `<video>`) have their own set of bindings — six
* `seeking` (readonly) — boolean
* `ended` (readonly) — boolean
...and four *two-way* bindings:
...and five *two-way* bindings:
* `currentTime` — the current point in the video, in seconds
* `playbackRate` — how fast to play the video, where 1 is 'normal'
* `paused` — this one should be self-explanatory
* `volume` — a value between 0 and 1
* `muted` — a boolean value where true is muted
Videos additionally have readonly `videoWidth` and `videoHeight` bindings.
```html
```sv
<video
src={clip}
bind:duration
@ -595,6 +625,7 @@ Videos additionally have readonly `videoWidth` and `videoHeight` bindings.
bind:currentTime
bind:paused
bind:volume
bind:muted
bind:videoWidth
bind:videoHeight
></video>
@ -611,7 +642,7 @@ Block-level elements have 4 readonly bindings, measured using a technique simila
* `offsetWidth`
* `offsetHeight`
```html
```sv
<div
bind:offsetWidth={width}
bind:offsetHeight={height}
@ -630,7 +661,7 @@ bind:group={variable}
Inputs that work together can use `bind:group`.
```html
```sv
<script>
let tortilla = 'Plain';
let fillings = [];
@ -658,7 +689,7 @@ bind:this={dom_node}
To get a reference to a DOM node, use `bind:this`.
```html
```sv
<script>
import { onMount } from 'svelte';
@ -687,7 +718,7 @@ class:name
A `class:` directive provides a shorter way of toggling a class on an element.
```html
```sv
<!-- These are equivalent -->
<div class="{active ? 'active' : ''}">...</div>
<div class:active={active}>...</div>
@ -720,7 +751,7 @@ action = (node: HTMLElement, parameters: any) => {
Actions are functions that are called when an element is created. They can return an object with a `destroy` method that is called after the element is unmounted:
```html
```sv
<script>
function foo(node) {
// the node has been mounted in the DOM
@ -742,7 +773,7 @@ An action can have parameters. If the returned value has an `update` method, it
> Don't worry about the fact that we're redeclaring the `foo` function for every component instance — Svelte will hoist any functions that don't depend on local state out of the component definition.
```html
```sv
<script>
export let bar;
@ -795,11 +826,11 @@ transition = (node: HTMLElement, params: any) => {
A transition is triggered by an element entering or leaving the DOM as a result of a state change.
Elements inside an *outroing* block are kept in the DOM until all current transitions have completed.
When a block is transitioning out, all elements inside the block, including those that do not have their own transitions, are kept in the DOM until every transition in the block has completed.
The `transition:` directive indicates a *bidirectional* transition, which means it can be smoothly reversed while the transition is in progress.
```html
```sv
{#if visible}
<div transition:fade>
fades in and out
@ -817,7 +848,7 @@ Like actions, transitions can have parameters.
(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
```html
```sv
{#if visible}
<div transition:fade="{{ duration: 2000 }}">
flies in, fades out over two seconds
@ -835,7 +866,7 @@ The `t` argument passed to `css` is a value between `0` and `1` after the `easin
The function is called repeatedly *before* the transition begins, with different `t` and `u` arguments.
```html
```sv
<script>
import { elasticOut } from 'svelte/easing';
@ -866,14 +897,14 @@ A custom transition function can also return a `tick` function, which is called
> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
```html
```sv
<script>
export let visible = false;
function typewriter(node, { speed = 50 }) {
const valid = (
node.childNodes.length === 1 &&
node.childNodes[0].nodeType === 3
node.childNodes[0].nodeType === Node.TEXT_NODE
);
if (!valid) return {};
@ -912,7 +943,7 @@ An element with transitions will dispatch the following events in addition to an
* `outrostart`
* `outroend`
```html
```sv
{#if visible}
<p
transition:fly="{{ y: 200, duration: 2000 }}"
@ -930,7 +961,7 @@ An element with transitions will dispatch the following events in addition to an
Local transitions only play when the block they belong to is created or destroyed, *not* when parent blocks are created or destroyed.
```html
```sv
{#if x}
{#if y}
<p transition:fade>
@ -979,9 +1010,7 @@ Similar to `transition:`, but only applies to elements entering (`in:`) or leavi
Unlike with `transition:`, transitions applied with `in:` and `out:` are not bidirectional — an in transition will continue to 'play' alongside the out transition, rather than reversing, if the block is outroed while the transition is in progress. If an out transition is aborted, transitions will restart from scratch.
If an `out:` custom transition function returns a promise instead of a transition object, svelte will simply await its completion before unmounting the node.
```html
```sv
{#if visible}
<div in:fly out:fade>
flies in, fades out
@ -1030,7 +1059,7 @@ An animation is triggered when the contents of a [keyed each block](docs#each) a
Animations can be used with Svelte's [built-in animation functions](docs#svelte_animate) or [custom animation functions](docs#Custom_animation_functions).
```html
```sv
<!-- When `list` is reordered the animation will run-->
{#each list as item, index (item)}
<li animate:flip>{item}</li>
@ -1045,7 +1074,7 @@ As with actions and transitions, animations can have parameters.
(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
```html
```sv
{#each list as item, index (item)}
<li animate:flip="{{ delay: 500 }}">{item}</li>
{/each}
@ -1064,7 +1093,7 @@ The `t` argument passed to `css` is a value that goes from `0` and `1` after the
The function is called repeatedly *before* the animation begins, with different `t` and `u` arguments.
```html
```sv
<script>
import { cubicOut } from 'svelte/easing';
@ -1097,7 +1126,7 @@ A custom animation function can also return a `tick` function, which is called *
> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
```html
```sv
<script>
import { cubicOut } from 'svelte/easing';
@ -1137,7 +1166,7 @@ on:eventname={handler}
Components can emit events using [createEventDispatcher](docs#createEventDispatcher), or by forwarding DOM events. Listening for component events looks the same as listening for DOM events:
```html
```sv
<SomeComponent on:whatever={handler}/>
```
@ -1145,7 +1174,7 @@ Components can emit events using [createEventDispatcher](docs#createEventDispatc
As with DOM events, if the `on:` directive is used without a value, the component will *forward* the event, meaning that a consumer of the component can listen for it.
```html
```sv
<SomeComponent on:whatever/>
```
@ -1160,7 +1189,7 @@ bind:property={variable}
You can bind to component props using the same syntax as for elements.
```html
```sv
<Keypad bind:value={pin}/>
```
@ -1176,7 +1205,7 @@ Components also support `bind:this`, allowing you to interact with component ins
> Note that we can't do `{cart.empty}` since `cart` is `undefined` when the button is first rendered and throws an error.
```html
```sv
<ShoppingCart bind:this={cart}/>
<button on:click={() => cart.empty()}>
@ -1204,7 +1233,7 @@ Components can have child content, in the same way that elements can.
The content is exposed in the child component using the `<slot>` element, which can contain fallback content that is rendered if no children are provided.
```html
```sv
<!-- App.svelte -->
<Widget></Widget>
@ -1226,7 +1255,7 @@ The content is exposed in the child component using the `<slot>` element, which
Named slots allow consumers to target specific areas. They can also have fallback content.
```html
```sv
<!-- App.svelte -->
<Widget>
<h1 slot="header">Hello</h1>
@ -1249,17 +1278,17 @@ Slots can be rendered zero or more times, and can pass values *back* to the pare
The usual shorthand rules apply — `let:item` is equivalent to `let:item={item}`, and `<slot {item}>` is equivalent to `<slot item={item}>`.
```html
```sv
<!-- App.svelte -->
<FancyList {items} let:item={item}>
<div>{item.text}</div>
<FancyList {items} let:prop={thing}>
<div>{thing.text}</div>
</FancyList>
<!-- FancyList.svelte -->
<ul>
{#each items as item}
<li class="fancy">
<slot item={item}></slot>
<slot prop={item}></slot>
</li>
{/each}
</ul>
@ -1269,10 +1298,10 @@ The usual shorthand rules apply — `let:item` is equivalent to `let:item={item}
Named slots can also expose values. The `let:` directive goes on the element with the `slot` attribute.
```html
```sv
<!-- App.svelte -->
<FancyList {items}>
<div slot="item" let:item={item}>{item.text}</div>
<div slot="item" let:item>{item.text}</div>
<p slot="footer">Copyright (c) 2019 Svelte Industries</p>
</FancyList>
@ -1280,7 +1309,7 @@ Named slots can also expose values. The `let:` directive goes on the element wit
<ul>
{#each items as item}
<li class="fancy">
<slot name="item" item={item}></slot>
<slot name="item" {item}></slot>
</li>
{/each}
</ul>
@ -1297,7 +1326,7 @@ The `<svelte:self>` element allows a component to include itself, recursively.
It cannot appear at the top level of your markup; it must be inside an if or each block to prevent an infinite loop.
```html
```sv
<script>
export let count;
</script>
@ -1322,7 +1351,7 @@ The `<svelte:component>` element renders a component dynamically, using the comp
If `this` is falsy, no component is rendered.
```html
```sv
<svelte:component this={currentSelection.component} foo={bar}/>
```
@ -1340,7 +1369,7 @@ If `this` is falsy, no component is rendered.
The `<svelte:window>` element allows you to add event listeners to the `window` object without worrying about removing them when the component is destroyed, or checking for the existence of `window` when server-side rendering.
```html
```sv
<script>
function handleKeydown(event) {
alert(`pressed the ${event.key} key`);
@ -1364,7 +1393,7 @@ You can also bind to the following properties:
All except `scrollX` and `scrollY` are readonly.
```html
```sv
<svelte:window bind:scrollY={y}/>
```
@ -1379,7 +1408,7 @@ All except `scrollX` and `scrollY` are readonly.
As with `<svelte:window>`, this element allows you to add listeners to events on `document.body`, such as `mouseenter` and `mouseleave` which don't fire on `window`.
```html
```sv
<svelte:body
on:mouseenter={handleMouseenter}
on:mouseleave={handleMouseleave}
@ -1397,7 +1426,7 @@ As with `<svelte:window>`, this element allows you to add listeners to events on
This element makes it possible to insert elements into `document.head`. During server-side rendering, `head` content is exposed separately to the main `html` content.
```html
```sv
<svelte:head>
<link rel="stylesheet" href="tutorial/dark-theme.css">
</svelte:head>
@ -1421,6 +1450,6 @@ The `<svelte:options>` element provides a place to specify per-component compile
* `namespace="..."` — the namespace where this component will be used, most commonly "svg"
* `tag="..."` — the name to use when compiling this component as a custom element
```html
```sv
<svelte:options tag="my-custom-element"/>
```

@ -68,7 +68,6 @@ export function transition_out(block, local: 0 | 1, detach: 0 | 1, callback) {
const null_transition: TransitionConfig = { duration: 0 };
type TransitionFn = (node: Element, params: any) => TransitionConfig;
type PromiseFn = (node: Element, params: any) => Promise<any>
export function create_in_transition(node: Element & ElementCSSInlineStyle, fn: TransitionFn, params: any) {
let config = fn(node, params);
@ -151,7 +150,7 @@ export function create_in_transition(node: Element & ElementCSSInlineStyle, fn:
};
}
export function create_out_transition(node: Element & ElementCSSInlineStyle, fn: TransitionFn | PromiseFn, params: any) {
export function create_out_transition(node: Element & ElementCSSInlineStyle, fn: TransitionFn, params: any) {
let config = fn(node, params);
let running = true;
let animation_name;
@ -160,19 +159,6 @@ export function create_out_transition(node: Element & ElementCSSInlineStyle, fn:
group.r += 1;
function started() {
add_render_callback(() => dispatch(node, false, 'start'));
}
function ended() {
dispatch(node, false, 'end');
if (!--group.r) {
// this will result in `end()` being called,
// so we don't need to clean up here
run_all(group.c);
}
}
function go() {
const {
delay = 0,
@ -180,21 +166,27 @@ export function create_out_transition(node: Element & ElementCSSInlineStyle, fn:
easing = linear,
tick = noop,
css
} = config as TransitionConfig || null_transition;
} = config || null_transition;
if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css);
const start_time = now() + delay;
const end_time = start_time + duration;
started();
add_render_callback(() => dispatch(node, false, 'start'));
loop(now => {
if (running) {
if (now >= end_time) {
tick(0, 1);
ended();
dispatch(node, false, 'end');
if (!--group.r) {
// this will result in `end()` being called,
// so we don't need to clean up here
run_all(group.c);
}
return false;
}
@ -215,16 +207,13 @@ export function create_out_transition(node: Element & ElementCSSInlineStyle, fn:
config = config();
go();
});
} else if (config && 'then' in config) {
started();
config.then(ended).catch(ended);
} else {
go();
}
return {
end(reset) {
if (reset && 'tick' in config) {
if (reset && config.tick) {
config.tick(1, 0);
}

@ -1,14 +0,0 @@
export default {
props: {
visible: true,
},
test({ assert, component, target }) {
component.visible = false;
assert.notEqual(target.querySelector('span'), undefined);
component.resolve();
setTimeout(() => {
assert.equal(target.querySelector('span'), undefined);
});
},
};

@ -1,14 +0,0 @@
<script>
export let visible;
export let resolve
function foo(node, params) {
return new Promise(r => {
resolve = r
});
}
</script>
{#if visible}
<span out:foo>hello</span>
{/if}
Loading…
Cancel
Save