-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused $derive, add mutation e2e test
- Loading branch information
1 parent
b133543
commit 8188ccf
Showing
7 changed files
with
97 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query Svelte5MutationGetData { | ||
user(id: "1", snapshot: "svelte-5-mutation") { | ||
name | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script lang="ts"> | ||
import { graphql } from '$houdini'; | ||
import type { PageData } from './$houdini'; | ||
const { data }: { data: PageData } = $props(); | ||
const { Svelte5MutationGetData } = $derived(data); | ||
const changeNameMutation = graphql(` | ||
mutation Svelte5MutationChangeName($name: String!) { | ||
updateUser(id: "1", name: $name, snapshot: "svelte-5-mutation") { | ||
id | ||
name | ||
} | ||
} | ||
`); | ||
const changeName = () => { | ||
changeNameMutation.mutate({ | ||
name: 'Seppe' | ||
}); | ||
}; | ||
</script> | ||
|
||
<div id="result">{$Svelte5MutationGetData.data?.user.name}</div> | ||
|
||
<button id="mutate" onclick={changeName}>rename</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import test from '@playwright/test'; | ||
import { routes } from '../../../lib/utils/routes'; | ||
import { expect_1_gql, expect_to_be, goto } from '../../../lib/utils/testsHelper'; | ||
|
||
test.describe('Svelte 5 runes mutation', () => { | ||
test('run mutation', async ({ page }) => { | ||
await goto(page, routes.Svelte5_Runes_Mutation); | ||
|
||
await expect_to_be(page, 'Bruce Willis'); | ||
|
||
await expect_1_gql(page, 'button[id=mutate]'); | ||
|
||
await expect_to_be(page, 'Seppe'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters