CalculateHtmlIncludes() 공개 메소드

This returns the appropriate html string to include in the web page such that the requested bundle will be loaded.
public CalculateHtmlIncludes ( string bundleName, CssOrJs cssOrJs, bool inDevelopment, string>.Func getContentUrl ) : string
bundleName string
cssOrJs CssOrJs
inDevelopment bool This controls whether we supply individual files or development mode /// or single minified files/CDNs in non-development mode
getContentUrl string>.Func method to get url of content
리턴 string
        public void TestBundlerForBowerCssNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("NoConfig\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), B4BSetupHelper.GetChecksumFromRelPath());

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("mainCss", CssOrJs.Css, false, s => "url:" + s.Substring(2));

            //VERIFY
            output.ShouldEqual("<link href='url:css/mainCss.min.css?v=TdTxYoaXjmCw1qNZ3ECkVr0eMx3rj6OFikZ6GH_a_Hw' rel='stylesheet'/>");
        }
        public void TestBundlerForBowerCssNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("mainCss", CssOrJs.Css, false, s => "url:" + s.Substring(2));

            //VERIFY
            output.ShouldEqual("<link href=\"url:wwwroot/css/mainCss.min.css\" asp-append-version=\"true\" rel=\"stylesheet\"/>");
        }
        public void TestBundlerForBowerCssDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("mainCss", CssOrJs.Css, true, s => "url:" + s.Substring(2));

            //VERIFY
            var lines = output.Split(new [] {'\n'}, StringSplitOptions.RemoveEmptyEntries);
            lines.Length.ShouldEqual(2);
            lines[0].ShouldEqual("<link href='url:bootstrap.css' rel='stylesheet'/>\r");
            lines[1].ShouldEqual("<link href='url:site.css' rel='stylesheet'/>\r");
        }
        public void TestBundlerForBowerJsDebugOk()
        {
            //SETUP

            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("appLibsJs", CssOrJs.Js, true, s => "url:" + s.Substring(2));

            //VERIFY
            var lines = output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            lines.Length.ShouldEqual(3);
            lines[0].ShouldEqual("<script src='url:Script1.js'></script>\r");
            lines[1].ShouldEqual("<script src='url:Script2.js'></script>\r");
            lines[2].ShouldEqual("<script src='url:Script3.js'></script>\r");
        }
        public void TestBundlerForBowerJsNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("appLibsJs", CssOrJs.Js, false, s => "url:" + s.Substring(2));

            //VERIFY
            output.ShouldEqual("<script src=\"url:wwwroot/js/appLibsJs.min.js\" asp-append-version=\"true\"></script>");
        }
        public void TestBundlerForBowerWithCdnJsNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("standardLibsCndJs", CssOrJs.Js, false, s => "url:" + s.Substring(2));

            //VERIFY
            var lines = output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            lines.Length.ShouldEqual(2);
            lines[0].ShouldEqual("<script src='https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js' asp-fallback-src='url:wwwroot/js/jquery.min.js' asp-fallback-test='window.jQuery'></script>\r");
            lines[1].ShouldEqual("<script src='https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js' asp-fallback-src='url:wwwroot/js/bootstrap.min.js' asp-fallback-test='window.jQuery && window.jQuery.fn && window.jQuery.fn.modal'></script>\r");
        }
        public void TestBundlerForBowerWithCdnCssNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("bootstrapCdnCss", CssOrJs.Css, false, s => "url:" + s.Substring(2));

            //VERIFY
            var lines = output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            lines.Length.ShouldEqual(1);
            lines[0].ShouldEqual("<link rel=\"stylesheet\" href='https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css' asp-fallback-href='url:wwwroot/css/css/bootstrap.min.css' asp-fallback-test-class=\"sr-only\" asp-fallback-test-property=\"position\" asp-fallback-test-value=\"absolute\" />\r");
        }
예제 #8
0
        public void TestBundlerForBowerCssDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("NoConfig\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), B4BSetupHelper.GetChecksumFromRelPath());

            //ATTEMPT
            using (new TimerToConsole("CalculateHtmlIncludes Debug"))
            {
                var output = b4b.CalculateHtmlIncludes("mainCss", CssOrJs.Css, true, s => "url:" + s.Substring(2));
            }

            //VERIFY
        }
        public void TestBundlerForBowerWithCdnJsNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("WithCdn\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), B4BSetupHelper.GetChecksumFromRelPath());

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("standardLibsCdnJs", CssOrJs.Js, false, s => "url:" + s.Substring(2));

            //VERIFY
            var lines = output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            lines.Length.ShouldEqual(2);
            lines[0].ShouldEqual("<script src='https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js'></script><script>(window.jQuery||document.write(\"\\x3Cscript src='url:js/jquery.min.js?v=SnW8SeyCxQMkwmWggnI6zdSJoIVYPkVYHyM4jpW3jaQ'\\x3C/script>\"));</script>\r");
            lines[1].ShouldEqual("<script src='https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js'></script><script>(window.jQuery && window.jQuery.fn && window.jQuery.fn.modal||document.write(\"\\x3Cscript src='url:js/bootstrap.min.js?v=SnW8SeyCxQMkwmWggnI6zdSJoIVYPkVYHyM4jpW3jaQ'\\x3C/script>\"));</script>\r");
        }
        public void TestBundlerForBowerWithCdnJsDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("WithCdn\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), B4BSetupHelper.GetChecksumFromRelPath());

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("standardLibsCdnJs", CssOrJs.Js, true, s => "url:" + s.Substring(2));

            //VERIFY
            var lines = output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            lines.Length.ShouldEqual(2);
            lines[0].ShouldEqual("<script src='url:lib/jquery/dist/jquery.js'></script>\r");
            lines[1].ShouldEqual("<script src='url:lib/bootstrap/dist/js/bootstrap.js'></script>\r");
        }
        public void TestBundlerForBowerJsNonDebugOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("NoConfig\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), B4BSetupHelper.GetChecksumFromRelPath());

            //ATTEMPT
            var output = b4b.CalculateHtmlIncludes("appLibsJs", CssOrJs.Js, false, s => "url:" + s.Substring(2));

            //VERIFY
            output.ShouldEqual("<script src='url:js/appLibsJs.min.js?v=SnW8SeyCxQMkwmWggnI6zdSJoIVYPkVYHyM4jpW3jaQ'></script>");
        }