示例#1
0
        public void CanRenderDebugTags()
        {
            debugJavaScriptBundle
            .Add(Test1Path)
            .Add(Test2Path)
            .AsNamed("TestWithDebug", currentOutputFile);

            var tag = debugJavaScriptBundle.RenderNamed("TestWithDebug");

            Assert.AreEqual("<script type=\"text/javascript\" src=\"" + Test1Path + "\"></script>\n<script type=\"text/javascript\" src=\"" + Test2Path + "\"></script>\n", tag);
        }
示例#2
0
        public void CanRenderDebugTags()
        {
            debugJavaScriptBundle
            .Add("~/js/test1.js")
            .Add("~/js/test2.js")
            .AsNamed("TestWithDebug", "~/js/output_3.js");

            var tag = debugJavaScriptBundle.RenderNamed("TestWithDebug");

            Assert.AreEqual("<script type=\"text/javascript\" src=\"js/test1.js\"></script><script type=\"text/javascript\" src=\"js/test2.js\"></script>", tag);
        }
示例#3
0
        public void CanCreateNamedBundle()
        {
            javaScriptBundle
            .Add(Test1Path)
            .AsNamed("TestNamed", currentOutputFile);

            var tag = javaScriptBundle.RenderNamed("TestNamed");

            Assert.AreEqual(GetResolvedTag(currentOutputFile + "?r=E36D384488ABCF73BCCE650C627FB74F"), tag);
            //Assert.AreEqual(TEST1_MINIFIED, currentFileReader.ReadToEnd());
        }
示例#4
0
        public void CanCreateNamedBundle()
        {
            javaScriptBundle
            .Add("~/js/test.js")
            .AsNamed("TestNamed", "~/js/output_namedbundle.js");

            var tag = javaScriptBundle.RenderNamed("TestNamed");

            Assert.AreEqual("<script type=\"text/javascript\" src=\"js/output_namedbundle.js?r=E36D384488ABCF73BCCE650C627FB74F\"></script>", tag);
            Assert.AreEqual("function product(a,b){return a*b}function sum(a,b){return a+b}", fileWriterFactory.Files[TestUtilities.PreparePathRelativeToWorkingDirectory(@"C:\js\output_namedbundle.js")]);
        }
        public void CanRenderDebugTags()
        {
            debugJavaScriptBundle
            .Add("~/js/test1.js")
            .Add("~/js/test2.js")
            .AsNamed("TestWithDebug", "~/js/output_3.js");

            var tag = debugJavaScriptBundle.RenderNamed("TestWithDebug");

            Assert.AreEqual("<script type=\"text/javascript\" src=\"js/test1.js\"></script>\n<script type=\"text/javascript\" src=\"js/test2.js\"></script>\n", TestUtilities.NormalizeLineEndings(tag));
        }
        public void CanCreateNamedBundle()
        {
            javaScriptBundle
            .Add("~/js/test.js")
            .AsNamed("TestNamed", "~/js/output_namedbundle.js");

            var tag = javaScriptBundle.RenderNamed("TestNamed");

            Assert.AreEqual("<script type=\"text/javascript\" src=\"js/output_namedbundle.js?r=36286D0CEA57C5ED24B868EB0D2898E9\"></script>", tag);
            Assert.AreEqual("function product(n,t){return n*t}function sum(n,t){return n+t}", fileWriterFactory.Files[TestUtilities.PrepareRelativePath(@"js\output_namedbundle.js")]);
        }
示例#7
0
 /// <summary>
 ///   Renders current <see cref="JavaScriptBundle" /> as a named tag
 /// </summary>
 /// <param name="javaScriptBundle">Current javascript bundle</param>
 /// <param name="name">javascript bundle name</param>
 /// <returns>Current bundle</returns>
 public static IHtmlString MvcRenderNamed(this JavaScriptBundle javaScriptBundle, string name)
 {
     return(new NonEncodedHtmlString(javaScriptBundle.RenderNamed(name)));
 }
示例#8
0
 public static MvcHtmlString MvcRenderNamed(this JavaScriptBundle javaScriptBundle, string name)
 {
     return(MvcHtmlString.Create(javaScriptBundle.RenderNamed(name)));
 }