Bug 1272012 - Tweak or disable a few tests for <select size=1> Up/Down key behavior on OSX.

This commit is contained in:
Mats Palmgren 2016-05-25 10:48:52 +02:00
parent 2b1544d87c
commit b8472acaf5
8 changed files with 57 additions and 30 deletions

View File

@ -50,8 +50,9 @@ skip-if = os == 'win' || os == 'linux'
[test_scroll.xul]
[test_scroll_caret.xul]
[test_selection.html]
skip-if = buildapp == 'mulet'
skip-if = buildapp == 'mulet' || os == 'mac'
[test_selection.xul]
skip-if = os == 'mac'
[test_selection_aria.html]
[test_statechange.html]
[test_text.html]
@ -60,3 +61,4 @@ skip-if = buildapp == 'mulet'
[test_textselchange.html]
[test_tree.xul]
[test_valuechange.html]
skip-if = os == 'mac'

View File

@ -87,7 +87,7 @@ skip-if = buildapp == 'mulet'
[test_restore_form_elements.html]
[test_save_restore_radio_groups.html]
[test_select_change_event.html]
skip-if = android_version == '18'
skip-if = android_version == '18' || os == 'mac'
[test_select_selectedOptions.html]
[test_select_validation.html]
[test_set_range_text.html]

View File

@ -73,13 +73,21 @@ select.addEventListener("change", function(aEvent) {
select.addEventListener("keyup", function() {
select.removeEventListener("keyup", arguments.callee, false);
select.blur();
if (navigator.platform.indexOf("Mac") == -1) {
select.blur(); // trigger the change
}
}, false);
select.addEventListener("focus", function() {
select.removeEventListener("focus", arguments.callee, false);
SimpleTest.executeSoon(function () {
synthesizeKey("VK_DOWN", {});
if (navigator.platform.indexOf("Mac") == 0) {
synthesizeKey("VK_DOWN", {}); // open the dropdown menu
synthesizeKey("VK_DOWN", {}); // select next option
synthesizeKey("VK_RETURN", {}); // trigger the change, close the menu
} else {
synthesizeKey("VK_DOWN", {}); // select next option (w. closed menu)
}
});
}, false);

View File

@ -10,7 +10,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 947789
[test_bug345267.html]
[test_bug346043.html]
[test_bug348236.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(select form control popup) b2g-debug(select form control popup) b2g-desktop(select form control popup)
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s || os == 'mac' # b2g(select form control popup) b2g-debug(select form control popup) b2g-desktop(select form control popup) mac(select form control popup behavior is different)
[test_bug353539.html]
[test_bug365410.html]
[test_bug378670.html]

View File

@ -91,20 +91,24 @@ SimpleTest.waitForFocus(function() {
setTimeout(function(){sel[2].focus()},0);
}, false);
sel[2].addEventListener('focus', function() {
s = sel[2];
s.removeEventListener('focus', arguments.callee, false);
synthesizeKey('VK_DOWN', {});
is(s.selectedIndex,1, s.id + ": initial DOWN selects 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
is(s.selectedIndex,2, s.id + ": 3rd option is selected");
ok(!s[1].selected,s.id + ": CTRL+DOWN deselected 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is selected");
ok(!s[2].selected,s.id + ": CTRL+SHIFT+DOWN deselected 3rd option");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
if (navigator.platform.indexOf("Mac") == -1) {
s = sel[2];
s.removeEventListener('focus', arguments.callee, false);
synthesizeKey('VK_DOWN', {});
is(s.selectedIndex,1, s.id + ": initial DOWN selects 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
is(s.selectedIndex,2, s.id + ": 3rd option is selected");
ok(!s[1].selected,s.id + ": CTRL+DOWN deselected 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is selected");
ok(!s[2].selected,s.id + ": CTRL+SHIFT+DOWN deselected 3rd option");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
} else {
todo(false, "Make this test work on OSX");
}
setTimeout(function(){SimpleTest.finish()},0);
}, false);
sel[0].focus();

View File

@ -271,16 +271,20 @@ function runTests()
[ false, true ].forEach(function (consume) {
doPreventDefault = consume;
for (var i = 0; i < combobox.options.length + 1; i++) {
reset()
synthesizeKey("VK_DOWN", {});
check(true, "DownArrow key on combobox #" + i);
}
if (!kIsMac) {
for (var i = 0; i < combobox.options.length + 1; i++) {
reset()
synthesizeKey("VK_DOWN", {});
check(true, "DownArrow key on combobox #" + i);
}
for (var i = 0; i < combobox.options.length + 1; i++) {
reset()
synthesizeKey("VK_UP", {});
check(true, "UpArrow key on combobox #" + i);
for (var i = 0; i < combobox.options.length + 1; i++) {
reset()
synthesizeKey("VK_UP", {});
check(true, "UpArrow key on combobox #" + i);
}
} else {
todo(false, "Make this test work on OSX");
}
for (var i = 0; i < combobox.options.length + 1; i++) {

View File

@ -49,8 +49,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=961363
select_test("one", one, false);
select_test("two", two_1, true);
select_test("two", two_2, false);
select_test("three", three_1, true);
select_test("three", three_2, false);
if (navigator.platform.indexOf("Mac") == -1) {
select_test("three", three_1, true);
select_test("three", three_2, false);
} else {
todo(false, "Make these tests work on OSX");
}
SimpleTest.finish();
});
}

View File

@ -29,6 +29,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=291082
document.getElementById("keypress").addEventListener("keypress", preventDefault);
SimpleTest.waitForFocus(function() {
if (navigator.platform.indexOf("Mac") == 0) {
todo(false, "Make this test work on OSX");
SimpleTest.finish();
return;
}
var testData = [ "one", "two", "three", "four", "keydown", "keypress" ];
// The order of the keys in otherKeys is important for the test to function properly.