Skip to content

Commit

Permalink
[webview_flutter_wkwebview] Implements currentUrl (flutter#5974)
Browse files Browse the repository at this point in the history
  • Loading branch information
bparrishMines authored and mauricioluz committed Jan 26, 2023
1 parent b137a38 commit f1d5b45
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 f1d5b45

Please sign in to comment.