Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix #1085 checkbox init in MAC dropdown #1085

Closed
wants to merge 1 commit into from

2 participants

@lsimone
Collaborator

checkboxes related to selected options are not ticked when the widget is initialised.

@lsimone lsimone changed the title from fix # checkbox init in MAC dropdown to fix #1085 checkbox init in MAC dropdown
@lsimone lsimone referenced this pull request from a commit in lsimone/ariatemplates
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
758f2ad
@jakub-g jakub-g added this to the 1.5.2 milestone
@jakub-g jakub-g self-assigned this
@jakub-g
Collaborator

758f2ad looks good to me

@lsimone lsimone referenced this pull request from a commit in lsimone/ariatemplates
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
f1fb55f
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
21668c9
@lsimone lsimone closed this pull request from a commit
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
21668c9
@lsimone lsimone closed this in 21668c9
@lsimone lsimone referenced this pull request from a commit in lsimone/ariatemplates
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
2567440
@lsimone lsimone referenced this pull request from a commit
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
8dcc36a
@flongo flongo referenced this pull request from a commit in flongo/ariatemplates
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
aa13361
@flongo flongo referenced this pull request from a commit in flongo/ariatemplates
@lsimone lsimone fix #1085 checkbox init in MAC dropdown
checkboxes related to selected options are not ticked when the widget is initialised.
d26f8d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2014
  1. @lsimone

    fix #1085 checkbox init in MAC dropdown

    lsimone authored
    checkboxes related to selected options are not ticked when the widget is initialised.
This page is out of date. Refresh to see the latest.
View
9 src/aria/widgets/controllers/MultiAutoCompleteController.js
@@ -353,7 +353,14 @@
jsonUtils.setValue(dataModel, 'selectedValues', selectedValues);
dataModel.value = selectedValues;
} else if (allSuggestions) {
- jsonUtils.setValue(dataModel, 'selectedValues', this.selectedSuggestions);
+ var selectedValues = [];
+ for (var i = 0; i < dataModel.listContent.length; i++) {
+ var index = this._findSuggestion(this.selectedSuggestions, dataModel.listContent[i].value);
+ if (index != -1) {
+ selectedValues.push(dataModel.listContent[i].value);
+ }
+ }
+ jsonUtils.setValue(dataModel, 'selectedValues', selectedValues);
jsonUtils.setValue(dataModel, 'multipleSelect', true);
dataModel.value = null;
} else {
View
1  test/aria/widgets/form/multiautocomplete/MultiAutoCompleteTestSuite.js
@@ -46,5 +46,6 @@ Aria.classDefinition({
this.addTests("test.aria.widgets.form.multiautocomplete.testDataModelOnEdit.MultiAutoDataModelTest");
this.addTests("test.aria.widgets.form.multiautocomplete.issue1076.blur.OnBlurTest");
this.addTests("test.aria.widgets.form.multiautocomplete.issue1076.focus.OnFocusTest");
+ this.addTests("test.aria.widgets.form.multiautocomplete.issue1085.InitCheckboxesTest");
}
});
View
71 test/aria/widgets/form/multiautocomplete/issue1085/InitCheckboxesTest.js
@@ -0,0 +1,71 @@
+/*
+ * 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.autocomplete.multiautocomplete.issue1085.InitCheckboxesTest",
+ $extends : "test.aria.widgets.form.autocomplete.multiautocomplete.BaseMultiAutoCompleteTestCase",
+ $constructor : function () {
+ this.$BaseMultiAutoCompleteTestCase.constructor.call(this);
+
+ this.data.expandButton = true;
+ this.checkedValues = ["P8.amino", "P6.ipsum"];
+ this.data.ac_airline_values = [{
+ label : "P8.amino",
+ value : "test"
+ }, {
+ label : "P6.ipsum",
+ value : "tt"
+ }];
+
+ },
+ $prototype : {
+
+ _waitAndExecute : function (fn, scope) {
+ aria.core.Timer.addCallback({
+ fn : fn,
+ scope : scope,
+ delay : 300
+ });
+ },
+
+ runTemplateTest : function () {
+ this.clickAndType(["[down]"], {
+ fn : this._wait1,
+ scope : this
+ }, 1);
+ },
+
+ _wait1 : function () {
+ this.waitFor({
+ condition : function () {
+ return this.getElementsByClassName(Aria.$window.document.body, "xWidget xICNcheckBoxes").length !== 0;
+ },
+ callback : this._verifyCheckboxValues
+ });
+ },
+
+ _verifyCheckboxValues : function () {
+ var checkboxList = this.getElementsByClassName(Aria.$window.document.body, "xWidget xICNcheckBoxes");
+ for (var i = 0, l = checkboxList.length; i < l; i++) {
+ var item = checkboxList[i].parentNode;
+ var input = item.getElementsByTagName("input")[0];
+ var label = item.getElementsByTagName("label")[0].innerHTML;
+ this.assertEquals("" + aria.utils.Array.contains(this.checkedValues, label), input.value, "The checkbox is %2 while it should be %1 instead.");
+ }
+ this.end();
+ }
+
+ }
+});
Something went wrong with that request. Please try again.