Skip to content

Commit c3ddc85

Browse files
authored
test: add test cases (#16)
1 parent 63c60d3 commit c3ddc85

File tree

6 files changed

+70
-0
lines changed

6 files changed

+70
-0
lines changed

index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ <h2>Tests</h2>
1515
<li><a href="/tests/bind.html">v-bind</a></li>
1616
<li><a href="/tests/on.html">v-on</a></li>
1717
<li><a href="/tests/if.html">v-if</a></li>
18+
<li><a href="/tests/show.html">v-show</a></li>
1819
<li><a href="/tests/for.html">v-for</a></li>
1920
<li><a href="/tests/model.html">v-model</a></li>
2021
<li><a href="/tests/once.html">v-once</a></li>
22+
<li><a href="/tests/html.html">v-html</a></li>
23+
<li><a href="/tests/text.html">v-text</a></li>
24+
<li><a href="/tests/pre.html">v-pre</a></li>
25+
<li><a href="/tests/reactive.html">reactive</a></li>
2126
<li><a href="/tests/multi-mount.html">Multi mount</a></li>
2227
</ul>
2328

tests/html.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script type="module">
2+
import { createApp } from '../src'
3+
createApp().mount()
4+
</script>
5+
6+
<div v-scope="{ ele:'<span>Hello World</span>' }">
7+
<p v-html="ele"></p>
8+
</div>
9+

tests/pre.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script type="module">
2+
import { createApp } from '../src'
3+
createApp().mount()
4+
</script>
5+
6+
<div v-scope="{ count: 0 }">
7+
<p>{{ count }}</p>
8+
<p v-pre> {{ count }}</p>
9+
<button @click="count++">increment</button>
10+
</div>

tests/reactive.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<script type="module">
2+
import { createApp, reactive } from '../src'
3+
4+
const store = reactive({
5+
count: 0,
6+
inc() {
7+
this.count++
8+
}
9+
})
10+
11+
// manipulate it here
12+
store.inc()
13+
14+
createApp({
15+
// share it with app scopes
16+
store
17+
}).mount()
18+
</script>
19+
20+
<div v-scope="{ localCount: 0 }">
21+
<p>Global {{ store.count }}</p>
22+
<button @click="store.inc">increment</button>
23+
24+
<p>Local {{ localCount }}</p>
25+
<button @click="localCount++">increment</button>
26+
</div>

tests/show.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script type="module">
2+
import { createApp } from '../src'
3+
4+
createApp().mount('#app')
5+
</script>
6+
7+
<div id="app" v-scope="{ open: true }">
8+
<button @click="open = !open">toggle</button>
9+
<div v-show="open">ok</div>
10+
</div>

tests/text.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script type="module">
2+
import { createApp } from '../src'
3+
createApp().mount()
4+
</script>
5+
6+
<div v-scope="{ count: 1 }">
7+
<p v-text="count"></p>
8+
<button @click="count++">increase</button>
9+
</div>
10+

0 commit comments

Comments
 (0)