| <!doctype html> |
| <html class="reftest-wait"> |
| <script src="../../../resources/ui-helper.js"></script> |
| <input type=checkbox switch onclick=end()> |
| <div id=state></div> |
| <script> |
| window.onload = async () => { |
| const input = document.querySelector("input"); |
| const x = input.offsetLeft; |
| const y = input.offsetTop; |
| const width = input.offsetWidth; |
| |
| if (UIHelper.isIOSFamily()) { |
| const eventStreamData = new UIHelper.EventStreamBuilder() |
| .begin(x, y) |
| .wait(0.21) |
| .move(x + width, y, 0.01) |
| .move(x, y, 0.01) |
| .end() |
| .takeResult(); |
| UIHelper.sendEventStream(eventStreamData); |
| return; |
| } |
| await eventSender.asyncMouseMoveTo(x, y); |
| await eventSender.asyncMouseDown(); |
| await eventSender.asyncMouseMoveTo(x + width, y); |
| await eventSender.asyncMouseMoveTo(x, y); |
| await eventSender.asyncMouseUp(); |
| } |
| function end() { |
| document.querySelector("#state").textContent = document.querySelector("input").checked ? "Switched on." : "Switched off."; |
| setTimeout(() => document.documentElement.removeAttribute("class"), 50); |
| } |
| </script> |