@@ -12,22 +12,11 @@ const schema = readYamlFileSync(join(__dirname, '../blockquote.schema.yml'));
12
12
const { tag } = schema . properties ;
13
13
14
14
const vrtDefaultConfig = Object . assign ( vrtConfig , {
15
- failureThreshold : '0.01 ' ,
15
+ failureThreshold : '0.02 ' ,
16
16
} ) ;
17
17
18
18
const timeout = 90000 ;
19
19
20
- async function clipScreenshot ( boundingBox , page ) {
21
- return {
22
- clip : {
23
- x : boundingBox . x ,
24
- y : boundingBox . y ,
25
- width : Math . min ( boundingBox . width , await page . viewport ( ) . width ) ,
26
- height : Math . min ( boundingBox . height , await page . viewport ( ) . height ) ,
27
- } ,
28
- } ;
29
- }
30
-
31
20
describe ( 'button' , ( ) => {
32
21
let page , context ;
33
22
@@ -73,8 +62,8 @@ describe('button', () => {
73
62
blockquote . innerHTML = `
74
63
<p>Java is to JavaScript what Car is to Carpet.</p>
75
64
` ;
76
- document . getElementById ( 'root' ) . appendChild ( blockquote ) ;
77
- document . getElementById ( 'root' ) . classList . add ( 'u-bolt-padding-medium' ) ;
65
+ document . body . appendChild ( blockquote ) ;
66
+ document . body . classList . add ( 'u-bolt-padding-medium' ) ;
78
67
blockquote . updated ( ) ;
79
68
return blockquote . outerHTML ;
80
69
} ) ;
@@ -96,10 +85,7 @@ describe('button', () => {
96
85
97
86
const renderedHTML = await html ( defaultBlockquoteOuter ) ;
98
87
99
- const root = await page . $ ( '#root' ) ;
100
- const image = await page . screenshot (
101
- await clipScreenshot ( await root . boundingBox ( ) , page ) ,
102
- ) ;
88
+ const image = await page . screenshot ( ) ;
103
89
104
90
expect ( image ) . toMatchImageSnapshot ( vrtDefaultConfig ) ;
105
91
@@ -120,8 +106,8 @@ describe('button', () => {
120
106
<p>Bolt Blockquote w/ Shadow DOM Manually Disabled</p>
121
107
<p>Press any key to continue or any other key to quit.</p>
122
108
` ;
123
- document . getElementById ( 'root' ) . appendChild ( blockquote ) ;
124
- document . getElementById ( 'root' ) . classList . add ( 'u-bolt-padding-medium' ) ;
109
+ document . body . appendChild ( blockquote ) ;
110
+ document . body . classList . add ( 'u-bolt-padding-medium' ) ;
125
111
blockquote . useShadow = false ;
126
112
blockquote . updated ( ) ;
127
113
return blockquote . outerHTML ;
@@ -150,10 +136,7 @@ describe('button', () => {
150
136
) ;
151
137
} ) ;
152
138
153
- const root = await page . $ ( '#root' ) ;
154
- const image = await page . screenshot (
155
- await clipScreenshot ( await root . boundingBox ( ) , page ) ,
156
- ) ;
139
+ const image = await page . screenshot ( ) ;
157
140
158
141
expect ( image ) . toMatchImageSnapshot ( vrtDefaultConfig ) ;
159
142
@@ -173,8 +156,8 @@ describe('button', () => {
173
156
<p>Bolt Blockquote w/ Shadow DOM auto-disabled</p>
174
157
<p>Yeah, but it works on my machine...</p>
175
158
` ;
176
- document . getElementById ( 'root' ) . appendChild ( form ) ;
177
- document . getElementById ( 'root' ) . classList . add ( 'u-bolt-padding-medium' ) ;
159
+ document . body . appendChild ( form ) ;
160
+ document . body . classList . add ( 'u-bolt-padding-medium' ) ;
178
161
form . appendChild ( blockquote ) ;
179
162
blockquote . updated ( ) ;
180
163
return blockquote . innerHTML ;
@@ -196,10 +179,7 @@ describe('button', () => {
196
179
} ) ;
197
180
198
181
const renderedHTML = await html ( renderedBlockquoteHTML ) ;
199
- const root = await page . $ ( '#root' ) ;
200
- const image = await page . screenshot (
201
- await clipScreenshot ( await root . boundingBox ( ) , page ) ,
202
- ) ;
182
+ const image = await page . screenshot ( ) ;
203
183
204
184
expect ( image ) . toMatchImageSnapshot ( vrtDefaultConfig ) ;
205
185
0 commit comments