Skip to content

Commit

Permalink
test: HCaptcha.redrawView
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Feb 22, 2024
1 parent e1e41ec commit 09e6b91
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Example/HCaptcha_Tests/Core/HCaptcha__Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,30 @@ class HCaptcha__Tests: XCTestCase {
}
wait(for: [exp], timeout: 10)
}

func test__reconfigure() {
let exp = expectation(description: "configureWebView called twice")
var configureCounter = 0
let hcaptcha = HCaptcha(manager: HCaptchaWebViewManager(messageBody: "{action: \"showHCaptcha\"}"))
hcaptcha.configureWebView { _ in
configureCounter += 1
if configureCounter == 2 {
exp.fulfill()
}
}
hcaptcha.didFinishLoading {
let view = UIApplication.shared.windows.first?.rootViewController?.view
hcaptcha.onEvent { e, _ in
if e == .open {
hcaptcha.redrawView()
}
}
hcaptcha.validate(on: view!) { _ in
XCTFail("Should not be called")
}
}
wait(for: [exp], timeout: 10)
}
}


Expand Down

0 comments on commit 09e6b91

Please sign in to comment.