@@ -32,12 +32,25 @@ test.describe('Lit components', () => {
32
32
await expect ( counter ) . toHaveCount ( 1 ) ;
33
33
34
34
const count = counter . locator ( 'p' ) ;
35
- await expect ( count , 'initial count is 0 ' ) . toHaveText ( 'Count: 0 ' ) ;
35
+ await expect ( count , 'initial count is 10 ' ) . toHaveText ( 'Count: 10 ' ) ;
36
36
37
37
const inc = counter . locator ( 'button' ) ;
38
38
await inc . click ( ) ;
39
39
40
- await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 1' ) ;
40
+ await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 11' ) ;
41
+ } ) ;
42
+
43
+ t ( 'non-deferred attribute serialization' , async ( { page, astro } ) => {
44
+ await page . goto ( astro . resolveUrl ( '/' ) ) ;
45
+
46
+ const counter = page . locator ( '#non-deferred' ) ;
47
+ const count = counter . locator ( 'p' ) ;
48
+ await expect ( count , 'initial count is 10' ) . toHaveText ( 'Count: 10' ) ;
49
+
50
+ const inc = counter . locator ( 'button' ) ;
51
+ await inc . click ( ) ;
52
+
53
+ await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 11' ) ;
41
54
} ) ;
42
55
43
56
t ( 'client:load' , async ( { page, astro } ) => {
@@ -47,12 +60,12 @@ test.describe('Lit components', () => {
47
60
await expect ( counter , 'component is visible' ) . toBeVisible ( ) ;
48
61
49
62
const count = counter . locator ( 'p' ) ;
50
- await expect ( count , 'initial count is 0 ' ) . toHaveText ( 'Count: 0 ' ) ;
63
+ await expect ( count , 'initial count is 10 ' ) . toHaveText ( 'Count: 10 ' ) ;
51
64
52
65
const inc = counter . locator ( 'button' ) ;
53
66
await inc . click ( ) ;
54
67
55
- await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 1 ' ) ;
68
+ await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 11 ' ) ;
56
69
} ) ;
57
70
58
71
t ( 'client:visible' , async ( { page, astro } ) => {
@@ -64,12 +77,12 @@ test.describe('Lit components', () => {
64
77
await expect ( counter , 'component is visible' ) . toBeVisible ( ) ;
65
78
66
79
const count = counter . locator ( 'p' ) ;
67
- await expect ( count , 'initial count is 0 ' ) . toHaveText ( 'Count: 0 ' ) ;
80
+ await expect ( count , 'initial count is 10 ' ) . toHaveText ( 'Count: 10 ' ) ;
68
81
69
82
const inc = counter . locator ( 'button' ) ;
70
83
await inc . click ( ) ;
71
84
72
- await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 1 ' ) ;
85
+ await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 11 ' ) ;
73
86
} ) ;
74
87
75
88
t ( 'client:media' , async ( { page, astro } ) => {
@@ -79,18 +92,18 @@ test.describe('Lit components', () => {
79
92
await expect ( counter , 'component is visible' ) . toBeVisible ( ) ;
80
93
81
94
const count = counter . locator ( 'p' ) ;
82
- await expect ( count , 'initial count is 0 ' ) . toHaveText ( 'Count: 0 ' ) ;
95
+ await expect ( count , 'initial count is 10 ' ) . toHaveText ( 'Count: 10 ' ) ;
83
96
84
97
const inc = counter . locator ( 'button' ) ;
85
98
await inc . click ( ) ;
86
99
87
- await expect ( count , 'component not hydrated yet' ) . toHaveText ( 'Count: 0 ' ) ;
100
+ await expect ( count , 'component not hydrated yet' ) . toHaveText ( 'Count: 10 ' ) ;
88
101
89
102
// Reset the viewport to hydrate the component (max-width: 50rem)
90
103
await page . setViewportSize ( { width : 414 , height : 1124 } ) ;
91
104
92
105
await inc . click ( ) ;
93
- await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 1 ' ) ;
106
+ await expect ( count , 'count incremented by 1' ) . toHaveText ( 'Count: 11 ' ) ;
94
107
} ) ;
95
108
96
109
t . skip ( 'HMR' , async ( { page, astro } ) => {
0 commit comments