示例#1
0
        public void RemoveAttributesFromElement_NoAttributes_ThrowsArgumentNullException()
        {
            var selector = "#selector";

            Action action = () => Taconite.RemoveAttributes().From(selector);

            action.ShouldThrow <ArgumentNullException>();
        }
示例#2
0
        public void RemoveAttributesFromElement_NullOrEmptySelector_ThrowsArgumentNullException(
            [Values(null, "")] string selector)
        {
            var attributeName = "attribute";

            Action action = () => Taconite.RemoveAttributes(attributeName).From(selector);

            action.ShouldThrow <ArgumentNullException>();
        }
示例#3
0
        public void RemoveAttributesFromElement_SingleAttribute()
        {
            var attributeName = "attribute";
            var selector      = "#selector";

            var result = Taconite.RemoveAttributes(attributeName).From(selector);

            result.Commands.Should().HaveCount(1);
            var command = result.Commands.Single();

            command.As <NonElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command  = "removeAttr",
                Selector = selector
            });
            command.As <NonElementCommand>().Arguments.Should().HaveCount(1)
            .And.Contain(attributeName);
        }
示例#4
0
        public void RemoveAttributesFromElement_TwoAttributes()
        {
            var attribute0 = "attribute0";
            var attribute1 = "attribute1";
            var selector   = "#selector";

            var result = Taconite.RemoveAttributes(attribute0, attribute1).From(selector);

            result.Commands.Should().HaveCount(2);
            foreach (var command in result.Commands)
            {
                command.As <NonElementCommand>()
                .Should().NotBeNull()
                .ShouldHave().SharedProperties().EqualTo(new
                {
                    Command  = "removeAttr",
                    Selector = selector
                });
            }
            result.Commands.ElementAt(0).As <NonElementCommand>().Arguments.Should().HaveCount(1)
            .And.Contain(attribute0);
            result.Commands.ElementAt(1).As <NonElementCommand>().Arguments.Should().HaveCount(1)
            .And.Contain(attribute1);
        }