@@ -5,6 +5,8 @@ test('should render', async () => {
5
5
expect ( await page . textContent ( '.named-specifier' ) ) . toMatch ( '1' )
6
6
expect ( await page . textContent ( '.default' ) ) . toMatch ( '2' )
7
7
expect ( await page . textContent ( '.default-tsx' ) ) . toMatch ( '3' )
8
+ expect ( await page . textContent ( '.script' ) ) . toMatch ( '4' )
9
+ expect ( await page . textContent ( '.src-import' ) ) . toMatch ( '5' )
8
10
expect ( await page . textContent ( '.other-ext' ) ) . toMatch ( 'Other Ext' )
9
11
} )
10
12
@@ -17,6 +19,10 @@ test('should update', async () => {
17
19
expect ( await page . textContent ( '.default' ) ) . toMatch ( '3' )
18
20
await page . click ( '.default-tsx' )
19
21
expect ( await page . textContent ( '.default-tsx' ) ) . toMatch ( '4' )
22
+ await page . click ( '.script' )
23
+ expect ( await page . textContent ( '.script' ) ) . toMatch ( '5' )
24
+ await page . click ( '.src-import' )
25
+ expect ( await page . textContent ( '.src-import' ) ) . toMatch ( '6' )
20
26
} )
21
27
22
28
if ( ! isBuild ) {
@@ -74,4 +80,26 @@ if (!isBuild) {
74
80
// should not affect other components on the page
75
81
expect ( await page . textContent ( '.named' ) ) . toMatch ( '1' )
76
82
} )
83
+
84
+ test ( 'hmr: script in .vue' , async ( ) => {
85
+ editFile ( 'Script.vue' , ( code ) =>
86
+ code . replace ( 'script {count' , 'script updated {count' )
87
+ )
88
+ await untilUpdated ( ( ) => page . textContent ( '.script' ) , 'script updated 4' )
89
+
90
+ expect ( await page . textContent ( '.src-import' ) ) . toMatch ( '6' )
91
+ } )
92
+
93
+ test ( 'hmr: src import in .vue' , async ( ) => {
94
+ await page . click ( '.script' )
95
+ editFile ( 'SrcImport.jsx' , ( code ) =>
96
+ code . replace ( 'src import {count' , 'src import updated {count' )
97
+ )
98
+ await untilUpdated (
99
+ ( ) => page . textContent ( '.src-import' ) ,
100
+ 'src import updated 5'
101
+ )
102
+
103
+ expect ( await page . textContent ( '.script' ) ) . toMatch ( '5' )
104
+ } )
77
105
}
0 commit comments