Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

onBlur support added to TextInput

All inheriting widgets also benefit from this feature.
onClick support added to MultiAutoComplete.

Closes #989
  • Loading branch information...
commit 0b6a5cf37516dd5c45dab1669bc4c96cc8962565 1 parent e8fc799
@lsimone lsimone authored benouat committed
View
4 src/aria/widgets/CfgBeans.js
@@ -401,6 +401,10 @@ Aria.beanDefinitions({
$type : "common:Callback",
$description : "Function to be called when the autocomplete receives focus."
},
+ "onblur" : {
+ $type : "common:Callback",
+ $description : "Function to be called when the autocomplete loses focus."
+ },
"spellCheck" : {
$type : "json:Boolean",
$description : "Specifies whether native spell check from the browser is enabled or not on this field. If null, uses the default behaviour from the browser. If true or false, tries to enable or disable native spell check from the browser."
View
1  src/aria/widgets/form/MultiAutoComplete.js
@@ -94,6 +94,7 @@ Aria.classDefinition({
* @protected
*/
_dom_onclick : function (event) {
+ this.$AutoComplete._dom_onclick.call(this, event);
var element = event.target;
if (element.className === "closeBtn") {
this._removeMultiselectValues(element, event);
View
4 src/aria/widgets/form/TextInput.js
@@ -971,7 +971,9 @@ Aria.classDefinition({
// this._hasFocus = false must be after the call of this.getCaretPosition()
this._hasFocus = false;
}
-
+ if (this._cfg.onblur) {
+ this.evalCallback(this._cfg.onblur);
+ }
},
/**
View
1  test/aria/widgets/form/textinput/TextInputTestSuite.js
@@ -20,6 +20,7 @@ Aria.classDefinition({
this.$TestSuite.constructor.call(this);
this._tests = ["test.aria.widgets.form.textinput.onchange.OnChangeTestCase",
+ "test.aria.widgets.form.textinput.onblur.OnBlurTest",
"test.aria.widgets.form.textinput.blurvalidation.BlurValidationTestCase",
"test.aria.widgets.form.textinput.quotes.QuotesTestCase",
"test.aria.widgets.form.textinput.onclick.OnClickTest",
View
86 test/aria/widgets/form/textinput/onblur/OnBlurTemplate.tpl
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+{Template {
+ $classpath : "test.aria.widgets.form.textinput.onblur.OnBlurTemplate",
+ $extends : "test.aria.widgets.form.textinput.onclick.OnClickTemplate"
+}}
+ {macro main()}
+
+ {@aria:TextField {
+ id: "tf",
+ onblur:{fn:onaction},
+ value : "aaa"
+ }/}
+
+ {@aria:NumberField {
+ id: "nf",
+ onblur:{fn:onaction},
+ value : 5
+ }/}
+
+ {@aria:PasswordField {
+ id: "pf",
+ onblur:{fn:onaction},
+ value : "aaa"
+ }/}
+
+ {@aria:DateField {
+ id: "df",
+ onblur:{fn:onaction},
+ value : new Date()
+ }/}
+
+ {@aria:TimeField {
+ id: "time",
+ onblur:{fn:onaction}
+ }/}
+
+ {@aria:DatePicker {
+ id: "dp",
+ onblur:{fn:onaction},
+ value : new Date()
+ }/}
+
+ {@aria:AutoComplete {
+ id: "ac",
+ resourcesHandler: this.airlinesHandler,
+ onblur:{fn:onaction}
+ }/}
+
+ {@aria:MultiSelect {
+ id: "ms",
+ items: [{value : "a", code : "a"},{value : "b", code : "b"}],
+ onblur:{fn:onaction}
+ }/}
+
+ {@aria:SelectBox {
+ id: "sb",
+ options: [{label : "a", value : "a"},{label : "b", value : "b"}],
+ onblur:{fn:onaction}
+ }/}
+
+ {@aria:MultiAutoComplete {
+ id: "mac",
+ resourcesHandler: this.airlinesHandler,
+ onblur:{fn:onaction}
+ }/}
+
+
+
+
+
+ {/macro}
+{/Template}
View
42 test/aria/widgets/form/textinput/onblur/OnBlurTest.js
@@ -0,0 +1,42 @@
+/*
+ * 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.textinput.onblur.OnBlurTest",
+ $extends : "test.aria.widgets.form.textinput.onclick.OnClickTest",
+ $constructor : function () {
+ this.$OnClickTest.constructor.call(this);
+ this.setTestEnv({
+ template : "test.aria.widgets.form.textinput.onblur.OnBlurTemplate",
+ data : {
+ action : 0
+ }
+ });
+ this._delay = 10;
+ },
+ $prototype : {
+ runTemplateTest : function () {
+ this.templateCtxt.$focus(this._widgetIds[0]);
+ this._currentIndex = 0;
+ this._testWidget();
+ },
+
+ simulateUserAction : function (index) {
+ var ix = (index + 1) % this._widgetIds.length;
+ this.templateCtxt.$focus(this._widgetIds[ix]);
+ this.onAfterUserAction();
+ }
+ }
+});
View
6 test/aria/widgets/form/textinput/onclick/OnClickTemplate.tpl
@@ -72,6 +72,12 @@
onclick:{fn:onaction}
}/}
+ {@aria:MultiAutoComplete {
+ id: "mac",
+ resourcesHandler: this.airlinesHandler,
+ onclick:{fn:onaction}
+ }/}
+
View
2  test/aria/widgets/form/textinput/onclick/OnClickTest.js
@@ -26,7 +26,7 @@ Aria.classDefinition({
});
this.defaultTestTimeout = 10000;
this._delay = 200;
- this._widgetIds = ["df", "tf", "nf", "pf", "dp", "ac", "ms", "time", "sb"];
+ this._widgetIds = ["df", "tf", "nf", "pf", "dp", "ac", "ms", "time", "sb", "mac"];
this._currentIndex = null;
},
$prototype : {
View
7 test/aria/widgets/form/textinput/onfocus/OnFocusTemplate.tpl
@@ -72,6 +72,13 @@
onfocus:{fn:onaction}
}/}
+ {@aria:MultiAutoComplete {
+ id: "mac",
+ resourcesHandler: this.airlinesHandler,
+ onfocus:{fn:onaction}
+ }/}
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.