https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 728bf0b06a5162efc4f46a959bdb10364e75a169 authored by James Graham on 24 April 2014, 14:45:39 UTC
Making a control dirty doesn't require execCommand
Tip revision: 728bf0b
battery-created.html
<!DOCTYPE html>
<html>
  <head>
    <title>Battery Status API Test Suite</title>
    <script src="/resources/testharness.js"></script>
    <link rel="stylesheet" href="/resources/testharness.css" media="all"/>
  </head>
  <body>
    <h1>Description</h1>
    <p>
      <strong>
        This test is only useful on devices that expose the BatteryManager interface,
        but lack a backend implementation.
      </strong>
    </p>
    <p>
      This test validates that all of the navigator.battery attributes exist and are set to their default values.
    </p>
    <h2>Preconditions</h2>
    <ol>
      <li>
        The implementation is unable to report the battery's charging state,
        charging time, level or remaining time respectively.
      </li>
      <li>
        The device is unplugged from the charger before this test case is run.
      </li>
    </ol>
    <div id="log"></div>
    <script>
    (function() {
      test(function() {
        var b = navigator.battery;
        assert_true(b.charging === true, 'charging must be set to true');
        assert_true(b.chargingTime === 0, 'chargingTime must be set to 0');
        assert_true(b.level === 1.0, 'level must be set to 1.0');
        assert_true(b.dischargingTime === Infinity, 'dischargingTime must be set to Infinity');

      }, 'When a BatteryManager object is created, charging must be set to true, ' +
      'chargingTime to 0, level to 1.0 and dischargingTime to the value positive ' +
      'Infinity, if the implementation is unable to report the battery\'s charging ' +
      'state, charging time, level or remaining time respectively.');
      })();
    </script>
  </body>
</html>
back to top