这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MLS.Agent.Tests/MLS.Agent.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.12" />
<PackageReference Include="HttpResponseMessageAssertions" Version="0.1.8580001">
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion MLS.Repositories.Tests/MLS.Repositories.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Assent" Version="1.3.1" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.12" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.1.5" />
<PackageReference Include="JsonSerializationExtensions" Version="0.1.8580001">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
Expand Down
22 changes: 21 additions & 1 deletion Microsoft.DotNet.Interactive/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
using System.Threading.Tasks;
using Microsoft.DotNet.Interactive.Commands;
using Microsoft.DotNet.Interactive.Rendering;
using static Microsoft.DotNet.Interactive.Rendering.PocketViewTags;

namespace Microsoft.DotNet.Interactive
{
public static class Kernel
{
public static void display(
object value,
object value,
string mimeType = HtmlFormatter.MimeType)
{
var formatted = new FormattedValue(
Expand All @@ -23,5 +24,24 @@ public static void display(
kernel.SendAsync(new DisplayValue(formatted)))
.Wait();
}

public static void Javascript(
string scriptContent)
{
PocketView value =
script[type: "text/javascript"](
HTML(
scriptContent));

var formatted = new FormattedValue(
HtmlFormatter.MimeType,
value.ToString());

var kernel = KernelInvocationContext.Current.Kernel;

Task.Run(() =>
kernel.SendAsync(new DisplayValue(formatted)))
.Wait();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Assent" Version="1.3.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.12" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="Markdig" Version="0.17.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="JsonSerializationExtensions" Version="0.1.8580001">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Assent" Version="1.3.1" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="JsonSerializationExtensions" Version="0.1.8580001">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion NotIntegrationTests/NotIntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion PackageTool.Tests/PackageTool.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion WasmCodeRunner.Tests/MLS.WasmCodeRunner.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.1.0-beta3-final" />
</ItemGroup>

Expand Down
23 changes: 23 additions & 0 deletions WorkspaceServer.Tests/Kernel/CSharpKernelRenderingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,28 @@ public async Task Display_helper_can_be_called_without_specifying_class_name()
v.MimeType == "text/html" &&
v.Value.ToString().Contains("<b>hi!</b>"));
}

[Fact]
public async Task Javascript_helper_emits_string_as_content_within_a_script_element()
{
var kernel = CreateKernel();

var scriptContent = "alert('Hello World!');";

await kernel.SendAsync(new SubmitCode($@"Javascript(""{scriptContent}"");"));

var formatted =
KernelEvents
.ValuesOnly()
.OfType<ValueProduced>()
.SelectMany(v => v.FormattedValues)
.ToArray();

formatted
.Should()
.ContainSingle(v =>
v.MimeType == "text/html" &&
v.Value.ToString().Contains($@"<script type=""text/javascript"">{scriptContent}</script>"));
}
}
}
2 changes: 1 addition & 1 deletion WorkspaceServer.Tests/WorkspaceServer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</PackageReference>
<PackageReference Include="Assent" Version="1.3.1" />
<PackageReference Include="Clockwise" Version="1.0.261-beta" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="HttpResponseMessageAssertions" Version="0.1.8580001">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down