@@ -139,9 +139,7 @@ describe('General tests', () => {
139
139
140
140
it ( 'Checks for text pattern and insert quote' , ( ) => {
141
141
cy . visit ( '/' ) ;
142
- const editor1 = cy . get ( '#editor1' ) ;
143
- editor1 . click ( ) ;
144
- editor1 . type ( '> Hello World' ) ;
142
+ cy . get ( '.angular-editor-textarea' ) . first ( ) . click ( ) . type ( '> Hello World' ) ;
145
143
const editor1HTMLContent = cy . get ( '#html-content-editor1' ) ;
146
144
editor1HTMLContent . should (
147
145
'contain.text' ,
@@ -1079,23 +1077,51 @@ describe('General tests', () => {
1079
1077
} ) ;
1080
1078
} ) ;
1081
1079
1080
+ const ARIAL = {
1081
+ selector :
1082
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(1)' ,
1083
+ name : 'Arial' ,
1084
+ } ;
1085
+ const TIMES_NEW_ROMAN = {
1086
+ selector :
1087
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(2)' ,
1088
+ name : 'Times New Roman' ,
1089
+ } ;
1090
+ const ROBOTO = {
1091
+ selector :
1092
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(3)' ,
1093
+ name : 'Roboto' ,
1094
+ } ;
1095
+ const COMIC_SANS_MS = {
1096
+ selector :
1097
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(4)' ,
1098
+ name : 'Comic Sans MS' ,
1099
+ } ;
1100
+ const ROBOTO_CUSTOM = {
1101
+ selector :
1102
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(5)' ,
1103
+ name : 'RobotoSlab' ,
1104
+ } ;
1105
+
1106
+ const HEADING_1 = {
1107
+ selector :
1108
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(6) > ae-select > span > span > button:nth-child(1)' ,
1109
+ } ;
1110
+ const HEADING_2 = {
1111
+ selector :
1112
+ '#editor1 > div > angular-editor-toolbar > div > div:nth-child(6) > ae-select > span > span > button:nth-child(2)' ,
1113
+ } ;
1114
+
1082
1115
it ( 'Should write any header with proper font name selected first' , ( ) => {
1083
1116
cy . visit ( '/' ) ;
1084
- // Selecting the font name:
1085
1117
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1086
- // 5th option is Verdana
1087
- cy . get (
1088
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(5)' ,
1089
- ) . click ( ) ;
1090
- // Selecting the header:
1118
+ cy . get ( COMIC_SANS_MS . selector ) . click ( ) ;
1091
1119
cy . get ( '.ae-picker-label' ) . first ( ) . click ( ) ;
1092
- cy . get (
1093
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(6) > ae-select > span > span > button:nth-child(1)' ,
1094
- ) . click ( ) ;
1120
+ cy . get ( HEADING_1 . selector ) . click ( ) ;
1095
1121
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( 'WADWADWADWADWAD' ) ;
1096
1122
cy . get ( '#html-content-editor1' ) . should (
1097
1123
'have.text' ,
1098
- ' <h1><font face="Verdana ">WADWADWADWADWAD</font></h1>' ,
1124
+ ` <h1><font face="${ COMIC_SANS_MS . name } ">WADWADWADWADWAD</font></h1>` ,
1099
1125
) ;
1100
1126
} ) ;
1101
1127
@@ -1104,30 +1130,26 @@ describe('General tests', () => {
1104
1130
// Selecting the font name:
1105
1131
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1106
1132
// 5th option is Verdana
1107
- cy . get (
1108
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(5)' ,
1109
- ) . click ( ) ;
1133
+ cy . get ( ROBOTO_CUSTOM . selector ) . click ( ) ;
1110
1134
// Selecting the header:
1111
1135
cy . get ( '.ae-picker-label' ) . first ( ) . click ( ) ;
1112
- cy . get (
1113
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(6) > ae-select > span > span > button:nth-child(1)' ,
1114
- ) . click ( ) ;
1136
+ cy . get ( HEADING_1 . selector ) . click ( ) ;
1115
1137
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( 'WADWADWADWADWAD' ) ;
1116
1138
cy . get ( '#html-content-editor1' ) . should (
1117
1139
'have.text' ,
1118
- ' <h1><font face="Verdana ">WADWADWADWADWAD</font></h1>' ,
1140
+ ` <h1><font face="${ ROBOTO_CUSTOM . name } ">WADWADWADWADWAD</font></h1>` ,
1119
1141
) ;
1120
1142
1121
1143
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( '{enter}more text' ) ;
1122
1144
cy . get ( '#html-content-editor1' ) . should (
1123
1145
'have.text' ,
1124
- ' <h1><font face="Verdana ">WADWADWADWADWAD</font></h1><div><font face="Verdana " size="5">more text</font></div>' ,
1146
+ ` <h1><font face="${ ROBOTO_CUSTOM . name } ">WADWADWADWADWAD</font></h1><div><font face="${ ROBOTO_CUSTOM . name } " size="5">more text</font></div>` ,
1125
1147
) ;
1126
1148
1127
1149
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( '{enter}more text' ) ;
1128
1150
cy . get ( '#html-content-editor1' ) . should (
1129
1151
'have.text' ,
1130
- ' <h1><font face="Verdana ">WADWADWADWADWAD</font></h1><div><font face="Verdana " size="5">more text</font></div><div><font face="Verdana " size="5">more text</font></div>' ,
1152
+ ` <h1><font face="${ ROBOTO_CUSTOM . name } ">WADWADWADWADWAD</font></h1><div><font face="${ ROBOTO_CUSTOM . name } " size="5">more text</font></div><div><font face="${ ROBOTO_CUSTOM . name } " size="5">more text</font></div>` ,
1131
1153
) ;
1132
1154
1133
1155
cy . get ( '.angular-editor-textarea' )
@@ -1136,7 +1158,7 @@ describe('General tests', () => {
1136
1158
. type ( 'more text again...' ) ;
1137
1159
cy . get ( '#html-content-editor1' ) . should (
1138
1160
'have.text' ,
1139
- ' <h1><font face="Verdana ">more text again...</font></h1>' ,
1161
+ ` <h1><font face="${ ROBOTO_CUSTOM . name } ">more text again...</font></h1>` ,
1140
1162
) ;
1141
1163
cy . get ( '.angular-editor-textarea' )
1142
1164
. first ( )
@@ -1150,24 +1172,22 @@ describe('General tests', () => {
1150
1172
) ;
1151
1173
cy . get ( '#html-content-editor1' ) . should (
1152
1174
'have.text' ,
1153
- ' <font face="Verdana " size="5">This text should not be a header because I </font><div><font face="Verdana " size="5">pressed more times the backspace key</font></div>' ,
1175
+ ` <font face="${ ROBOTO_CUSTOM . name } " size="5">This text should not be a header because I </font><div><font face="${ ROBOTO_CUSTOM . name } " size="5">pressed more times the backspace key</font></div>` ,
1154
1176
) ;
1155
1177
} ) ;
1156
1178
1157
1179
it ( 'Should change font name correctly when all text is selected' , ( ) => {
1158
1180
cy . visit ( '/' ) ;
1159
1181
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1160
- cy . get (
1161
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(5)' ,
1162
- ) . click ( ) ;
1182
+ cy . get ( ROBOTO . selector ) . click ( ) ;
1163
1183
cy . get ( '.angular-editor-textarea' )
1164
1184
. first ( )
1165
1185
. type (
1166
- ' Text is probably on Verdana here{enter}{enter}here too.... {backspace}' ,
1186
+ ` Text is probably on ${ ROBOTO . name } here{enter}{enter}here too.... {backspace}` ,
1167
1187
) ;
1168
1188
cy . get ( '#html-content-editor1' ) . should (
1169
1189
'have.text' ,
1170
- ' <font face="Verdana " size="5">Text is probably on Verdana here</font><div><font face="Verdana " size="5"><br></font></div><div><font face="Verdana " size="5">here too....</font></div>' ,
1190
+ ` <font face="${ ROBOTO . name } " size="5">Text is probably on ${ ROBOTO . name } here</font><div><font face="${ ROBOTO . name } " size="5"><br></font></div><div><font face="${ ROBOTO . name } " size="5">here too....</font></div>` ,
1171
1191
) ;
1172
1192
cy . get ( '.angular-editor-textarea' )
1173
1193
. first ( )
@@ -1176,12 +1196,12 @@ describe('General tests', () => {
1176
1196
. trigger ( 'dblclick' ) ;
1177
1197
cy . get ( '#html-content-editor1' ) . should (
1178
1198
'have.text' ,
1179
- ' <font face="Verdana " size="5">Text is probably on Verdana here</font><div><font face="Verdana " size="5"><br></font></div><div><font face="Verdana " size="5">here too....</font></div>' ,
1199
+ ` <font face="${ ROBOTO . name } " size="5">Text is probably on ${ ROBOTO . name } here</font><div><font face="${ ROBOTO . name } " size="5"><br></font></div><div><font face="${ ROBOTO . name } " size="5">here too....</font></div>` ,
1180
1200
) ;
1181
1201
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( 'MORE TEXT' ) ;
1182
1202
cy . get ( '#html-content-editor1' ) . should (
1183
1203
'have.text' ,
1184
- ' <font face="Verdana " size="5">MORE TEXT</font>' ,
1204
+ ` <font face="${ ROBOTO . name } " size="5">MORE TEXT</font>` ,
1185
1205
) ;
1186
1206
} ) ;
1187
1207
@@ -1202,29 +1222,23 @@ describe('General tests', () => {
1202
1222
. trigger ( 'click' )
1203
1223
. trigger ( 'dblclick' ) ;
1204
1224
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1205
- cy . get (
1206
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(4)' ,
1207
- ) . click ( ) ;
1225
+ cy . get ( TIMES_NEW_ROMAN . selector ) . click ( ) ;
1208
1226
cy . get ( '#html-content-editor1' ) . should (
1209
1227
'have.text' ,
1210
- ' <font face="Comic Sans MS" size="5 ">Some initial text, should be on the default font and size</font>' ,
1228
+ ` <font size="5" face=" ${ TIMES_NEW_ROMAN . name } ">Some initial text, should be on the default font and size</font>` ,
1211
1229
) ;
1212
1230
1213
1231
// Then picking another font
1214
1232
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1215
- cy . get (
1216
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(5)' ,
1217
- ) . click ( ) ;
1233
+ cy . get ( ARIAL . selector ) . click ( ) ;
1218
1234
cy . get ( '#html-content-editor1' ) . should (
1219
1235
'have.text' ,
1220
- ' <font size="5" face="Verdana ">Some initial text, should be on the default font and size</font>' ,
1236
+ ` <font size="5" face="${ ARIAL . name } ">Some initial text, should be on the default font and size</font>` ,
1221
1237
) ;
1222
1238
1223
1239
// Then going back to the previous one
1224
1240
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1225
- cy . get (
1226
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(4)' ,
1227
- ) . click ( ) ;
1241
+ cy . get ( COMIC_SANS_MS . selector ) . click ( ) ;
1228
1242
cy . get ( '#html-content-editor1' ) . should (
1229
1243
'have.text' ,
1230
1244
'<font size="5" face="Comic Sans MS">Some initial text, should be on the default font and size</font>' ,
@@ -1233,9 +1247,7 @@ describe('General tests', () => {
1233
1247
// Now pressing enter and adding a heading 2
1234
1248
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( '{enter}{backspace}' ) ;
1235
1249
cy . get ( '.ae-picker-label' ) . first ( ) . click ( ) ;
1236
- cy . get (
1237
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(6) > ae-select > span > span > button:nth-child(2)' ,
1238
- ) . click ( ) ;
1250
+ cy . get ( HEADING_2 . selector ) . click ( ) ;
1239
1251
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( 'Heading 2' ) ;
1240
1252
cy . get ( '#html-content-editor1' ) . should (
1241
1253
'have.text' ,
@@ -1246,9 +1258,7 @@ describe('General tests', () => {
1246
1258
. first ( )
1247
1259
. type ( '{selectall}{enter}{backspace}{backspace}{backspace}' ) ;
1248
1260
cy . get ( '.ae-picker-label' ) . first ( ) . click ( ) ;
1249
- cy . get (
1250
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(6) > ae-select > span > span > button:nth-child(2)' ,
1251
- ) . click ( ) ;
1261
+ cy . get ( HEADING_2 . selector ) . click ( ) ;
1252
1262
cy . get ( '.angular-editor-textarea' ) . first ( ) . type ( 'Heading 2' ) ;
1253
1263
cy . get ( '#html-content-editor1' ) . should (
1254
1264
'have.text' ,
@@ -1273,9 +1283,7 @@ describe('General tests', () => {
1273
1283
. trigger ( 'click' )
1274
1284
. trigger ( 'dblclick' ) ;
1275
1285
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1276
- cy . get (
1277
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(6)' ,
1278
- ) . click ( ) ;
1286
+ cy . get ( ROBOTO . selector ) . click ( ) ;
1279
1287
cy . get ( '#html-content-editor1' ) . should (
1280
1288
'have.text' ,
1281
1289
'<font face="Comic Sans MS" size="5">Some initial text, should be on the default font and size</font>' ,
@@ -1435,9 +1443,7 @@ describe('General tests', () => {
1435
1443
cy . get ( 'body' ) . click ( 'top' ) ;
1436
1444
cy . get ( '#editor1 > div > div > div' ) . first ( ) . should ( 'not.be.focused' ) ;
1437
1445
cy . get ( '.ae-picker-label' ) . eq ( 1 ) . click ( ) ;
1438
- cy . get (
1439
- '#editor1 > div > angular-editor-toolbar > div > div:nth-child(7) > ae-select > span > span > button:nth-child(6)' ,
1440
- ) . click ( ) ;
1446
+ cy . get ( ROBOTO . selector ) . click ( ) ;
1441
1447
cy . get ( '#editor1 > div > div > div' ) . first ( ) . click ( 'center' ) ;
1442
1448
cy . get ( '#editor1 > div > div > div' ) . first ( ) . should ( 'be.focused' ) ;
1443
1449
cy . get ( '#editor1 > div > div > div' ) . first ( ) . type ( 'A b c' ) ;
0 commit comments