2022-06-21 08:09:38 +02:00
|
|
|
// Copyright (c) Umbraco.
|
2020-12-20 08:36:11 +01:00
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
2021-02-15 13:07:12 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.WebAssets;
|
2021-02-09 11:26:22 +01:00
|
|
|
using Umbraco.Extensions;
|
2016-02-17 10:59:48 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common.AngularIntegration;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class JsInitializationTests
|
2016-02-17 10:59:48 +01:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
[Test]
|
|
|
|
|
public void Parse_Main()
|
2016-02-17 10:59:48 +01:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
var result = BackOfficeJavaScriptInitializer.WriteScript("[World]", "Hello", "Blah");
|
2016-02-17 10:59:48 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
Assert.AreEqual(
|
|
|
|
|
@"LazyLoad.js([World], function () {
|
2016-02-17 10:59:48 +01:00
|
|
|
//we need to set the legacy UmbClientMgr path
|
2018-09-20 11:27:44 +02:00
|
|
|
if ((typeof UmbClientMgr) !== ""undefined"") {
|
|
|
|
|
UmbClientMgr.setUmbracoPath('Hello');
|
|
|
|
|
}
|
2016-02-17 10:59:48 +01:00
|
|
|
|
|
|
|
|
jQuery(document).ready(function () {
|
|
|
|
|
|
2018-09-14 00:14:03 +10:00
|
|
|
angular.bootstrap(document, ['Blah']);
|
2016-02-17 10:59:48 +01:00
|
|
|
|
|
|
|
|
});
|
2022-06-21 08:09:38 +02:00
|
|
|
});".StripWhitespace(),
|
|
|
|
|
result.StripWhitespace());
|
2016-02-17 10:59:48 +01:00
|
|
|
}
|
|
|
|
|
}
|