diff --git a/MLS.Agent.Tests/GetChartHtmlTests.cs b/MLS.Agent.Tests/GetChartHtmlTests.cs index 38bb3017f..0e72a818d 100644 --- a/MLS.Agent.Tests/GetChartHtmlTests.cs +++ b/MLS.Agent.Tests/GetChartHtmlTests.cs @@ -34,7 +34,7 @@ public void Returns_the_html_with_script_containing_require_config() var document = new HtmlDocument(); document.LoadHtml(html); - document.DocumentNode.SelectSingleNode("//script").InnerHtml.Should().Contain("require.config({paths:{plotly:\'https://cdn.plot.ly/plotly-latest.min\'}});"); + document.DocumentNode.SelectSingleNode("//script").InnerHtml.Should().Contain("var xplotRequire = require.config({context:'xplot-2.0.0',paths:{plotly:'https://cdn.plot.ly/plotly-1.49.2.min'}});"); } [Fact] @@ -52,7 +52,7 @@ public void Returns_the_html_with_script_containing_require_plotly_and_call_to_n .Select(item => item.Trim()) .Where(item => !string.IsNullOrWhiteSpace(item)) .Should() - .ContainInOrder(@"require(['plotly'], function(Plotly) {", + .ContainInOrder(@"xplotRequire(['plotly'], function(Plotly) {", "var data = null;", @"var layout = """";", $"Plotly.newPlot('{divId}', data, layout);"); diff --git a/MLS.Agent.Tests/XplotKernelExtensionTests.cs b/MLS.Agent.Tests/XplotKernelExtensionTests.cs index 67d65e645..e0d970dfe 100644 --- a/MLS.Agent.Tests/XplotKernelExtensionTests.cs +++ b/MLS.Agent.Tests/XplotKernelExtensionTests.cs @@ -35,9 +35,9 @@ public async Task When_a_chart_is_returned_the_value_produced_has_html_with_the_ .Should(). ContainSingle(valueProduced => valueProduced.FormattedValues.Any(formattedValue => - formattedValue.MimeType == "text/html" && - formattedValue.Value.ToString().Contains("require([\'plotly\'], function(Plotly)") - && formattedValue.Value.ToString().Contains("require.config({paths:{plotly:\'https://cdn.plot.ly/plotly-latest.min\'}});") + formattedValue.MimeType == "text/html" + && formattedValue.Value.ToString().Contains("var xplotRequire = require.config({context:'xplot-2.0.0',paths:{plotly:'https://cdn.plot.ly/plotly-1.49.2.min'}});") + && formattedValue.Value.ToString().Contains("xplotRequire([\'plotly\'], function(Plotly)") )); } } diff --git a/XPlot.DotNet.Interactive.KernelExtensions/XPlotKernelExtension.cs b/XPlot.DotNet.Interactive.KernelExtensions/XPlotKernelExtension.cs index b713610ae..02dd4bba0 100644 --- a/XPlot.DotNet.Interactive.KernelExtensions/XPlotKernelExtension.cs +++ b/XPlot.DotNet.Interactive.KernelExtensions/XPlotKernelExtension.cs @@ -42,8 +42,8 @@ private static HtmlNode GetScriptNodeWithRequire(HtmlNode scriptNode) newScript.AppendLine("