Merge remote-tracking branch 'origin/v8/8.7' into netcore/netcore

# Conflicts:
#	src/SolutionInfo.cs
This commit is contained in:
Bjarke Berg
2020-08-20 11:24:58 +02:00
11 changed files with 94 additions and 57 deletions

View File

@@ -41,7 +41,7 @@
}));
var blockConfigurationMock = { contentElementTypeKey: "7C5B74D1-E2F9-45A3-AE4B-FC7A829BF8AB", label: "Test label", settingsElementTypeKey: null, view: "testview.html" };
var blockConfigurationMock = { contentElementTypeKey: "7C5B74D1-E2F9-45A3-AE4B-FC7A829BF8AB", label: "Test label", settingsElementTypeKey: null, view: "/testview.html" };
var propertyModelMock = {
layout: {
@@ -60,7 +60,7 @@
]
};
var blockWithSettingsConfigurationMock = { contentElementTypeKey: "7C5B74D1-E2F9-45A3-AE4B-FC7A829BF8AB", label: "Test label", settingsElementTypeKey: "7C5B74D1-E2F9-45A3-AE4B-FC7A829BF8AB", view: "testview.html" };
var blockWithSettingsConfigurationMock = { contentElementTypeKey: "7C5B74D1-E2F9-45A3-AE4B-FC7A829BF8AB", label: "Test label", settingsElementTypeKey: "7C5B74D1-E2F9-45A3-AE4B-FC7A829BF8AB", view: "/testview.html" };
var propertyModelWithSettingsMock = {
layout: {
"Umbraco.TestBlockEditor": [

View File

@@ -6,6 +6,13 @@ describe('umbRequestHelper tests', function () {
beforeEach(inject(function ($injector) {
umbRequestHelper = $injector.get('umbRequestHelper');
// set the Umbraco.Sys.ServerVariables.application.applicationPath
if (!Umbraco) Umbraco = {};
if (!Umbraco.Sys) Umbraco.Sys = {};
if (!Umbraco.Sys.ServerVariables) Umbraco.Sys.ServerVariables = {};
if (!Umbraco.Sys.ServerVariables.application) Umbraco.Sys.ServerVariables.application = {};
Umbraco.Sys.ServerVariables.application.applicationPath = "/mysite/";
}));
describe('formatting Urls', function () {
@@ -34,4 +41,25 @@ describe('umbRequestHelper tests', function () {
});
});
describe('Virtual Paths', function () {
it('can convert virtual path to absolute url', function () {
var result = umbRequestHelper.convertVirtualToAbsolutePath("~/App_Plugins/hello/world.css");
expect(result).toBe("/mysite/App_Plugins/hello/world.css");
});
it('can convert absolute path to absolute url', function () {
var result = umbRequestHelper.convertVirtualToAbsolutePath("/App_Plugins/hello/world.css");
expect(result).toBe("/App_Plugins/hello/world.css");
});
it('throws on invalid virtual path', function () {
var relativePath = "App_Plugins/hello/world.css";
expect(function () {
umbRequestHelper.convertVirtualToAbsolutePath(relativePath);
}).toThrow("The path " + relativePath + " is not a virtual path");
});
});
});