svelte-declarative-testing 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ import prettier from 'eslint-config-prettier';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { includeIgnoreFile } from '@eslint/compat';
4
+ import js from '@eslint/js';
5
+ import svelte from 'eslint-plugin-svelte';
6
+ import { defineConfig } from 'eslint/config';
7
+ import globals from 'globals';
8
+ import ts from 'typescript-eslint';
9
+
10
+ const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
11
+
12
+ export default defineConfig(
13
+ includeIgnoreFile(gitignorePath),
14
+ js.configs.recommended,
15
+ ...ts.configs.recommended,
16
+ ...svelte.configs.recommended,
17
+ prettier,
18
+ ...svelte.configs.prettier,
19
+ {
20
+ languageOptions: { globals: { ...globals.browser, ...globals.node } },
21
+
22
+ rules: {
23
+ // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
24
+ // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
25
+ 'no-undef': 'off',
26
+ },
27
+ },
28
+ {
29
+ files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
30
+
31
+ languageOptions: {
32
+ parserOptions: {
33
+ projectService: true,
34
+ extraFileExtensions: ['.svelte'],
35
+ parser: ts.parser,
36
+ svelteConfig: {},
37
+ },
38
+ },
39
+ },
40
+ );
@@ -0,0 +1,35 @@
1
+ <script>
2
+ import { Test, Describe, Check } from '../../src/components/testing-library';
3
+ </script>
4
+
5
+ <Describe label="Basic test">
6
+ {#snippet tests()}
7
+ <Test it="finds the rendered component">
8
+ <button>Click me</button>
9
+
10
+ {#snippet checks()}
11
+ <Check
12
+ fn={({ getByRole }) => {
13
+ expect(getByRole('button', { name: 'Click me' })).not.toBe(null);
14
+ }}
15
+ />
16
+ {/snippet}
17
+ </Test>
18
+
19
+ <Describe label="Nested describe">
20
+ {#snippet tests()}
21
+ <Test it="also passes">
22
+ <button>Click me</button>
23
+
24
+ {#snippet checks()}
25
+ <Check
26
+ fn={({ getByRole }) => {
27
+ expect(getByRole('button', { name: 'Click me' })).not.toBe(null);
28
+ }}
29
+ />
30
+ {/snippet}
31
+ </Test>
32
+ {/snippet}
33
+ </Describe>
34
+ {/snippet}
35
+ </Describe>