| <script src="../media-file.js"></script> |
| <script src="controls-test-helpers.js"></script> |
| <script> |
| const isVisible = (state) => { |
| if (state === null || typeof state.className !== "string") |
| return true; |
| let classes = state.className.split(); |
| return !classes.includes("dropped") && !classes.includes("hidden"); |
| } |
| |
| const tester = new ControlsTest() |
| .whenReady(scrubAndWait) |
| .start(); |
| |
| function scrubAndWait() |
| { |
| currentState = tester.currentState; |
| tester.test("We are using the apple idiom") |
| .value(currentState.idiom) |
| .isEqualTo("apple"); |
| |
| tester.logMessage("Scrub to the end of the media"); |
| |
| tester.resetEventTrigger("ended") |
| .whenReady(runTests); |
| tester.media.currentTime = tester.media.duration - 0.05; |
| tester.media.play(); |
| } |
| |
| function runTests() |
| { |
| tester.test("Video is paused") |
| .value(tester.media.paused) |
| .isTrue(); |
| |
| ["Time Remaining", "Current Time"].forEach(name => { |
| const elementState = tester.stateForControlsElement(name); |
| tester.test(`${name} is visible`) |
| .value(isVisible(elementState)) |
| .isTrue(); |
| }); |
| tester.end(); |
| } |
| </script> |
| <p>This tests that the scrubber shows on a default media element.</p> |
| <p>This test only runs in DRT!</p> |
| <video name="media" controls autoplay style="width:300px !important;"></video> |