2013-08-12 15:06:12 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
using Umbraco.Core.Manifest;
|
|
|
|
|
|
using Umbraco.Web.UI.JavaScript;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Tests.AngularIntegration
|
|
|
|
|
|
{
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
|
public class JsInitializationTests
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public void Get_Default_Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
var init = JsInitialization.GetDefaultInitialization();
|
|
|
|
|
|
Assert.IsTrue(init.Any());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public void Parse_Main()
|
|
|
|
|
|
{
|
2014-05-05 12:59:34 +02:00
|
|
|
|
var result = JsInitialization.ParseMain(new[] {"[World]", "Hello" });
|
2013-08-12 15:06:12 +02:00
|
|
|
|
|
2014-05-28 13:06:23 +02:00
|
|
|
|
Assert.AreEqual(@"LazyLoad.js([World], function () {
|
|
|
|
|
|
//we need to set the legacy UmbClientMgr path
|
|
|
|
|
|
UmbClientMgr.setUmbracoPath('Hello');
|
2013-08-12 15:06:12 +02:00
|
|
|
|
|
2014-05-28 13:06:23 +02:00
|
|
|
|
jQuery(document).ready(function () {
|
2015-04-01 14:29:35 +11:00
|
|
|
|
|
2014-05-28 13:06:23 +02:00
|
|
|
|
angular.bootstrap(document, ['umbraco']);
|
2015-04-01 14:29:35 +11:00
|
|
|
|
|
2014-05-28 13:06:23 +02:00
|
|
|
|
});
|
2013-11-01 17:32:03 +11:00
|
|
|
|
});", result);
|
2013-08-12 15:06:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|