@@ -1174,4 +1174,87 @@ describe('#parse', () => {
1174
1174
expect ( sassTrue . parse ( css ) ) . to . deep . equal ( expected ) ;
1175
1175
} ) ;
1176
1176
} ) ;
1177
+ describe ( '#contains-string' , ( ) => {
1178
+ it ( 'parses a passing output test' , ( ) => {
1179
+ const css = [
1180
+ '/* # Module: Contains-string */' ,
1181
+ '/* Test: CSS output contains-string */' ,
1182
+ '/* ASSERT: Output selector pattern contains-string input pattern */' ,
1183
+ '/* */' ,
1184
+ '/* OUTPUT */' ,
1185
+ '.test-output {' ,
1186
+ ' height: 10px;' ,
1187
+ ' width: 20px; }' ,
1188
+ '/* END_OUTPUT */' ,
1189
+ '/* */' ,
1190
+ '/* CONTAINS_STRING */' ,
1191
+ '/* height */' ,
1192
+ '/* END_CONTAINS_STRING */' ,
1193
+ '/* */' ,
1194
+ '/* END_ASSERT */' ,
1195
+ ] . join ( '\n' ) ;
1196
+ const expected = [
1197
+ {
1198
+ module : 'Contains-string' ,
1199
+ tests : [
1200
+ {
1201
+ test : 'CSS output contains-string' ,
1202
+ assertions : [
1203
+ {
1204
+ description :
1205
+ 'Output selector pattern contains-string input pattern' ,
1206
+ assertionType : 'contains-string' ,
1207
+ passed : true ,
1208
+ output : '.test-output {\n height: 10px;\n width: 20px;\n}' ,
1209
+ expected : 'height' ,
1210
+ } ,
1211
+ ] ,
1212
+ } ,
1213
+ ] ,
1214
+ } ,
1215
+ ] ;
1216
+ expect ( sassTrue . parse ( css ) ) . to . deep . equal ( expected ) ;
1217
+ } ) ;
1218
+
1219
+ it ( 'parses a failing output test' , ( ) => {
1220
+ const css = [
1221
+ '/* # Module: Contains-string */' ,
1222
+ '/* Test: CSS output contains-string */' ,
1223
+ '/* ASSERT: Output selector pattern contains-string input pattern */' ,
1224
+ '/* */' ,
1225
+ '/* OUTPUT */' ,
1226
+ '.test-output {' ,
1227
+ ' height: 10px;' ,
1228
+ ' width: 20px; }' ,
1229
+ '/* END_OUTPUT */' ,
1230
+ '/* */' ,
1231
+ '/* CONTAINS_STRING */' ,
1232
+ '/* background-color */' ,
1233
+ '/* END_CONTAINS_STRING */' ,
1234
+ '/* */' ,
1235
+ '/* END_ASSERT */' ,
1236
+ ] . join ( '\n' ) ;
1237
+ const expected = [
1238
+ {
1239
+ module : 'Contains-string' ,
1240
+ tests : [
1241
+ {
1242
+ test : 'CSS output contains-string' ,
1243
+ assertions : [
1244
+ {
1245
+ description :
1246
+ 'Output selector pattern contains-string input pattern' ,
1247
+ assertionType : 'contains-string' ,
1248
+ passed : false ,
1249
+ output : '.test-output {\n height: 10px;\n width: 20px;\n}' ,
1250
+ expected : 'background-color' ,
1251
+ } ,
1252
+ ] ,
1253
+ } ,
1254
+ ] ,
1255
+ } ,
1256
+ ] ;
1257
+ expect ( sassTrue . parse ( css ) ) . to . deep . equal ( expected ) ;
1258
+ } ) ;
1259
+ } ) ;
1177
1260
} ) ;
0 commit comments