fixed find empty string iOS, updated tests

This commit is contained in:
Lorenzo Pichilli 2022-10-12 15:00:00 +02:00
parent 17bdf84362
commit 05cb0184fc
3 changed files with 11 additions and 8 deletions

View File

@ -47,10 +47,7 @@ void findInteractions() {
await expectLater(
findInteractionController.findAll(find: firstSearchText),
completes);
if ([TargetPlatform.iOS, TargetPlatform.macOS]
.contains(defaultTargetPlatform)) {
expect(await findInteractionController.getSearchText(), firstSearchText);
}
expect(await findInteractionController.getSearchText(), firstSearchText);
if ([TargetPlatform.android].contains(defaultTargetPlatform)) {
await Future.delayed(Duration(seconds: 1));
}
@ -62,11 +59,11 @@ void findInteractions() {
findInteractionController.findNext(forward: false), completes);
await expectLater(findInteractionController.clearMatches(), completes);
const secondSearchText = "text";
await expectLater(
findInteractionController.setSearchText(secondSearchText), completes);
if ([TargetPlatform.iOS, TargetPlatform.macOS]
.contains(defaultTargetPlatform)) {
const secondSearchText = "text";
await expectLater(
findInteractionController.setSearchText(secondSearchText), completes);
await expectLater(
findInteractionController.presentFindNavigator(), completes);
expect(await findInteractionController.getSearchText(), secondSearchText);

View File

@ -94,7 +94,7 @@ public class FindInteractionController : NSObject, Disposable {
if let completionHandler = completionHandler {
completionHandler(nil, nil)
}
} else {
} else if find != "" {
let startSearch = "window.\(JAVASCRIPT_BRIDGE_NAME)._findAllAsync('\(find)');"
webView.evaluateJavaScript(startSearch, completionHandler: completionHandler)
}

View File

@ -1206,6 +1206,12 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
}
}
if #available(iOS 16.0, *) {
if newSettingsMap["isFindInteractionEnabled"] != nil, settings?.isFindInteractionEnabled != newSettings.isFindInteractionEnabled {
isFindInteractionEnabled = newSettings.isFindInteractionEnabled
}
}
scrollView.isScrollEnabled = !(newSettings.disableVerticalScroll && newSettings.disableHorizontalScroll)
self.settings = newSettings