@@ -39,7 +39,7 @@ describe('<bolt-text> Component', () => {
39
39
const renderedTextHTML = await page . evaluate ( ( ) => {
40
40
const text = document . createElement ( 'bolt-text' ) ;
41
41
42
- text . textContent = `This is bolt text` ;
42
+ text . textContent = `This is regular text` ;
43
43
document . body . appendChild ( text ) ;
44
44
45
45
return text . outerHTML ;
@@ -56,27 +56,19 @@ describe('<bolt-text> Component', () => {
56
56
expect ( renderedHTML ) . toMatchSnapshot ( ) ;
57
57
} ) ;
58
58
59
- // Basic Usage (Light DOM)
60
- test ( 'Default <bolt-text> w/o Shadow DOM renders' , async function ( ) {
59
+ // Code text (Shadow DOM)
60
+ test ( 'Code text using <bolt-text> w/ Shadow DOM renders' , async function ( ) {
61
61
const renderedTextHTML = await page . evaluate ( ( ) => {
62
62
const text = document . createElement ( 'bolt-text' ) ;
63
63
64
- text . textContent = `This is bolt text` ;
64
+ text . textContent = `This is code text` ;
65
+ text . setAttribute ( 'font-family' , 'code' ) ;
65
66
document . body . appendChild ( text ) ;
66
- text . useShadow = false ;
67
- text . updated ( ) ;
68
67
69
68
return text . outerHTML ;
70
69
} ) ;
71
70
72
71
const renderedHTML = await html ( renderedTextHTML ) ;
73
-
74
- expect (
75
- renderedHTML
76
- . querySelector ( '.c-bolt-text-v2' )
77
- . classList . contains ( 'c-bolt-text-v2--font-size-medium' ) ,
78
- ) . toBe ( true ) ;
79
-
80
72
const image = await page . screenshot ( ) ;
81
73
82
74
expect ( image ) . toMatchImageSnapshot ( {
@@ -87,12 +79,12 @@ describe('<bolt-text> Component', () => {
87
79
expect ( renderedHTML ) . toMatchSnapshot ( ) ;
88
80
} ) ;
89
81
90
- // Headline and xxxlarge size (Shadow DOM)
91
- test ( '<bolt-text> with headline and xxxlarge font-size w/ Shadow DOM renders' , async function ( ) {
82
+ // xxxlarge Headline (Shadow DOM)
83
+ test ( 'xxxlarge headline using <bolt-text> w/ Shadow DOM renders' , async function ( ) {
92
84
const renderedTextHTML = await page . evaluate ( ( ) => {
93
85
const text = document . createElement ( 'bolt-text' ) ;
94
86
95
- text . textContent = `This is bolt text ` ;
87
+ text . textContent = `This is xxxlarge headline ` ;
96
88
text . setAttribute ( 'headline' , true ) ;
97
89
text . setAttribute ( 'font-size' , 'xxxlarge' ) ;
98
90
document . body . appendChild ( text ) ;
@@ -111,12 +103,12 @@ describe('<bolt-text> Component', () => {
111
103
expect ( renderedHTML ) . toMatchSnapshot ( ) ;
112
104
} ) ;
113
105
114
- // Headline and xxxlarge size (Light DOM)
115
- test ( '<bolt-text> with headline and xxxlarge font-size w/o Shadow DOM renders' , async function ( ) {
106
+ // xxxlarge Headline (Light DOM)
107
+ test ( 'xxxlarge headline using <bolt-text> w/o Shadow DOM renders' , async function ( ) {
116
108
const renderedTextHTML = await page . evaluate ( ( ) => {
117
109
const text = document . createElement ( 'bolt-text' ) ;
118
110
119
- text . textContent = `This is bolt text ` ;
111
+ text . textContent = `This is xxxlarge headline ` ;
120
112
text . setAttribute ( 'headline' , true ) ;
121
113
text . setAttribute ( 'font-size' , 'xxxlarge' ) ;
122
114
document . body . appendChild ( text ) ;
@@ -126,12 +118,39 @@ describe('<bolt-text> Component', () => {
126
118
return text . outerHTML ;
127
119
} ) ;
128
120
121
+ const renderedHTML = await html ( renderedTextHTML ) ;
122
+ const image = await page . screenshot ( ) ;
123
+
129
124
expect (
130
125
renderedHTML
131
126
. querySelector ( '.c-bolt-text-v2' )
132
127
. classList . contains ( 'c-bolt-text-v2--font-size-xxxlarge' ) ,
133
128
) . toBe ( true ) ;
134
129
130
+ expect ( image ) . toMatchImageSnapshot ( {
131
+ failureThreshold : '0.01' ,
132
+ failureThresholdType : 'percent' ,
133
+ } ) ;
134
+
135
+ expect ( renderedHTML ) . toMatchSnapshot ( ) ;
136
+ } ) ;
137
+
138
+ // All caps xxlarge bold quote (Shadow DOM)
139
+ test ( 'All caps xxlarge bold quote using <bolt-text> w/ Shadow DOM renders' , async function ( ) {
140
+ const renderedTextHTML = await page . evaluate ( ( ) => {
141
+ const text = document . createElement ( 'bolt-text' ) ;
142
+
143
+ text . textContent = `This is a quote` ;
144
+ text . setAttribute ( 'quoted' , true ) ;
145
+ text . setAttribute ( 'letter-spacing' , 'wide' ) ;
146
+ text . setAttribute ( 'text-transform' , 'uppercase' ) ;
147
+ text . setAttribute ( 'font-size' , 'xxlarge' ) ;
148
+ text . setAttribute ( 'font-weight' , 'bold' ) ;
149
+ document . body . appendChild ( text ) ;
150
+
151
+ return text . outerHTML ;
152
+ } ) ;
153
+
135
154
const renderedHTML = await html ( renderedTextHTML ) ;
136
155
const image = await page . screenshot ( ) ;
137
156
@@ -143,5 +162,46 @@ describe('<bolt-text> Component', () => {
143
162
expect ( renderedHTML ) . toMatchSnapshot ( ) ;
144
163
} ) ;
145
164
165
+ // All caps xxlarge bold quote (Light DOM)
166
+ test ( 'All caps xxlarge bold quote using <bolt-text> w/o Shadow DOM renders' , async function ( ) {
167
+ const renderedTextHTML = await page . evaluate ( ( ) => {
168
+ const text = document . createElement ( 'bolt-text' ) ;
169
+
170
+ text . textContent = `This is a quote` ;
171
+ text . setAttribute ( 'quoted' , true ) ;
172
+ text . setAttribute ( 'letter-spacing' , 'wide' ) ;
173
+ text . setAttribute ( 'text-transform' , 'uppercase' ) ;
174
+ text . setAttribute ( 'font-size' , 'xxlarge' ) ;
175
+ text . setAttribute ( 'font-weight' , 'bold' ) ;
176
+ document . body . appendChild ( text ) ;
177
+ text . useShadow = false ;
178
+ text . updated ( ) ;
179
+
180
+ return text . outerHTML ;
181
+ } ) ;
182
+
183
+ const renderedHTML = await html ( renderedTextHTML ) ;
184
+ const image = await page . screenshot ( ) ;
185
+
186
+ expect (
187
+ renderedHTML
188
+ . querySelector ( '.c-bolt-text-v2' )
189
+ . classList . contains (
190
+ 'c-bolt-text-v2--quoted' ,
191
+ 'c-bolt-text-v2--letter-spacing-wide' ,
192
+ 'c-bolt-text-v2--text-transform-uppercase' ,
193
+ 'c-bolt-text-v2--font-size-xxlarge' ,
194
+ 'c-bolt-text-v2--font-weight-bold' ,
195
+ ) ,
196
+ ) . toBe ( true ) ;
197
+
198
+ expect ( image ) . toMatchImageSnapshot ( {
199
+ failureThreshold : '0.01' ,
200
+ failureThresholdType : 'percent' ,
201
+ } ) ;
202
+
203
+ expect ( renderedHTML ) . toMatchSnapshot ( ) ;
204
+ } ) ;
205
+
146
206
// @todo : Bold, wide letter spacing, color, and quoted
147
207
} ) ;
0 commit comments