示例#1
0
        public void AddMinimizedHtmlAttribute_MaintainsHTMLAttributes_SomeMinimized()
        {
            // Arrange
            var executionContext   = new TagHelperExecutionContext("input", selfClosing: true);
            var expectedAttributes = new TagHelperAttributeList
            {
                { "class", "btn" },
                { "foo", "bar" }
            };

            expectedAttributes.Add(new TagHelperAttribute {
                Name = "checked", Minimized = true
            });
            expectedAttributes.Add(new TagHelperAttribute {
                Name = "visible", Minimized = true
            });

            // Act
            executionContext.AddHtmlAttribute("class", "btn");
            executionContext.AddHtmlAttribute("foo", "bar");
            executionContext.AddMinimizedHtmlAttribute("checked");
            executionContext.AddMinimizedHtmlAttribute("visible");

            // Assert
            Assert.Equal(
                expectedAttributes,
                executionContext.HTMLAttributes,
                CaseSensitiveTagHelperAttributeComparer.Default);
        }
示例#2
0
        public void AddMinimizedHtmlAttribute_MaintainsHTMLAttributes()
        {
            // Arrange
            var executionContext   = new TagHelperExecutionContext("input", selfClosing: true);
            var expectedAttributes = new TagHelperAttributeList
            {
                ["checked"] = new TagHelperAttribute {
                    Name = "checked", Minimized = true
                },
                ["visible"] = new TagHelperAttribute {
                    Name = "visible", Minimized = true
                }
            };

            // Act
            executionContext.AddMinimizedHtmlAttribute("checked");
            executionContext.AddMinimizedHtmlAttribute("visible");

            // Assert
            Assert.Equal(
                expectedAttributes,
                executionContext.HTMLAttributes,
                CaseSensitiveTagHelperAttributeComparer.Default);
        }
        public void AddMinimizedHtmlAttribute_MaintainsHTMLAttributes_SomeMinimized()
        {
            // Arrange
            var executionContext = new TagHelperExecutionContext("input", tagMode: TagMode.SelfClosing);
            var expectedAttributes = new TagHelperAttributeList
            {
                { "class", "btn" },
                { "foo", "bar" }
            };
            expectedAttributes.Add(new TagHelperAttribute { Name = "checked", Minimized = true });
            expectedAttributes.Add(new TagHelperAttribute { Name = "visible", Minimized = true });

            // Act
            executionContext.AddHtmlAttribute("class", "btn");
            executionContext.AddHtmlAttribute("foo", "bar");
            executionContext.AddMinimizedHtmlAttribute("checked");
            executionContext.AddMinimizedHtmlAttribute("visible");

            // Assert
            Assert.Equal(
                expectedAttributes,
                executionContext.HTMLAttributes,
                CaseSensitiveTagHelperAttributeComparer.Default);
        }
        public void AddMinimizedHtmlAttribute_MaintainsHTMLAttributes()
        {
            // Arrange
            var executionContext = new TagHelperExecutionContext("input", tagMode: TagMode.StartTagOnly);
            var expectedAttributes = new TagHelperAttributeList
            {
                ["checked"] = new TagHelperAttribute { Name = "checked", Minimized = true },
                ["visible"] = new TagHelperAttribute { Name = "visible", Minimized = true }
            };

            // Act
            executionContext.AddMinimizedHtmlAttribute("checked");
            executionContext.AddMinimizedHtmlAttribute("visible");

            // Assert
            Assert.Equal(
                expectedAttributes,
                executionContext.HTMLAttributes,
                CaseSensitiveTagHelperAttributeComparer.Default);
        }
示例#5
0
        #pragma warning disable 1998
        public override async Task ExecuteAsync()
        {
            __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
            Instrumentation.BeginContext(25, 253, true);
            WriteLiteral("\r\n<ul [item]=\"items\"></ul>\r\n<ul [(item)]=\"items\"></ul>\r\n<button (click)=\"doSometh" +
"ing()\">Click Me</button>\r\n<button (^click)=\"doSomething()\">Click Me</button>\r\n<t" +
"emplate *something=\"value\">\r\n</template>\r\n<div #local></div>\r\n<div #local=\"value" +
"\"></div>\r\n\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("ul", TagMode.StartTagAndEndTag, "test", async() => {
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
#line 12 "SymbolBoundAttributes.cshtml"
__CatchAllTagHelper.ListItems = items;

#line default
#line hidden
            __tagHelperExecutionContext.AddTagHelperAttribute("[item]", __CatchAllTagHelper.ListItems);
            __tagHelperExecutionContext.AddHtmlAttribute("[item]", Html.Raw("items"));
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(278, 45, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            Instrumentation.BeginContext(323, 2, true);
            WriteLiteral("\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("ul", TagMode.StartTagAndEndTag, "test", async() => {
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
#line 13 "SymbolBoundAttributes.cshtml"
__CatchAllTagHelper.ArrayItems = items;

#line default
#line hidden
            __tagHelperExecutionContext.AddTagHelperAttribute("[(item)]", __CatchAllTagHelper.ArrayItems);
            __tagHelperExecutionContext.AddHtmlAttribute("[(item)]", Html.Raw("items"));
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(325, 49, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            Instrumentation.BeginContext(374, 2, true);
            WriteLiteral("\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("button", TagMode.StartTagAndEndTag, "test", async() => {
                Instrumentation.BeginContext(438, 8, true);
                WriteLiteral("Click Me");
                Instrumentation.EndContext();
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
#line 14 "SymbolBoundAttributes.cshtml"
__CatchAllTagHelper.Event1 = doSomething();

#line default
#line hidden
            __tagHelperExecutionContext.AddTagHelperAttribute("(click)", __CatchAllTagHelper.Event1);
            __tagHelperExecutionContext.AddHtmlAttribute("(click)", Html.Raw("doSomething()"));
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(376, 79, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            Instrumentation.BeginContext(455, 2, true);
            WriteLiteral("\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("button", TagMode.StartTagAndEndTag, "test", async() => {
                Instrumentation.BeginContext(521, 8, true);
                WriteLiteral("Click Me");
                Instrumentation.EndContext();
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
#line 15 "SymbolBoundAttributes.cshtml"
__CatchAllTagHelper.Event2 = doSomething();

#line default
#line hidden
            __tagHelperExecutionContext.AddTagHelperAttribute("(^click)", __CatchAllTagHelper.Event2);
            __tagHelperExecutionContext.AddHtmlAttribute("(^click)", Html.Raw("doSomething()"));
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(457, 81, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            Instrumentation.BeginContext(538, 2, true);
            WriteLiteral("\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("template", TagMode.StartTagAndEndTag, "test", async() => {
                Instrumentation.BeginContext(594, 2, true);
                WriteLiteral("\r\n");
                Instrumentation.EndContext();
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
            __CatchAllTagHelper.StringProperty1 = "value";
            __tagHelperExecutionContext.AddTagHelperAttribute("*something", __CatchAllTagHelper.StringProperty1);
            __tagHelperExecutionContext.AddHtmlAttribute("*something", Html.Raw("value"));
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(540, 67, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            Instrumentation.BeginContext(607, 2, true);
            WriteLiteral("\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", TagMode.StartTagAndEndTag, "test", async() => {
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("#localminimized");
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(609, 33, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            Instrumentation.BeginContext(642, 2, true);
            WriteLiteral("\r\n");
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", TagMode.StartTagAndEndTag, "test", async() => {
            }
            , StartTagHelperWritingScope, EndTagHelperWritingScope);
            __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
            __tagHelperExecutionContext.Add(__CatchAllTagHelper);
            __tagHelperExecutionContext.AddMinimizedHtmlAttribute("bound");
            __CatchAllTagHelper.StringProperty2 = "value";
            __tagHelperExecutionContext.AddTagHelperAttribute("#local", __CatchAllTagHelper.StringProperty2);
            __tagHelperExecutionContext.AddHtmlAttribute("#local", Html.Raw("value"));
            __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            Instrumentation.BeginContext(644, 47, false);
            await WriteTagHelperAsync(__tagHelperExecutionContext);
            Instrumentation.EndContext();
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
        }
示例#6
0
 #pragma warning disable 1998
 public override async Task ExecuteAsync()
 {
     __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
     Instrumentation.BeginContext(33, 2, true);
     WriteLiteral("\r\n");
     Instrumentation.EndContext();
     __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", TagMode.StartTagAndEndTag, "test", async() => {
         Instrumentation.BeginContext(64, 34, true);
         WriteLiteral("\r\n    <input nottaghelper />\r\n    ");
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => {
         }
         , StartTagHelperWritingScope, EndTagHelperWritingScope);
         __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
         __tagHelperExecutionContext.Add(__CatchAllTagHelper);
         __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn"));
         __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required");
         __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
         Instrumentation.BeginContext(98, 59, false);
         await WriteTagHelperAsync(__tagHelperExecutionContext);
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.End();
         Instrumentation.BeginContext(157, 6, true);
         WriteLiteral("\r\n    ");
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => {
         }
         , StartTagHelperWritingScope, EndTagHelperWritingScope);
         __InputTagHelper = CreateTagHelper<InputTagHelper>();
         __tagHelperExecutionContext.Add(__InputTagHelper);
         __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
         __tagHelperExecutionContext.Add(__CatchAllTagHelper);
         __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn"));
         __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required");
         __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required");
         __InputTagHelper.BoundRequiredString = "hello";
         __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString);
         __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
         Instrumentation.BeginContext(163, 119, false);
         await WriteTagHelperAsync(__tagHelperExecutionContext);
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.End();
         Instrumentation.BeginContext(282, 6, true);
         WriteLiteral("\r\n    ");
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => {
         }
         , StartTagHelperWritingScope, EndTagHelperWritingScope);
         __InputTagHelper = CreateTagHelper<InputTagHelper>();
         __tagHelperExecutionContext.Add(__InputTagHelper);
         __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
         __tagHelperExecutionContext.Add(__CatchAllTagHelper);
         __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn"));
         __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required");
         __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required");
         __CatchAllTagHelper.BoundRequiredString = "world";
         __tagHelperExecutionContext.AddTagHelperAttribute("catchall-bound-string", __CatchAllTagHelper.BoundRequiredString);
         __InputTagHelper.BoundRequiredString = "hello2";
         __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString);
         __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
         Instrumentation.BeginContext(288, 176, false);
         await WriteTagHelperAsync(__tagHelperExecutionContext);
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.End();
         Instrumentation.BeginContext(464, 6, true);
         WriteLiteral("\r\n    ");
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => {
         }
         , StartTagHelperWritingScope, EndTagHelperWritingScope);
         __InputTagHelper = CreateTagHelper<InputTagHelper>();
         __tagHelperExecutionContext.Add(__InputTagHelper);
         __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
         __tagHelperExecutionContext.Add(__CatchAllTagHelper);
         __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn"));
         __tagHelperExecutionContext.AddHtmlAttribute("catchall-unbound-required", Html.Raw("hello"));
         __tagHelperExecutionContext.AddHtmlAttribute("input-unbound-required", Html.Raw("hello2"));
         __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required");
         __InputTagHelper.BoundRequiredString = "world";
         __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString);
         __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
         Instrumentation.BeginContext(470, 206, false);
         await WriteTagHelperAsync(__tagHelperExecutionContext);
         Instrumentation.EndContext();
         __tagHelperExecutionContext = __tagHelperScopeManager.End();
         Instrumentation.BeginContext(676, 2, true);
         WriteLiteral("\r\n");
         Instrumentation.EndContext();
     }
     , StartTagHelperWritingScope, EndTagHelperWritingScope);
     __CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>();
     __tagHelperExecutionContext.Add(__CatchAllTagHelper);
     __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required");
     __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
     Instrumentation.BeginContext(35, 647, false);
     await WriteTagHelperAsync(__tagHelperExecutionContext);
     Instrumentation.EndContext();
     __tagHelperExecutionContext = __tagHelperScopeManager.End();
 }