@@ -475,15 +475,15 @@ This is designed to mock variables injected by third party plugins, not Vue's na
475
475
< button @click = " onClick" / >
476
476
< / template >
477
477
478
- <>
478
+ <script >
479
479
export default {
480
480
methods: {
481
481
onClick() {
482
482
this .$store .dispatch (' click' )
483
483
}
484
484
}
485
485
}
486
- < / >
486
+ < / script >
487
487
` ` `
488
488
489
489
` Component .spec .js ` :
@@ -576,7 +576,7 @@ provide?: Record<any, any>
576
576
<div >Theme is {{ theme }}< / div >
577
577
< / template >
578
578
579
- <>
579
+ <script >
580
580
import { inject } from ' vue'
581
581
582
582
export default {
@@ -587,7 +587,7 @@ export default {
587
587
}
588
588
}
589
589
}
590
- < / >
590
+ < / script >
591
591
` ` `
592
592
593
593
` Component .spec .js ` :
@@ -650,13 +650,13 @@ Defaults to **false**.
650
650
< another - component / >
651
651
< / template >
652
652
653
- <>
653
+ <script >
654
654
export default {
655
655
components: {
656
656
AnotherComponent
657
657
}
658
658
}
659
- < / >
659
+ < / script >
660
660
` ` `
661
661
662
662
` AnotherComponent .vue `
@@ -713,13 +713,13 @@ It stubs `Transition` and `TransitionGroup` by default.
713
713
<div ><foo /></div >
714
714
< / template >
715
715
716
- <>
716
+ <script >
717
717
import Foo from ' @/Foo.vue'
718
718
719
719
export default {
720
720
components: { Foo }
721
721
}
722
- < / >
722
+ < / script >
723
723
` ` `
724
724
725
725
` Component .spec .js ` :
@@ -786,14 +786,14 @@ Defaults to **false**.
786
786
< another - component / >
787
787
< / template >
788
788
789
- <>
789
+ <script >
790
790
export default {
791
791
components: {
792
792
AComponent ,
793
793
AnotherComponent
794
794
}
795
795
}
796
- < / >
796
+ < / script >
797
797
` ` `
798
798
799
799
` Component .spec .js `
@@ -842,15 +842,15 @@ attributes(key?: string): { [key: string]: string } | string
842
842
< div id = " foo" :class = " className" / >
843
843
< / template >
844
844
845
- <>
845
+ <script >
846
846
export default {
847
847
data() {
848
848
return {
849
849
className: ' bar'
850
850
}
851
851
}
852
852
}
853
- < / >
853
+ < / script >
854
854
` ` `
855
855
856
856
` Component .spec .js ` :
@@ -923,14 +923,14 @@ The arguments are stored in an array, so you can verify which arguments were emi
923
923
` Component .vue ` :
924
924
925
925
` ` ` vue
926
- <>
926
+ <script >
927
927
export default {
928
928
created() {
929
929
this .$emit (' greet' , ' hello' )
930
930
this .$emit (' greet' , ' goodbye' )
931
931
}
932
932
}
933
- < / >
933
+ < / script >
934
934
` ` `
935
935
936
936
` Component .spec .js ` :
@@ -1096,11 +1096,11 @@ findComponent<T extends ComponentPublicInstance>(selector: any): VueWrapper<T>
1096
1096
<div class = " foo" >Foo </div >
1097
1097
</template >
1098
1098
1099
- <>
1099
+ <script >
1100
1100
export default {
1101
1101
name: ' Foo'
1102
1102
}
1103
- </>
1103
+ </script >
1104
1104
` ` `
1105
1105
1106
1106
` Component .vue ` :
@@ -1110,13 +1110,13 @@ export default {
1110
1110
<Foo data -test = " foo" ref = " foo" class = " foo" />
1111
1111
</template >
1112
1112
1113
- <>
1113
+ <script >
1114
1114
import Foo from ' @/Foo'
1115
1115
1116
1116
export default {
1117
1117
components: { Foo }
1118
1118
}
1119
- </>
1119
+ </script >
1120
1120
` ` `
1121
1121
1122
1122
` Component .spec .js `
@@ -1257,11 +1257,11 @@ It is similar to `findComponent`, but `getComponent` throws instead of returning
1257
1257
<div class = " foo" >Foo </div >
1258
1258
</template >
1259
1259
1260
- <>
1260
+ <script >
1261
1261
export default {
1262
1262
name: ' Foo'
1263
1263
}
1264
- </>
1264
+ </script >
1265
1265
` ` `
1266
1266
1267
1267
` Component .vue ` :
@@ -1271,13 +1271,13 @@ export default {
1271
1271
<Foo />
1272
1272
</template >
1273
1273
1274
- <>
1274
+ <script >
1275
1275
import Foo from ' @/Foo'
1276
1276
1277
1277
export default {
1278
1278
components: { Foo }
1279
1279
}
1280
- </>
1280
+ </script >
1281
1281
` ` `
1282
1282
1283
1283
` Component .spec .js `
@@ -1389,13 +1389,13 @@ export default {
1389
1389
<Component truthy : object = " {}" string = " string" />
1390
1390
</template >
1391
1391
1392
- <>
1392
+ <script >
1393
1393
import Component from ' @/Component'
1394
1394
1395
1395
export default {
1396
1396
components: { Component }
1397
1397
}
1398
- </>
1398
+ </script >
1399
1399
` ` `
1400
1400
1401
1401
` Component .spec .js ` :
@@ -1449,15 +1449,15 @@ Also, notice that `setData` does not modify composition API `setup()` data.
1449
1449
<div >Count : {{ count }}</div >
1450
1450
</template >
1451
1451
1452
- <>
1452
+ <script >
1453
1453
export default {
1454
1454
data() {
1455
1455
return {
1456
1456
count: 0
1457
1457
}
1458
1458
}
1459
1459
}
1460
- </>
1460
+ </script >
1461
1461
` ` `
1462
1462
1463
1463
` Component .spec .js ` :
@@ -1499,11 +1499,11 @@ setProps(props: Record<string, any>): Promise<void>
1499
1499
<div >{{ message }}</div >
1500
1500
</template >
1501
1501
1502
- <>
1502
+ <script >
1503
1503
export default {
1504
1504
props: [' message' ]
1505
1505
}
1506
- </>
1506
+ </script >
1507
1507
` ` `
1508
1508
1509
1509
` Component .spec .js `
@@ -1559,7 +1559,7 @@ setValue(value: any, prop?: string): Promise<void>
1559
1559
<div v -if = " checked" >The input has been checked !</div >
1560
1560
</template >
1561
1561
1562
- <>
1562
+ <script >
1563
1563
export default {
1564
1564
data() {
1565
1565
return {
@@ -1568,7 +1568,7 @@ export default {
1568
1568
}
1569
1569
}
1570
1570
}
1571
- </>
1571
+ </script >
1572
1572
` ` `
1573
1573
1574
1574
` Component .spec .js ` :
@@ -1659,15 +1659,15 @@ trigger(eventString: string, options?: TriggerOptions | undefined): Promise<void
1659
1659
<button @click = " count++" >Click me </button >
1660
1660
</template >
1661
1661
1662
- <>
1662
+ <script >
1663
1663
export default {
1664
1664
data() {
1665
1665
return {
1666
1666
count: 0
1667
1667
}
1668
1668
}
1669
1669
}
1670
- </>
1670
+ </script >
1671
1671
` ` `
1672
1672
1673
1673
` Component .spec .js ` :
@@ -1712,17 +1712,13 @@ It only works on the root `VueWrapper` returned from `mount`. Useful for manual
1712
1712
` Component .vue ` :
1713
1713
1714
1714
` ` ` vue
1715
- <template >
1716
- <div />
1717
- </template >
1718
-
1719
- <>
1715
+ <script >
1720
1716
export default {
1721
1717
unmounted() {
1722
1718
console .log (' unmounted!' )
1723
1719
}
1724
1720
}
1725
- </>
1721
+ </script >
1726
1722
` ` `
1727
1723
1728
1724
` Component .spec .js ` :
@@ -1830,15 +1826,15 @@ An example might be globally mocking the `$t` variable from vue-i18n, globally s
1830
1826
<my -component />
1831
1827
</template >
1832
1828
1833
- <>
1829
+ <script >
1834
1830
import MyComponent from ' @/components/MyComponent'
1835
1831
1836
1832
export default {
1837
1833
components: {
1838
1834
MyComponent
1839
1835
}
1840
1836
}
1841
- </>
1837
+ </script >
1842
1838
` ` `
1843
1839
1844
1840
` Component .spec .js ` :
0 commit comments