<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script>
SimpleTest.waitForExplicitFinish();

function runTest() {
  let MockColorPicker = SpecialPowers.MockColorPicker;

  MockColorPicker.init(window);

  MockColorPicker.showCallback = (picker) => {
    is(picker.defaultColors.length, 2);
    is(picker.defaultColors[0], "#112233");
    is(picker.defaultColors[1], "#00ffaa");

    MockColorPicker.cleanup();
    SimpleTest.finish();
  }

  let input = document.querySelector("input");
  synthesizeMouseAtCenter(input, {});
}

SimpleTest.waitForFocus(runTest);
</script>
</head>
<body>
<input type="color" list="color-list">
<datalist id="color-list">
  <option value="#112233"></option>
  <option value="black"></option> <!-- invalid -->
  <option value="#000000" disabled></option>
  <option value="#00FFAA"></option>
  <option></option>
</datalist>
</body>
</html>
