Example #1
0
        public void ProcessTag_InactiveHeaderLink_NotAddClass()
        {
            // Arrange
            var env = new TagHelperEnvironment("Home", "Index");

            env.Output.Attributes.Add("th-nav-header", null);

            // Act
            var tagHelper = new ActiveRouteTagHelper {
                Controller      = "Profile",
                Action          = "Index",
                ViewContextData = env.ViewContext
            };

            tagHelper.Process(env.Context, env.Output);

            // Assert
            Assert.Null(env.Output.Attributes["class"]);
        }
Example #2
0
        public void ProcessTag_ActiveSecondaryLink_AddClass()
        {
            // Arrange
            var env = new TagHelperEnvironment("Band", "FlickrBand");

            env.Output.Attributes.Add("th-nav-secondary", null);

            // Act
            var tagHelper = new ActiveRouteTagHelper {
                Controller      = "Band",
                Action          = "FlickrBand",
                ViewContextData = env.ViewContext
            };

            tagHelper.Process(env.Context, env.Output);

            // Assert
            Assert.Equal("th-nav-secondary__link--active", env.Output.Attributes["class"].Value);
        }