예제 #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();
        }