@@ -1180,6 +1180,117 @@ const tests = [
11801180 content: '';
11811181 }` ,
11821182 } ,
1183+ {
1184+ name : "should disable pure mode checks for entire file with no-check comment" ,
1185+ options : { mode : "pure" } ,
1186+ input : `/* cssmodules-pure-no-check */
1187+ :global(.foo) { border: 1px solid #e2e8f0 }
1188+ :global(.bar) { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) }
1189+ :global(.baz) { background: #4299e1 }` ,
1190+ expected : `/* cssmodules-pure-no-check */
1191+ .foo { border: 1px solid #e2e8f0 }
1192+ .bar { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) }
1193+ .baz { background: #4299e1 }` ,
1194+ } ,
1195+ {
1196+ name : "should disable pure mode checks for nested selectors" ,
1197+ options : { mode : "pure" } ,
1198+ input : `/* cssmodules-pure-no-check */
1199+ :global(.foo) {
1200+ &:hover { border-color: #cbd5e0 }
1201+ & :global(.bar) { color: blue }
1202+ }` ,
1203+ expected : `/* cssmodules-pure-no-check */
1204+ .foo {
1205+ &:hover { border-color: #cbd5e0 }
1206+ & .bar { color: blue }
1207+ }` ,
1208+ } ,
1209+ {
1210+ name : "should ignore no-check comment if not at root level" ,
1211+ options : { mode : "pure" } ,
1212+ input : `:global(.bar) { color: blue }
1213+ /* cssmodules-pure-no-check */` ,
1214+ error : / i s n o t p u r e / ,
1215+ } ,
1216+ {
1217+ name : "should allow other comments before no-check comment" ,
1218+ options : { mode : "pure" } ,
1219+ input : `/* Some file description */
1220+ /* cssmodules-pure-no-check */
1221+ :global(.foo) { color: blue }` ,
1222+ expected : `/* Some file description */
1223+ /* cssmodules-pure-no-check */
1224+ .foo { color: blue }` ,
1225+ } ,
1226+ {
1227+ name : "should disable pure mode checks for deep nested selectors" ,
1228+ options : { mode : "pure" } ,
1229+ input : `/* cssmodules-pure-no-check */
1230+ :global(.foo) { max-width: 600px }
1231+ :global(.bar) { background: #fafafa }
1232+ :global(.baz) {
1233+ :global(.foobar) {
1234+ &::-webkit-scrollbar { width: 8px }
1235+ }
1236+ }` ,
1237+ expected : `/* cssmodules-pure-no-check */
1238+ .foo { max-width: 600px }
1239+ .bar { background: #fafafa }
1240+ .baz {
1241+ .foobar {
1242+ &::-webkit-scrollbar { width: 8px }
1243+ }
1244+ }` ,
1245+ } ,
1246+ {
1247+ name : "should work with keyframes when no-check is enabled" ,
1248+ options : { mode : "pure" } ,
1249+ input : `/* cssmodules-pure-no-check */
1250+ @keyframes :global(fadeIn) {
1251+ from { opacity: 0 }
1252+ to { opacity: 1 }
1253+ }
1254+ :global(.animate) { animation: global(fadeIn) 0.3s }` ,
1255+ expected : `/* cssmodules-pure-no-check */
1256+ @keyframes fadeIn {
1257+ from { opacity: 0 }
1258+ to { opacity: 1 }
1259+ }
1260+ .animate { animation: fadeIn 0.3s }` ,
1261+ } ,
1262+ {
1263+ name : "should allow multiline no-check comment" ,
1264+ options : { mode : "pure" } ,
1265+ input : `/*
1266+ cssmodules-pure-no-check
1267+ */
1268+ :global(.foo) { color: blue }` ,
1269+ expected : `/*
1270+ cssmodules-pure-no-check
1271+ */
1272+ .foo { color: blue }` ,
1273+ } ,
1274+ {
1275+ name : "should allow additional text in no-check comment" ,
1276+ options : { mode : "pure" } ,
1277+ input : `/* cssmodules-pure-no-check - needed for styling third-party components */
1278+ :global(.foo) { color: blue }` ,
1279+ expected : `/* cssmodules-pure-no-check - needed for styling third-party components */
1280+ .foo { color: blue }` ,
1281+ } ,
1282+ {
1283+ name : "should work with media queries when no-check is enabled" ,
1284+ options : { mode : "pure" } ,
1285+ input : `/* cssmodules-pure-no-check */
1286+ @media (max-width: 768px) {
1287+ :global(.foo) { position: fixed }
1288+ }` ,
1289+ expected : `/* cssmodules-pure-no-check */
1290+ @media (max-width: 768px) {
1291+ .foo { position: fixed }
1292+ }` ,
1293+ } ,
11831294 {
11841295 name : "css nesting" ,
11851296 input : `
0 commit comments