diff --git a/PolyPilot.Tests/QrCodeBlurTests.cs b/PolyPilot.Tests/QrCodeBlurTests.cs
index 62ccff8aa1..ebff8bf995 100644
--- a/PolyPilot.Tests/QrCodeBlurTests.cs
+++ b/PolyPilot.Tests/QrCodeBlurTests.cs
@@ -3,9 +3,10 @@
namespace PolyPilot.Tests;
///
-/// Tests that verify the QR code images in Settings are blurred by default
-/// (when showToken is false), matching the token's blur behavior.
-/// Since these are Blazor components, we verify the source markup contracts.
+/// Tests that verify QR code images and the token value in Settings are blurred
+/// by default, each controlled by an independent toggle (showQrCode,
+/// showDirectQrCode, showToken). Since these are Blazor components, we verify
+/// the source markup contracts.
///
public class QrCodeBlurTests
{
@@ -25,17 +26,19 @@ private static string GetSettingsCssPath()
}
[Fact]
- public void QrCodeImages_UseBlurredClassFromShowTokenToggle()
+ public void QrCodeImages_UseBlurredClassFromIndependentQrToggles()
{
var razorContent = File.ReadAllText(GetSettingsRazorPath());
- // Both QR code img tags should use the showToken toggle for blurred class
- var qrImgPattern = new Regex(@"
]* between attributes so harmless additions/reordering don't break the test.
+ var tunnelQrPattern = new Regex(@"
]*src=""@qrCodeDataUri""[^>]*class=""@\(showQrCode \? """" : ""blurred""\)""");
+ var directQrPattern = new Regex(@"
]*src=""@directQrCodeDataUri""[^>]*class=""@\(showDirectQrCode \? """" : ""blurred""\)""");
- Assert.True(matches.Count >= 2,
- $"Expected at least 2 QR code
tags with showToken-based blur class, found {matches.Count}. " +
- "Both tunnel and direct QR codes must be blurred when token is hidden.");
+ Assert.True(tunnelQrPattern.IsMatch(razorContent),
+ "Tunnel QR code
must use showQrCode for the blurred class.");
+ Assert.True(directQrPattern.IsMatch(razorContent),
+ "Direct QR code
must use showDirectQrCode for the blurred class.");
}
[Fact]
@@ -43,20 +46,24 @@ public void TokenValue_UsesBlurredClassFromShowTokenToggle()
{
var razorContent = File.ReadAllText(GetSettingsRazorPath());
- // Token code element should also use showToken toggle
- Assert.Contains(@"@(showToken ? """" : ""blurred"")", razorContent);
+ // Token code element must specifically use showToken toggle (independent from QR toggles)
+ Assert.Matches(@"class=""token-value @\(showToken \? """" : ""blurred""\)""", razorContent);
}
[Fact]
- public void ShowToken_DefaultsFalse()
+ public void AllBlurToggles_DefaultFalse()
{
var razorContent = File.ReadAllText(GetSettingsRazorPath());
// showToken should be declared as bool (defaults to false)
Assert.Matches(@"private\s+bool\s+showToken\s*;", razorContent);
-
- // It should NOT be initialized to true
Assert.DoesNotMatch(@"private\s+bool\s+showToken\s*=\s*true", razorContent);
+
+ // QR code toggles must also default to false
+ Assert.Matches(@"private\s+bool\s+showQrCode\s*;", razorContent);
+ Assert.Matches(@"private\s+bool\s+showDirectQrCode\s*;", razorContent);
+ Assert.DoesNotMatch(@"private\s+bool\s+showQrCode\s*=\s*true", razorContent);
+ Assert.DoesNotMatch(@"private\s+bool\s+showDirectQrCode\s*=\s*true", razorContent);
}
[Fact]
diff --git a/PolyPilot.Tests/Scenarios/mode-switch-scenarios.json b/PolyPilot.Tests/Scenarios/mode-switch-scenarios.json
index a338a15112..53d0d006f0 100644
--- a/PolyPilot.Tests/Scenarios/mode-switch-scenarios.json
+++ b/PolyPilot.Tests/Scenarios/mode-switch-scenarios.json
@@ -828,7 +828,7 @@
},
{
"id": "settings-qr-code-blur",
- "name": "QR code is blurred by default alongside token",
+ "name": "QR code and token have independent blur toggles",
"steps": [
{
"action": "note",
@@ -840,7 +840,7 @@
"expect": {
"equals": true
},
- "note": "QR code image is blurred by default (showToken=false)"
+ "note": "QR code image is blurred by default (showQrCode=false)"
},
{
"action": "evaluate",
@@ -848,12 +848,12 @@
"expect": {
"equals": true
},
- "note": "Token value is also blurred by default"
+ "note": "Token value is also blurred by default (showToken=false)"
},
{
"action": "click",
- "selector": ".tunnel-token .copy-btn",
- "note": "Click reveal/hide token button"
+ "selector": ".qr-code .qr-reveal-btn",
+ "note": "Click the QR-specific reveal button (independent from token reveal)"
},
{
"action": "evaluate",
@@ -861,15 +861,15 @@
"expect": {
"equals": false
},
- "note": "QR code is revealed when token is shown"
+ "note": "QR code is revealed after clicking its own reveal button"
},
{
"action": "evaluate",
"script": "document.querySelector('.token-value')?.classList.contains('blurred')",
"expect": {
- "equals": false
+ "equals": true
},
- "note": "Token is also revealed"
+ "note": "Token remains blurred — QR and token toggles are independent"
}
]
}