Skip to content

Commit

Permalink
add missing export for hasContext (#5727)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhauhau authored Nov 27, 2020
1 parent 505eba8 commit ccc61a7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Svelte changelog

## Unreleased

* Actually export `hasContext` ([#5726](https://github.com/sveltejs/svelte/issues/5726))

## 3.30.0

* Add a typed `SvelteComponent` interface ([#5431](https://github.com/sveltejs/svelte/pull/5431))
Expand Down
1 change: 1 addition & 0 deletions src/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
afterUpdate,
setContext,
getContext,
hasContext,
tick,
createEventDispatcher,
SvelteComponentDev as SvelteComponent
Expand Down
7 changes: 7 additions & 0 deletions test/runtime/samples/context-api-c/Leaf.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
import { hasContext } from 'svelte';
const has = hasContext('test');
</script>

<div>{has}</div>
11 changes: 11 additions & 0 deletions test/runtime/samples/context-api-c/Nested.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
import { setContext } from 'svelte';
export let value = '';
if (value) {
setContext('test', value);
}
</script>

<slot></slot>
6 changes: 6 additions & 0 deletions test/runtime/samples/context-api-c/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
html: `
<div>true</div>
<div>false</div>
`
};
12 changes: 12 additions & 0 deletions test/runtime/samples/context-api-c/main.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
import Nested from "./Nested.svelte";
import Leaf from "./Leaf.svelte";
</script>

<Nested value="bar">
<Leaf />
</Nested>

<Nested>
<Leaf />
</Nested>

0 comments on commit ccc61a7

Please sign in to comment.