diff --git a/src/Components/WebAssembly/Sdk/integrationtests/ServiceWorkerAssert.cs b/src/Components/WebAssembly/Sdk/integrationtests/ServiceWorkerAssert.cs index 8597d10480..a107f6bd66 100644 --- a/src/Components/WebAssembly/Sdk/integrationtests/ServiceWorkerAssert.cs +++ b/src/Components/WebAssembly/Sdk/integrationtests/ServiceWorkerAssert.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Components/WebAssembly/Sdk/integrationtests/WasmPublishIntegrationTest.cs b/src/Components/WebAssembly/Sdk/integrationtests/WasmPublishIntegrationTest.cs index c4be79c220..4d77ffa367 100644 --- a/src/Components/WebAssembly/Sdk/integrationtests/WasmPublishIntegrationTest.cs +++ b/src/Components/WebAssembly/Sdk/integrationtests/WasmPublishIntegrationTest.cs @@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileExists(result, blazorPublishDirectory, "_framework", "System.Text.Json.dll"); // Verify dependencies are part of the output. // Verify scoped css - Assert.FileExists(result, blazorPublishDirectory, "_framework", "scoped.styles.css"); + Assert.FileExists(result, blazorPublishDirectory, "blazorwasm.styles.css"); // Verify referenced static web assets Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js"); @@ -663,7 +663,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileExists(result, blazorPublishDirectory, "_framework", "System.Text.Json.dll"); // Verify dependencies are part of the output. // Verify scoped css - Assert.FileExists(result, blazorPublishDirectory, "_framework", "scoped.styles.css"); + Assert.FileExists(result, blazorPublishDirectory, "blazorwasm.styles.css"); // Verify static assets are in the publish directory Assert.FileExists(result, blazorPublishDirectory, "index.html"); diff --git a/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets b/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets index ceef7f00b1..2afa59307e 100644 --- a/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets +++ b/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets @@ -266,11 +266,18 @@ Copyright (c) .NET Foundation. All rights reserved. $(GetCurrentProjectStaticWebAssetsDependsOn); - AddScopedCssBundle; + _BlazorWasmReplaceBundle; _BlazorWasmPrepareForRun; + + + + + + + <_BlazorBuildBootJsonPath>$(IntermediateOutputPath)blazor.boot.json diff --git a/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs b/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs index 30e821e027..839ea3159b 100644 --- a/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs +++ b/src/Components/test/E2ETest/Tests/ComponentRenderingTest.cs @@ -344,6 +344,10 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests var specialStyleDiv = appElement.FindElement(By.ClassName("special-style")); Assert.Equal("50px", specialStyleDiv.GetCssValue("padding")); + // This style is isolated to the component and comes from the bundle that gets generated for BasicTestApp + // and that includes the @import for the TestContentPackage.bundle.scp.css file + Assert.Equal("20px", specialStyleDiv.GetCssValue("font-size")); + // The external components are fully functional, not just static HTML var externalComponentButton = specialStyleDiv.FindElement(By.TagName("button")); Assert.Equal("Click me", externalComponentButton.Text); diff --git a/src/Components/test/testassets/BasicTestApp/wwwroot/index.html b/src/Components/test/testassets/BasicTestApp/wwwroot/index.html index 20c78f34f2..584dcc44bb 100644 --- a/src/Components/test/testassets/BasicTestApp/wwwroot/index.html +++ b/src/Components/test/testassets/BasicTestApp/wwwroot/index.html @@ -9,6 +9,9 @@ + + + diff --git a/src/Components/test/testassets/TestContentPackage/ComponentFromPackage.razor.css b/src/Components/test/testassets/TestContentPackage/ComponentFromPackage.razor.css new file mode 100644 index 0000000000..7703d4b4e1 --- /dev/null +++ b/src/Components/test/testassets/TestContentPackage/ComponentFromPackage.razor.css @@ -0,0 +1,3 @@ +div { + font-size: 20px; +} diff --git a/src/Components/test/testassets/TestContentPackage/wwwroot/styles.css b/src/Components/test/testassets/TestContentPackage/wwwroot/styles.css index 95137fe983..1b4c995098 100644 --- a/src/Components/test/testassets/TestContentPackage/wwwroot/styles.css +++ b/src/Components/test/testassets/TestContentPackage/wwwroot/styles.css @@ -1,10 +1,9 @@ -.special-style { +.special-style { background-image: url('./face.png'); padding: 50px; background-repeat: repeat-x; border: 5px dashed red; font-family: "Comic Sans MS"; - font-size: 20px; font-weight: bold; animation: hideous-rainbow 1s infinite; } diff --git a/src/Components/test/testassets/TestServer/Components.TestServer.csproj b/src/Components/test/testassets/TestServer/Components.TestServer.csproj index 59b8fe5685..5030a5fc78 100644 --- a/src/Components/test/testassets/TestServer/Components.TestServer.csproj +++ b/src/Components/test/testassets/TestServer/Components.TestServer.csproj @@ -1,4 +1,4 @@ - + $(DefaultNetCoreTargetFramework) @@ -36,19 +36,4 @@ - - - - - - diff --git a/src/Components/test/testassets/TestServer/Pages/_ServerHost.cshtml b/src/Components/test/testassets/TestServer/Pages/_ServerHost.cshtml index ebd2beeaf9..2421d246ad 100644 --- a/src/Components/test/testassets/TestServer/Pages/_ServerHost.cshtml +++ b/src/Components/test/testassets/TestServer/Pages/_ServerHost.cshtml @@ -10,6 +10,7 @@ + @@ -41,8 +42,6 @@ - -