Skip to content

Commit

Permalink
Change template helper to use async partials (umbraco#11243)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisjrdev authored Oct 4, 2021
1 parent 465e954 commit e416f06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
partialViewName = parentId + "/" + partialViewName;
}

return "@Html.Partial(\"" + partialViewName + "\")";
return "@await Html.PartialAsync(\"" + partialViewName + "\")";
}

function getQuerySnippet(queryExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ describe('service: templateHelper', function () {
it('should return the snippet for inserting a partial from the root', function () {
var parentId = "";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Footer")';
var snippet = '@await Html.PartialAsync("Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});

it('should return the snippet for inserting a partial from a folder', function () {
var parentId = "Folder";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Folder/Footer")';
var snippet = '@await Html.PartialAsync("Folder/Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});

it('should return the snippet for inserting a partial from a nested folder', function () {
var parentId = "Folder/NestedFolder";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Folder/NestedFolder/Footer")';
var snippet = '@await Html.PartialAsync("Folder/NestedFolder/Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});

it('should return the snippet for inserting a partial from a folder with spaces in its name', function () {
var parentId = "Folder with spaces";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Folder with spaces/Footer")';
var snippet = '@await Html.PartialAsync("Folder with spaces/Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});

Expand Down

0 comments on commit e416f06

Please sign in to comment.