Skip to content

Commit

Permalink
Remove: ResizeListenerService, ResizeService, BrowserWindowSizeProvid…
Browse files Browse the repository at this point in the history
…er, BreakpointService (MudBlazor#8467)
  • Loading branch information
ScarletKuro authored Mar 25, 2024
1 parent a11c796 commit b59465c
Show file tree
Hide file tree
Showing 25 changed files with 3 additions and 2,583 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
@implements IBrowserViewportObserver
@implements IAsyncDisposable

<MudAlert Severity="Severity.Warning">
MudBlazor 5.2 introduced new implementations for handling browser resize events.
The <strong>IResizeListenerService</strong> can still be used but we strongly encourage you to move to the
<strong>IBrowserViewportService </strong>
</MudAlert>

<MudCard Class="pa-5">
<MudText>
Resize the window and see width and height change:<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,9 @@ public void AddMudBlazorResizeListener_ShouldRegisterServices()
services.AddMudBlazorResizeListener();
var serviceProvider = services.BuildServiceProvider();
var browserViewportService = serviceProvider.GetService<IBrowserViewportService>();
#pragma warning disable CS0618
var resizeListenerService = serviceProvider.GetService<IResizeListenerService>();
var breakpointService = serviceProvider.GetService<IBreakpointService>();
var browserWindowSizeProvider = serviceProvider.GetService<IBrowserWindowSizeProvider>();
var resizeService = serviceProvider.GetService<IResizeService>();
#pragma warning restore CS0618

// Assert
browserViewportService.Should().NotBeNull();
resizeListenerService.Should().NotBeNull();
browserWindowSizeProvider.Should().NotBeNull();
resizeService.Should().NotBeNull();
breakpointService.Should().NotBeNull();
}

[Test]
Expand All @@ -130,21 +120,11 @@ public void AddMudBlazorResizeListener_ShouldRegisterServices_WithOptionsAction(
});
var serviceProvider = services.BuildServiceProvider();
var browserViewportService = serviceProvider.GetService<IBrowserViewportService>();
#pragma warning disable CS0618
var resizeListenerService = serviceProvider.GetService<IResizeListenerService>();
var breakpointService = serviceProvider.GetService<IBreakpointService>();
var browserWindowSizeProvider = serviceProvider.GetService<IBrowserWindowSizeProvider>();
var resizeService = serviceProvider.GetService<IResizeService>();
#pragma warning restore CS0618
var options = serviceProvider.GetRequiredService<IOptions<ResizeOptions>>();
var actualOptions = options.Value;

// Assert
browserViewportService.Should().NotBeNull();
resizeListenerService.Should().NotBeNull();
browserWindowSizeProvider.Should().NotBeNull();
breakpointService.Should().NotBeNull();
resizeService.Should().NotBeNull();
expectedOptions.Should().NotBeNull();
actualOptions.Should().BeSameAs(expectedOptions);
}
Expand Down Expand Up @@ -443,12 +423,6 @@ public void AddMudServices_ShouldRegisterAllServices()
var serviceProvider = services.BuildServiceProvider();
var dialogService = serviceProvider.GetService<IDialogService>();
var snackBarService = serviceProvider.GetService<ISnackbar>();
#pragma warning disable CS0618
var resizeListenerService = serviceProvider.GetService<IResizeListenerService>();
var breakpointService = serviceProvider.GetService<IBreakpointService>();
var browserWindowSizeProvider = serviceProvider.GetService<IBrowserWindowSizeProvider>();
var resizeService = serviceProvider.GetService<IResizeService>();
#pragma warning restore CS0618
var browserViewportService = serviceProvider.GetService<IBrowserViewportService>();
var resizeObserver = serviceProvider.GetService<IResizeObserver>();
var resizeObserverFactory = serviceProvider.GetService<IResizeObserverFactory>();
Expand All @@ -474,11 +448,7 @@ public void AddMudServices_ShouldRegisterAllServices()
// Assert
dialogService.Should().NotBeNull();
snackBarService.Should().NotBeNull();
resizeListenerService.Should().NotBeNull();
browserViewportService.Should().NotBeNull();
browserWindowSizeProvider.Should().NotBeNull();
resizeService.Should().NotBeNull();
breakpointService.Should().NotBeNull();
resizeObserver.Should().NotBeNull();
resizeObserverFactory.Should().NotBeNull();
keyInterceptor.Should().NotBeNull();
Expand Down Expand Up @@ -555,12 +525,6 @@ public void AddMudServices_ShouldRegisterAllServices_WithOptionsAction()
var serviceProvider = services.BuildServiceProvider();
var dialogService = serviceProvider.GetService<IDialogService>();
var snackBarService = serviceProvider.GetService<ISnackbar>();
#pragma warning disable CS0618
var breakpointService = serviceProvider.GetService<IBreakpointService>();
var resizeListenerService = serviceProvider.GetService<IResizeListenerService>();
var browserWindowSizeProvider = serviceProvider.GetService<IBrowserWindowSizeProvider>();
var resizeService = serviceProvider.GetService<IResizeService>();
#pragma warning restore CS0618
var browserViewportService = serviceProvider.GetService<IBrowserViewportService>();
var resizeObserver = serviceProvider.GetService<IResizeObserver>();
var resizeObserverFactory = serviceProvider.GetService<IResizeObserverFactory>();
Expand Down Expand Up @@ -594,11 +558,7 @@ public void AddMudServices_ShouldRegisterAllServices_WithOptionsAction()
// Assert
dialogService.Should().NotBeNull();
snackBarService.Should().NotBeNull();
resizeListenerService.Should().NotBeNull();
browserViewportService.Should().NotBeNull();
browserWindowSizeProvider.Should().NotBeNull();
resizeService.Should().NotBeNull();
breakpointService.Should().NotBeNull();
resizeObserver.Should().NotBeNull();
resizeObserverFactory.Should().NotBeNull();
keyInterceptor.Should().NotBeNull();
Expand Down
7 changes: 0 additions & 7 deletions src/MudBlazor.UnitTests/Generated/ApiDocsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ public void Setup()
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddSingleton<IDialogService>(new DialogService());
ctx.Services.AddSingleton<ISnackbar, SnackbarService>();
#pragma warning disable CS0618
//TODO: Remove in v7
ctx.Services.AddSingleton<IResizeListenerService>(new MockResizeListenerService());
ctx.Services.AddSingleton<IBreakpointService>(new MockBreakpointService());
ctx.Services.AddSingleton<IResizeService>(new MockResizeService());
ctx.Services.AddSingleton<IBrowserWindowSizeProvider>(new MockBrowserWindowSizeProvider());
#pragma warning restore CS0618
ctx.Services.AddSingleton<IBrowserViewportService>(new MockBrowserViewportService());
ctx.Services.AddTransient<IScrollManager, MockScrollManager>();
ctx.Services.AddTransient<IScrollListenerFactory, MockScrollListenerFactory>();
Expand Down
7 changes: 0 additions & 7 deletions src/MudBlazor.UnitTests/Generated/ExampleDocsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ public void Setup()
ctx.Services.AddSingleton<NavigationManager>(new MockNavigationManager());
ctx.Services.AddSingleton<IDialogService>(new DialogService());
ctx.Services.AddSingleton<ISnackbar, SnackbarService>();
#pragma warning disable CS0618
//TODO: Remove in v7
ctx.Services.AddSingleton<IResizeListenerService>(new MockResizeListenerService());
ctx.Services.AddSingleton<IBreakpointService>(new MockBreakpointService());
ctx.Services.AddSingleton<IResizeService>(new MockResizeService());
ctx.Services.AddSingleton<IBrowserWindowSizeProvider>(new MockBrowserWindowSizeProvider());
#pragma warning restore CS0618
ctx.Services.AddSingleton<IBrowserViewportService>(new MockBrowserViewportService());
ctx.Services.AddTransient<IScrollManager, MockScrollManager>();
ctx.Services.AddTransient<IScrollListenerFactory, MockScrollListenerFactory>();
Expand Down
118 changes: 0 additions & 118 deletions src/MudBlazor.UnitTests/Mocks/MockBreakpointService.cs

This file was deleted.

101 changes: 0 additions & 101 deletions src/MudBlazor.UnitTests/Mocks/MockResizeListenerService.cs

This file was deleted.

Loading

0 comments on commit b59465c

Please sign in to comment.