Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #955 Multiselect - problem in labels with spaces
When labels for multiselect items have trailing spaces, the value in the field is not interpreted correctly. Selected options are not recognized as such, so they get deselected. While writing a test case, another small issue in the widget width computation has been spotted and fixed.
- Loading branch information
Showing
5 changed files
with
100 additions
and
9 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
54 changes: 54 additions & 0 deletions
54
test/aria/widgets/form/multiselect/labelsToTrim/LabelsToTrim.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,54 @@ | ||
/* | ||
* Copyright 2012 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.labelsToTrim.LabelsToTrim", | ||
$extends : "aria.jsunit.TemplateTestCase", | ||
$dependencies : ["aria.utils.Json"], | ||
$constructor : function () { | ||
this.$TemplateTestCase.constructor.call(this); | ||
this.data = { | ||
value : ["D", "B", "V"], | ||
options : [{ | ||
value : "D", | ||
label : "Donizetti " | ||
}, { | ||
value : "B", | ||
label : "Bellini " | ||
}, { | ||
value : "V", | ||
label : " Verdi " | ||
}], | ||
popup : false | ||
}; | ||
this.setTestEnv({ | ||
data : this.data | ||
}); | ||
}, | ||
$prototype : { | ||
runTemplateTest : function () { | ||
aria.utils.Json.setValue(this.data, "popup", true); | ||
aria.core.Timer.addCallback({ | ||
fn : this._afterPopupOpen, | ||
scope : this | ||
}); | ||
}, | ||
|
||
_afterPopupOpen : function () { | ||
this.assertJsonEquals(this.data.value, ["D", "B", "V"]); | ||
this.end(); | ||
} | ||
} | ||
}); |
37 changes: 37 additions & 0 deletions
37
test/aria/widgets/form/multiselect/labelsToTrim/LabelsToTrimTpl.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,37 @@ | ||
/* | ||
* Copyright 2012 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.labelsToTrim.LabelsToTrimTpl" | ||
}} | ||
|
||
{macro main()} | ||
{@aria:MultiSelect { | ||
id : "testms", | ||
items : data.options, | ||
bind : { | ||
value : { | ||
to : "value", | ||
inside : data | ||
}, | ||
popupOpen : { | ||
to : "popup", | ||
inside : data | ||
} | ||
} | ||
}/} | ||
{/macro} | ||
|
||
{/Template} |