blob: 0d1ecc7392a95060a0620d3092a4df89a6af082d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src='../../../resources/testharness.js'></script>
<script src='../../../resources/testharnessreport.js'></script>
<script src='../../../fast/forms/resources/picker-common.js'></script>
</head>
<body>
<input type='color' id='color' value='#80d9ff'>
<script>
'use strict';
let t = async_test('Color picker: Tabbing into a color value container should not insert a tab character.');
t.step(() => {
let colorControl = document.getElementById('color');
openPicker(colorControl, t.step_func_done(() => {
popupWindow.focus();
const popupDocument = popupWindow.document;
const rValueContainer = popupDocument.getElementById('rValueContainer');
const gValueContainer = popupDocument.getElementById('gValueContainer');
const bValueContainer = popupDocument.getElementById('bValueContainer');
assert_equals(rValueContainer.value, '128');
assert_equals(gValueContainer.value, '217');
assert_equals(bValueContainer.value, '255');
const hueSliderSelectionRing = popupDocument.querySelector('hue-slider > color-selection-ring');
hueSliderSelectionRing.focus();
[rValueContainer, gValueContainer, bValueContainer].forEach(container => {
container.addEventListener('keypress', t.step_func(event => {
assert_not_equals(event.key, 'Tab',
'If tab key suppression was successful, there should be no keypress event for it.');
}));
});
assert_equals(popupDocument.activeElement, hueSliderSelectionRing);
eventSender.keyDown('Tab');
assert_equals(popupDocument.activeElement, rValueContainer, 'rValueContainer should be the active element');
assert_equals(rValueContainer.value, '128', 'rValueContainer\'s value should not have changed');
eventSender.keyDown('Tab');
assert_equals(popupDocument.activeElement, gValueContainer, 'gValueContainer should be the active element');
assert_equals(gValueContainer.value, '217', 'gValueContainer\'s value should not have changed');
eventSender.keyDown('Tab');
assert_equals(popupDocument.activeElement, bValueContainer, 'bValueContainer should be the active element');
assert_equals(bValueContainer.value, '255', 'bValueContainer\'s value should not have changed');
}));
});
</script>
</body>
</html>