lock-bad-argument.html (734B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 promise_test(t => { 6 const invalid_lock_types = [ 7 "invalid-orientation", 8 null, 9 undefined, 10 123, 11 window, 12 "", 13 true, 14 ["portrait-primary", "landscape-primary"], 15 ]; 16 const promisesToReject = invalid_lock_types.map(type => 17 promise_rejects_js(t, TypeError, screen.orientation.lock(type)) 18 ); 19 return Promise.all(promisesToReject); 20 }, "screen.orientation.lock() must throw given invalid input."); 21 22 promise_test(t => { 23 return promise_rejects_js(t, TypeError, screen.orientation.lock()); 24 }, "screen.orientation.lock() must throw when the input is missing."); 25 </script>