@@ -86,7 +86,7 @@ describe('xterm-addon-serialize html', () => {
86
86
it ( 'empty terminal with selection turned off' , ( ) => {
87
87
const output = serializeAddon . serializeAsHTML ( ) ;
88
88
assert . notEqual ( output , '' ) ;
89
- assert . equal ( ( output . match ( new RegExp ( ' <div><span> {10}</span><\/div>' , 'g' ) ) || [ ] ) . length , 2 ) ;
89
+ assert . equal ( ( output . match ( / < d i v > < s p a n > { 10 } < \ /s p a n > < \/ d i v > / g ) || [ ] ) . length , 2 ) ;
90
90
} ) ;
91
91
92
92
it ( 'empty terminal with no selection' , ( ) => {
@@ -103,84 +103,84 @@ describe('xterm-addon-serialize html', () => {
103
103
const output = serializeAddon . serializeAsHTML ( {
104
104
onlySelection : true
105
105
} ) ;
106
- assert . equal ( ( output . match ( new RegExp ( ' <div><span>terminal<\/span><\/div>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
106
+ assert . equal ( ( output . match ( / < d i v > < s p a n > t e r m i n a l < \/ s p a n > < \/ d i v > / g ) || [ ] ) . length , 1 , output ) ;
107
107
} ) ;
108
108
109
109
it ( 'cells with bold styling' , async ( ) => {
110
110
await writeP ( terminal , ' ' + sgr ( '1' ) + 'terminal' + sgr ( '22' ) + ' ' ) ;
111
111
112
112
const output = serializeAddon . serializeAsHTML ( ) ;
113
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'font-weight: bold;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
113
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' f o n t - w e i g h t : b o l d ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
114
114
} ) ;
115
115
116
116
it ( 'cells with italic styling' , async ( ) => {
117
117
await writeP ( terminal , ' ' + sgr ( '3' ) + 'terminal' + sgr ( '23' ) + ' ' ) ;
118
118
119
119
const output = serializeAddon . serializeAsHTML ( ) ;
120
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'font-style: italic;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
120
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' f o n t - s t y l e : i t a l i c ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
121
121
} ) ;
122
122
123
123
it ( 'cells with inverse styling' , async ( ) => {
124
124
await writeP ( terminal , ' ' + sgr ( '7' ) + 'terminal' + sgr ( '27' ) + ' ' ) ;
125
125
126
126
const output = serializeAddon . serializeAsHTML ( ) ;
127
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'color: #000000; background-color: #BFBFBF;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
127
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' c o l o r : # 0 0 0 0 0 0 ; b a c k g r o u n d - c o l o r : # B F B F B F ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
128
128
} ) ;
129
129
130
130
it ( 'cells with underline styling' , async ( ) => {
131
131
await writeP ( terminal , ' ' + sgr ( '4' ) + 'terminal' + sgr ( '24' ) + ' ' ) ;
132
132
133
133
const output = serializeAddon . serializeAsHTML ( ) ;
134
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'text-decoration: underline;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
134
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' t e x t - d e c o r a t i o n : u n d e r l i n e ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
135
135
} ) ;
136
136
137
137
it ( 'cells with invisible styling' , async ( ) => {
138
138
await writeP ( terminal , ' ' + sgr ( '8' ) + 'terminal' + sgr ( '28' ) + ' ' ) ;
139
139
140
140
const output = serializeAddon . serializeAsHTML ( ) ;
141
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'visibility: hidden;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
141
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' v i s i b i l i t y : h i d d e n ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
142
142
} ) ;
143
143
144
144
it ( 'cells with dim styling' , async ( ) => {
145
145
await writeP ( terminal , ' ' + sgr ( '2' ) + 'terminal' + sgr ( '22' ) + ' ' ) ;
146
146
147
147
const output = serializeAddon . serializeAsHTML ( ) ;
148
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'opacity: 0.5;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
148
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' o p a c i t y : 0 .5 ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
149
149
} ) ;
150
150
151
151
it ( 'cells with strikethrough styling' , async ( ) => {
152
152
await writeP ( terminal , ' ' + sgr ( '9' ) + 'terminal' + sgr ( '29' ) + ' ' ) ;
153
153
154
154
const output = serializeAddon . serializeAsHTML ( ) ;
155
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'text-decoration: line-through;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
155
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' t e x t - d e c o r a t i o n : l i n e - t h r o u g h ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
156
156
} ) ;
157
157
158
158
it ( 'cells with combined styling' , async ( ) => {
159
159
await writeP ( terminal , sgr ( '1' ) + ' ' + sgr ( '9' ) + 'termi' + sgr ( '22' ) + 'nal' + sgr ( '29' ) + ' ' ) ;
160
160
161
161
const output = serializeAddon . serializeAsHTML ( ) ;
162
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'font-weight: bold;\ '> <\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
163
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'font-weight: bold; text-decoration: line-through;\ '>termi<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
164
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'text-decoration: line-through;\ '>nal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
162
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' f o n t - w e i g h t : b o l d ; ' > < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
163
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' f o n t - w e i g h t : b o l d ; t e x t - d e c o r a t i o n : l i n e - t h r o u g h ; ' > t e r m i < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
164
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' t e x t - d e c o r a t i o n : l i n e - t h r o u g h ; ' > n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
165
165
} ) ;
166
166
167
167
it ( 'cells with color styling' , async ( ) => {
168
168
await writeP ( terminal , ' ' + sgr ( '38;5;46' ) + 'terminal' + sgr ( '39' ) + ' ' ) ;
169
169
170
170
const output = serializeAddon . serializeAsHTML ( ) ;
171
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'color: #00ff00;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
171
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' c o l o r : # 0 0 f f 0 0 ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
172
172
} ) ;
173
173
174
174
it ( 'cells with background styling' , async ( ) => {
175
175
await writeP ( terminal , ' ' + sgr ( '48;5;46' ) + 'terminal' + sgr ( '49' ) + ' ' ) ;
176
176
177
177
const output = serializeAddon . serializeAsHTML ( ) ;
178
- assert . equal ( ( output . match ( new RegExp ( ' <span style=\ 'background-color: #00ff00;\ '>terminal<\/span>' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
178
+ assert . equal ( ( output . match ( / < s p a n s t y l e = ' b a c k g r o u n d - c o l o r : # 0 0 f f 0 0 ; ' > t e r m i n a l < \/ s p a n > / g ) || [ ] ) . length , 1 , output ) ;
179
179
} ) ;
180
180
181
181
it ( 'empty terminal with default options' , async ( ) => {
182
182
const output = serializeAddon . serializeAsHTML ( ) ;
183
- assert . equal ( ( output . match ( new RegExp ( ' color: #000000; background-color: #ffffff; font-family: courier-new, courier, monospace; font-size: 15px;' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
183
+ assert . equal ( ( output . match ( / c o l o r : # 0 0 0 0 0 0 ; b a c k g r o u n d - c o l o r : # f f f f f f ; f o n t - f a m i l y : c o u r i e r - n e w , c o u r i e r , m o n o s p a c e ; f o n t - s i z e : 1 5 p x ; / g ) || [ ] ) . length , 1 , output ) ;
184
184
} ) ;
185
185
186
186
it ( 'empty terminal with custom options' , async ( ) => {
@@ -193,13 +193,13 @@ describe('xterm-addon-serialize html', () => {
193
193
const output = serializeAddon . serializeAsHTML ( {
194
194
includeGlobalBackground : true
195
195
} ) ;
196
- assert . equal ( ( output . match ( new RegExp ( ' color: #ff00ff; background-color: #00ff00; font-family: verdana; font-size: 20px;' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
196
+ assert . equal ( ( output . match ( / c o l o r : # f f 0 0 f f ; b a c k g r o u n d - c o l o r : # 0 0 f f 0 0 ; f o n t - f a m i l y : v e r d a n a ; f o n t - s i z e : 2 0 p x ; / g ) || [ ] ) . length , 1 , output ) ;
197
197
} ) ;
198
198
199
199
it ( 'empty terminal with background included' , async ( ) => {
200
200
const output = serializeAddon . serializeAsHTML ( {
201
201
includeGlobalBackground : true
202
202
} ) ;
203
- assert . equal ( ( output . match ( new RegExp ( ' color: #ffffff; background-color: #000000; font-family: courier-new, courier, monospace; font-size: 15px;' , 'g' ) ) || [ ] ) . length , 1 , output ) ;
203
+ assert . equal ( ( output . match ( / c o l o r : # f f f f f f ; b a c k g r o u n d - c o l o r : # 0 0 0 0 0 0 ; f o n t - f a m i l y : c o u r i e r - n e w , c o u r i e r , m o n o s p a c e ; f o n t - s i z e : 1 5 p x ; / g ) || [ ] ) . length , 1 , output ) ;
204
204
} ) ;
205
205
} ) ;
0 commit comments