public void PopoverOptions_Defaults() { var options = new PopoverOptions(); options.ContainerClass.Should().Be("mudblazor-main-content"); options.FlipMargin.Should().Be(0); }
public async Task MudPopoverService_Constructor_OptionWithCustomClass() { var mock = new Mock <IJSRuntime>(); var option = new PopoverOptions { ContainerClass = "my-custom-class", FlipMargin = 12, }; var optionMock = new Mock <IOptions <PopoverOptions> >(); optionMock.SetupGet(x => x.Value).Returns(option); mock.Setup(x => x.InvokeAsync <IJSVoidResult>( "mudPopover.initilize", It.Is <object[]>(x => x.Length == 2 && (string)x[0] == "my-custom-class" && (int)x[1] == 12))).ReturnsAsync(Mock.Of <IJSVoidResult>).Verifiable(); var service = new MudPopoverService(mock.Object, optionMock.Object); await service.InitializeIfNeeded(); mock.Verify(); }
/// <summary> /// Adds ScrollManager as a transient instance. /// </summary> /// <param name="services">IServiceCollection</param> /// <param name="options">Defines PopoverOptions for the application/user</param> public static IServiceCollection AddMudPopoverService(this IServiceCollection services, PopoverOptions options) { options ??= new PopoverOptions(); services.AddMudPopoverService(o => { o = options; }); return(services); }