Skip to content

Commit

Permalink
Add test for <script context="module">
Browse files Browse the repository at this point in the history
  • Loading branch information
secondfry committed Feb 28, 2024
1 parent 61f8ea1 commit 0d4cf47
Show file tree
Hide file tree
Showing 2 changed files with 212 additions and 0 deletions.
145 changes: 145 additions & 0 deletions tests/Svelte/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,150 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`module.svelte - svelte-verify: module.svelte 1`] = `
<script context="module">
// I am top level comment in this file.
import z from 'z';
import threeLevelRelativePath from "../../../threeLevelRelativePath";
import sameLevelRelativePath from "./sameLevelRelativePath";
import thirdParty from "third-party";
import oneLevelRelativePath from "../oneLevelRelativePath";
import otherthing from "@core/otherthing";
import abc from "@core/abc";
import twoLevelRelativePath from "../../twoLevelRelativePath";
import component from "@ui/hello";
import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import something from "@server/something";
import xyz from "@ui/xyz";
import { defineComponent } from 'vue';
import Header from './Header.svelte';
import './styles.css';
</script>
<div class="app">
<Header />
<main>
<slot />
</main>
<footer>
<p>visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit</p>
</footer>
</div>
<style>
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1;
display: flex;
flex-direction: column;
padding: 1rem;
width: 100%;
max-width: 64rem;
margin: 0 auto;
box-sizing: border-box;
}
footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 12px;
}
footer a {
font-weight: bold;
}
@media (min-width: 480px) {
footer {
padding: 12px 0;
}
}
</style>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script context="module">
// I am top level comment in this file.
import thirdParty from "third-party";
import { defineComponent } from "vue";
import z from "z";
import abc from "@core/abc";
import otherthing from "@core/otherthing";
import something from "@server/something";
import component from "@ui/hello";
import xyz from "@ui/xyz";
import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import threeLevelRelativePath from "../../../threeLevelRelativePath";
import twoLevelRelativePath from "../../twoLevelRelativePath";
import oneLevelRelativePath from "../oneLevelRelativePath";
import Header from "./Header.svelte";
import sameLevelRelativePath from "./sameLevelRelativePath";
import "./styles.css";
</script>
<div class="app">
<Header />
<main>
<slot />
</main>
<footer>
<p>
visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit
</p>
</footer>
</div>
<style>
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1;
display: flex;
flex-direction: column;
padding: 1rem;
width: 100%;
max-width: 64rem;
margin: 0 auto;
box-sizing: border-box;
}
footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 12px;
}
footer a {
font-weight: bold;
}
@media (min-width: 480px) {
footer {
padding: 12px 0;
}
}
</style>
`;

exports[`questionable.svelte - svelte-verify: questionable.svelte 1`] = `
<script>
// Who?
Expand Down
67 changes: 67 additions & 0 deletions tests/Svelte/module.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<script context="module">
// I am top level comment in this file.
import z from 'z';
import threeLevelRelativePath from "../../../threeLevelRelativePath";
import sameLevelRelativePath from "./sameLevelRelativePath";
import thirdParty from "third-party";
import oneLevelRelativePath from "../oneLevelRelativePath";
import otherthing from "@core/otherthing";
import abc from "@core/abc";
import twoLevelRelativePath from "../../twoLevelRelativePath";
import component from "@ui/hello";
import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import something from "@server/something";
import xyz from "@ui/xyz";
import { defineComponent } from 'vue';
import Header from './Header.svelte';
import './styles.css';
</script>

<div class="app">
<Header />

<main>
<slot />
</main>

<footer>
<p>visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit</p>
</footer>
</div>

<style>
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1;
display: flex;
flex-direction: column;
padding: 1rem;
width: 100%;
max-width: 64rem;
margin: 0 auto;
box-sizing: border-box;
}
footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 12px;
}
footer a {
font-weight: bold;
}
@media (min-width: 480px) {
footer {
padding: 12px 0;
}
}
</style>

0 comments on commit 0d4cf47

Please sign in to comment.