https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 9b6e516d529b526e06447d171dc2937f646bbe89 authored by Bear Travis on 11 July 2014, 21:52:43 UTC
Adding basic tests for the CSS.supports API as part of the CSS Conditional Rules Module L3.
Tip revision: 9b6e516
AmbientLightSensor_onerror-manual.https.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: onerror</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<h2>Precondition</h2>
<ol>
  <li>
    Disable the Ambient Light Sensor or run test on a device without Amibent Light Sensor.
  </li>
</ol>
<div id="log"></div>
<script>
let sensor;
setup(() => {
  sensor = new AmbientLightSensor();
});

async_test(t => {
  sensor.onactivate = t.step_func_done(assert_unreached);

  sensor.onerror = t.step_func_done(event => {
    assert_equals(sensor.state, 'errored');
    assert_equals(event.error.name, 'NotFoundError');
  });

  sensor.start();
}, "Test that 'onerror' event is fired when sensor is not supported");

</script>
back to top