Skip to content

Commit d5be6f7

Browse files
authored
test(Scss): fix variable check test (#6815)
1 parent b2b7191 commit d5be6f7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

test/UniTest.Sass/VariableTest.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,8 @@
77

88
namespace UniTest.Sass;
99

10-
public partial class VariableTest
10+
public partial class VariableTest(ITestOutputHelper testOutputHelper)
1111
{
12-
private ITestOutputHelper _outputHelper;
13-
14-
public VariableTest(ITestOutputHelper testOutputHelper)
15-
{
16-
_outputHelper = testOutputHelper;
17-
}
18-
1912
[Fact]
2013
public void Variable_Ok()
2114
{
@@ -24,7 +17,7 @@ public void Variable_Ok()
2417
var sassFilePath = Path.Combine(rootPath, "Components");
2518
Assert.True(Directory.Exists(sassFilePath));
2619

27-
var variableFile = Path.Combine(rootPath, "wwwroot/scss/theme/bootstrapblazor.scss");
20+
var variableFile = Path.Combine(rootPath, "wwwroot/scss/variables.scss");
2821
Assert.True(File.Exists(variableFile));
2922

3023
// 获取所有 Sass 文件所有变量
@@ -53,7 +46,7 @@ void ValidateVariable(string scssFile, List<string> variables)
5346

5447
// #{$alert-icon-margin-right}
5548
var matches = regex.Matches(item);
56-
if (matches.Any())
49+
if (matches.Count != 0)
5750
{
5851
var v = matches.Where(i => !variables.Contains(i.Groups[1].Value)).Select(i => i.Groups[1].Value);
5952
if (v.Any())
@@ -72,7 +65,7 @@ void CheckMixVariable(string item)
7265
var matches = mixRegex.Matches(item);
7366
if (item.Contains("@mixin "))
7467
{
75-
if (matches.Any())
68+
if (matches.Count != 0)
7669
{
7770
var groups = matches[0];
7871
for (int index = 1; index < groups.Groups.Count; index++)

0 commit comments

Comments
 (0)