<!DOCTYPE html>
<meta name=fuzzy content="maxDifference=0-3; totalPixels=0-1000">
<script src='../../../resources/testharness.js'></script>
<script src='../../../resources/testharnessreport.js'></script>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src='../../../fast/forms/resources/picker-common.js'></script>
<input type='color' id='color' value='#000000'>
<script>
'use strict';
promise_test(() => {
let colorControl = document.getElementById('color');
return openPicker(colorControl)
.then(() => {
internals.pagePopupWindow.focus();
const popupDocument = internals.pagePopupWindow.document;
const hueSlider = popupDocument.querySelector('hue-slider');
const hueSliderRect = hueSlider.getBoundingClientRect();
eventSender.mouseMoveTo(hueSliderRect.left, hueSliderRect.top);
eventSender.mouseDown();
eventSender.mouseMoveTo(hueSliderRect.left + (hueSliderRect.width / 2), hueSliderRect.top);
eventSender.mouseUp();
assert_equals(colorControl.value, '#000000', 'Hue slider should not have changed value when starting from #000000.');
eventSender.keyDown('Escape');
assert_equals(internals.pagePopupWindow, null, 'Single escape should close popup if hue slider but not color value changed');
});
}, "Color picker: Hue slider change with no color value change doesn't affect escape behavior");
</script>