2016-02-17 10:59:48 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using NUnit.Framework;
|
2016-02-17 13:28:11 +01:00
|
|
|
|
using Umbraco.Core;
|
2019-01-29 23:05:59 +11:00
|
|
|
|
using Umbraco.Web.JavaScript;
|
2016-02-17 10:59:48 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Tests.Web.AngularIntegration
|
|
|
|
|
|
{
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
|
public class JsInitializationTests
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public void Get_Default_Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
var init = JsInitialization.GetDefaultInitialization();
|
|
|
|
|
|
Assert.IsTrue(init.Any());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public void Parse_Main()
|
|
|
|
|
|
{
|
2020-03-17 15:36:38 +01:00
|
|
|
|
var result = JavaScriptHelper.WriteScript("[World]", "Hello", "Blah");
|
2016-02-17 10:59:48 +01:00
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(@"LazyLoad.js([World], function () {
|
|
|
|
|
|
//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
|
|
|
|
|
|
|
|
|
|
});
|
2016-02-17 13:28:11 +01:00
|
|
|
|
});".StripWhitespace(), result.StripWhitespace());
|
2016-02-17 10:59:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|