forked from ariatemplates/ariatemplates
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix ariatemplates#1530 MultiSelect does not prevent default action wi…
…th arrow down key This commit makes sure the default action when pressing the arrow down key (usually: scrolling the document) is prevented when the focus is inside the aria:MultiSelect widget. AT-1162 PTR 10390760
- Loading branch information
Showing
7 changed files
with
141 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
test/aria/widgets/form/multiselect/downArrowKeyPreventDef/MSDownArrowKey.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2013 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
Aria.classDefinition({ | ||
$classpath : "test.aria.widgets.form.multiselect.downArrowKeyPreventDef.MSDownArrowKey", | ||
$extends : "aria.jsunit.RobotTestCase", | ||
$dependencies : ["aria.utils.Dom"], | ||
$prototype : { | ||
runTemplateTest : function () { | ||
var self = this; | ||
var scrollableItem = aria.utils.Dom.getDocumentScrollElement(); | ||
|
||
function step1() { | ||
self.testDiv.style.position = "absolute"; | ||
scrollableItem.scrollTop = 3000; | ||
var happyMS = self.getInputField("happyMS"); | ||
self.synEvent.execute([["click", happyMS], ["waitFocus", happyMS], ["type", null, "[down]"]], step2); | ||
} | ||
|
||
function step2() { | ||
self.assertEquals(scrollableItem.scrollTop, 3000); | ||
self.waitFor({ | ||
condition: function () { | ||
return !!self.getWidgetDropDownPopup("happyMS"); | ||
}, | ||
callback: step3 | ||
}); | ||
} | ||
|
||
function step3() { | ||
self.synEvent.execute([["type", null, " [up]"]], step4); | ||
} | ||
|
||
function step4() { | ||
self.assertEquals(scrollableItem.scrollTop, 3000); | ||
var happyMS = self.getInputField("happyMS"); | ||
self.synEvent.execute([["click", happyMS], ["waitFocus", happyMS], ["type", null, "[down][down]"]], step5); | ||
} | ||
|
||
function step5() { | ||
self.assertEquals(scrollableItem.scrollTop, 3000); | ||
self.waitFor({ | ||
condition: function () { | ||
return !!self.getWidgetDropDownPopup("happyMS"); | ||
}, | ||
callback: step6 | ||
}); | ||
} | ||
|
||
function step6() { | ||
self.synEvent.execute([["type", null, " [up][up]"]], step7); | ||
} | ||
|
||
function step7() { | ||
self.assertEquals(scrollableItem.scrollTop, 3000); | ||
self.end(); | ||
} | ||
|
||
step1(); | ||
} | ||
} | ||
}); |
55 changes: 55 additions & 0 deletions
55
test/aria/widgets/form/multiselect/downArrowKeyPreventDef/MSDownArrowKeyTpl.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2015 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
{Template { | ||
$classpath:"test.aria.widgets.form.multiselect.downArrowKeyPreventDef.MSDownArrowKeyTpl", | ||
$hasScript:false | ||
}} | ||
|
||
{macro main()} | ||
<div style="height:3000px;"></div> | ||
<h1>This test needs focus</h1> | ||
{@aria:MultiSelect { | ||
id :"happyMS", | ||
label : "What do you need to be happy?", | ||
labelWidth : 200, | ||
width: 650, | ||
numberOfRows:4, | ||
displayOptions : { | ||
listDisplay : "label" | ||
}, | ||
items : [ | ||
{label : "God", value : "God"}, | ||
{label : "Love", value : "Love"}, | ||
{label : "Forgiveness", value : "Forgiveness"}, | ||
{label : "Hope", value : "Hope"}, | ||
{label : "A spouse", value : "spouse"}, | ||
{label : "Good friends", value : "goodfriends"}, | ||
{label : "Food", value : "Food"}, | ||
{label : "Clothing", value : "Clothing"}, | ||
{label : "Shelter", value : "Shelter"}, | ||
{label : "A good job", value : "goodjob"}, | ||
{label : "A car", value : "car"}, | ||
{label : "A good computer", value : "goodcomputer"}, | ||
{label : "A smartphone", value: "smartphone"}, | ||
{label : "JavaScript", value : "Javascript"}, | ||
{label : "A good browser", value: "goodbrowser"}, | ||
{label : "Aria Templates", value : "ariatemplates"} | ||
] | ||
}/} | ||
<div style="height:3000px;"></div> | ||
{/macro} | ||
|
||
{/Template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters