Пример #1
0
        public void TwoInstancesAreNotEqual() // refs #262
        {
            var bundle1 = new InlineScriptBundle("var x = 1;");
            var bundle2 = new InlineScriptBundle("var x = 1;");

            bundle1.Equals(bundle2).ShouldBeFalse();
        }
        public void TwoInstancesAreNotEqual()
        {
            var bundle1 = new InlineScriptBundle("var x = 1;");
            var bundle2 = new InlineScriptBundle("var x = 1;");

            bundle1.Equals(bundle2).ShouldBeFalse();
        }
Пример #3
0
        public void GivenInlineScriptBundleWithScriptTagNoType_WhenRender_ThenScriptNotCreated()
        {
            var bundle = new InlineScriptBundle("<script>var x = 1;</script>");
            var html   = bundle.Render();

            html.ShouldEqual(
                "<script>var x = 1;</script>"
                );
        }
Пример #4
0
        public void GivenInlineScriptBundleWithScriptTagAndAttributes_WhenRender_ThenScriptNotCreated()
        {
            var bundle = new InlineScriptBundle("<script type=\"text/javascript\">var x = 1;</script>");
            bundle.HtmlAttributes.Add("class", "none");

            var html = bundle.Render();
            html.ShouldEqual(
                "<script class=\"none\" type=\"text/javascript\">var x = 1;</script>"
            );
        }
Пример #5
0
 public void GivenInlineScriptBundleWithContent_WhenRender_ThenScriptElementCreatedWithContent()
 {
     var bundle = new InlineScriptBundle("var x = 1;");
     var html = bundle.Render();
     html.ShouldEqual(
         "<script type=\"text/javascript\">" + Environment.NewLine +
         "var x = 1;" + Environment.NewLine +
         "</script>"
     );
 }
Пример #6
0
        public void GivenInlineScriptBundleWithContent_WhenRender_ThenScriptElementCreatedWithContent()
        {
            var bundle = new InlineScriptBundle("var x = 1;");
            var html   = bundle.Render();

            html.ShouldEqual(
                "<script type=\"text/javascript\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>"
                );
        }
Пример #7
0
        public void GivenInlineScriptBundleHtmlAttributes_WhenRender_ThenScriptElementCreatedWithAttributes()
        {
            var bundle = new InlineScriptBundle("var x = 1;");
            bundle.HtmlAttributes.Add("class", "none");

            var html = bundle.Render();
            html.ShouldEqual(
                "<script type=\"text/javascript\" class=\"none\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>"
            );
        }
Пример #8
0
        public void GivenInlineScriptBundleWithScriptTagAndAttributes_WhenRender_ThenScriptNotCreated()
        {
            var bundle = new InlineScriptBundle("<script type=\"text/javascript\">var x = 1;</script>");

            bundle.HtmlAttributes.Add("class", "none");

            var html = bundle.Render();

            html.ShouldEqual(
                "<script class=\"none\" type=\"text/javascript\">var x = 1;</script>"
                );
        }
Пример #9
0
        public void GivenInlineScriptBundleWithNotIECondition_WhenRender_ThenScriptElementHasConditionalCommentButLeavesScriptVisibleToAllBrowsers()
        {
            var bundle = new InlineScriptBundle("var x = 1;");
            bundle.Condition = "(gt IE 9)| !IE";

            var html = bundle.Render();
            html.ShouldEqual(
                "<!--[if " + bundle.Condition + "]><!-->" + Environment.NewLine +
                "<script type=\"text/javascript\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>" + Environment.NewLine +
                "<!-- <![endif]-->"
            );
        }
Пример #10
0
        public void GivenInlineScriptBundleWithCondition_WhenRender_ThenScriptElementHasConditionalComment()
        {
            var bundle = new InlineScriptBundle("var x = 1;");
            bundle.Condition = "IE";

            var html = bundle.Render();
            html.ShouldEqual(
                "<!--[if IE]>" + Environment.NewLine +
                "<script type=\"text/javascript\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>" + Environment.NewLine +
                "<![endif]-->"
            );
        }
Пример #11
0
        public void GivenInlineScriptBundleHtmlAttributes_WhenRender_ThenScriptElementCreatedWithAttributes()
        {
            var bundle = new InlineScriptBundle("var x = 1;");

            bundle.HtmlAttributes.Add("class", "none");

            var html = bundle.Render();

            html.ShouldEqual(
                "<script type=\"text/javascript\" class=\"none\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>"
                );
        }
Пример #12
0
        public void GivenInlineScriptBundleWithNotIECondition_WhenRender_ThenScriptElementHasConditionalCommentButLeavesScriptVisibleToAllBrowsers()
        {
            var bundle = new InlineScriptBundle("var x = 1;");

            bundle.Condition = "(gt IE 9)| !IE";

            var html = bundle.Render();

            html.ShouldEqual(
                "<!--[if " + bundle.Condition + "]><!-->" + Environment.NewLine +
                "<script type=\"text/javascript\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>" + Environment.NewLine +
                "<!-- <![endif]-->"
                );
        }
Пример #13
0
        public void GivenInlineScriptBundleWithCondition_WhenRender_ThenScriptElementHasConditionalComment()
        {
            var bundle = new InlineScriptBundle("var x = 1;");

            bundle.Condition = "IE";

            var html = bundle.Render();

            html.ShouldEqual(
                "<!--[if IE]>" + Environment.NewLine +
                "<script type=\"text/javascript\">" + Environment.NewLine +
                "var x = 1;" + Environment.NewLine +
                "</script>" + Environment.NewLine +
                "<![endif]-->"
                );
        }
Пример #14
0
 public void GivenInlineScriptBundleWithScriptTagNoType_WhenRender_ThenScriptNotCreated()
 {
     var bundle = new InlineScriptBundle("<script>var x = 1;</script>");
     var html = bundle.Render();
     html.ShouldEqual(
         "<script>var x = 1;</script>"
     );
 }
Пример #15
0
        public void TheSameInstanceIsEqual()
        {
            var bundle1 = new InlineScriptBundle("var x = 1;");

            bundle1.Equals(bundle1).ShouldBeTrue();
        }
        public void TheSameInstanceIsEqual()
        {
            var bundle1 = new InlineScriptBundle("var x = 1;");

            bundle1.Equals(bundle1).ShouldBeTrue();
        }