public void InsertPartialViewBeforeElement_NullOrEmptyTargetSelector_ThrowsArgumentNullException(
            [Values(null, "")] string selector)
        {
            Action action = () => Taconite.InsertPartialView().Before(selector);

            action.ShouldThrow <ArgumentNullException>();
        }
        public void InsertPartialViewBeforeElement_ViewNameAndModelNotSpecified()
        {
            var selector = "#selector";

            var result = Taconite.InsertPartialView().Before(selector);

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

            command.As <ElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command  = "before",
                Html     = (string)null,
                Selector = selector
            });
            command.As <ElementCommand>().Partial.Model.Should().BeNull();
            command.As <ElementCommand>().Partial.View.Should().BeNull();
        }
        public void InsertPartialViewAfterElement_ViewNameNotSpecifiedAndModelSpecified()
        {
            var model    = new object();
            var selector = "#selector";

            var result = Taconite.InsertPartialView(model).After(selector);

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

            command.As <ElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command  = "after",
                Html     = (string)null,
                Selector = selector
            });
            command.As <ElementCommand>().Partial.Model.Should().Be(model);
            command.As <ElementCommand>().Partial.View.Should().BeNull();
        }
Exemple #4
0
 public TaconiteResult InsertBefore()
 {
     return(Taconite.InsertPartialView("GreenBox").Before("#insertBeforeTarget .example-block.blue"));
 }
Exemple #5
0
 public TaconiteResult InsertAfter()
 {
     return(Taconite.InsertPartialView("GreenBox").After("#insertAfterTarget .example-block.blue"));
 }