这是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
4 changes: 2 additions & 2 deletions MLS.Agent.Tests/GetChartHtmlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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);");
Expand Down
6 changes: 3 additions & 3 deletions MLS.Agent.Tests/XplotKernelExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ private static HtmlNode GetScriptNodeWithRequire(HtmlNode scriptNode)

newScript.AppendLine("<script>");
newScript.Append(@"
require.config({paths:{plotly:'https://cdn.plot.ly/plotly-latest.min'}});
require(['plotly'], function(Plotly) {
var xplotRequire = require.config({context:'xplot-2.0.0',paths:{plotly:'https://cdn.plot.ly/plotly-1.49.2.min'}});
xplotRequire(['plotly'], function(Plotly) {
");

newScript.Append(scriptNode.InnerText);
Expand Down