Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
[webview_flutter_wkwebview] Implements currentUrl (#5974)
Browse files Browse the repository at this point in the history
  • Loading branch information
bparrishMines authored Jun 15, 2022
1 parent 3a7a163 commit 1410600
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ class WebKitWebViewPlatformController extends WebViewPlatformController {
@override
Future<String?> getTitle() => webView.getTitle();

@override
Future<String?> currentUrl() => webView.getUrl();

@override
Future<void> scrollTo(int x, int y) async {
webView.scrollView.setContentOffset(Point<double>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,14 @@ void main() {
expect(testController.getTitle(), completion('Web Title'));
});

testWidgets('currentUrl', (WidgetTester tester) async {
await buildWidget(tester);

when(mockWebView.getUrl())
.thenAnswer((_) => Future<String>.value('myUrl.com'));
expect(testController.currentUrl(), completion('myUrl.com'));
});

testWidgets('scrollTo', (WidgetTester tester) async {
await buildWidget(tester);

Expand Down

0 comments on commit 1410600

Please sign in to comment.