Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Possibility to call $focus on HTML Text Input - fixes and tests #268

Closed
wants to merge 1 commit into from

2 participants

@flongo
Collaborator

Related to PR #267.

@piuccio piuccio referenced this pull request from a commit
@flongo flongo feat #268 - Possibility to call $focus on HTML Text Input - fixes and…
… tests

Related to PR #267.
697c744
@piuccio

Integrated with 697c744

@piuccio piuccio closed this
@flongo flongo referenced this pull request from a commit in flongo/ariatemplates
@flongo flongo feat #268 Fix for test.aria.html.ElementTest b3eccd7
@susant123 susant123 referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@piuccio piuccio referenced this pull request from a commit
@flongo flongo feat #268 - Possibility to call $focus on HTML Text Input - fixes and…
… tests

Related to PR #267.
(cherry picked from commit 697c744)

Conflicts:
	test/aria/html/HTMLTestSuite.js
	test/aria/html/textinput/TextInputBindTest.js
	test/aria/html/textinput/TextInputOnTypeTest.js
	test/aria/html/textinput/TextInputPasswordTest.js
	test/aria/html/textinput/TextInputTest.js
cad007d
@piuccio piuccio referenced this pull request from a commit
@flongo flongo feat #268 Fix for test.aria.html.ElementTest
(cherry picked from commit ccb2b29)
b6b32fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 10, 2012
  1. @flongo
This page is out of date. Refresh to see the latest.
View
8 src/aria/html/Element.js
@@ -61,16 +61,14 @@
return makeUseless(this);
}
+ var id = cfg.id;
+
/**
* Id of the DOM element of this widget.
* @type String
* @protected
*/
- this._id = this._createDynamicId();
-
- if (cfg.id) {
- this._id = this._id + "_" + cfg.id;
- }
+ this._id = id ? this._context.$getId(id) : this._createDynamicId();
/**
* Reference of the DOM element with id this._id.
View
11 src/aria/html/TextInput.js
@@ -102,20 +102,12 @@
this._registerBlur(cfg.on, context);
- /**
- * Element containing input field
- * @protected
- * @type HTMLElement
- */
- this._inputText = null;
-
this.$Element.constructor.call(this, cfg, context, line);
},
$destructor : function () {
if (this._typeCallback) {
aria.core.Timer.cancelCallback(this._typeCallback);
}
- this._inputText = null;
this.$Element.$destructor.call(this);
},
$prototype : {
@@ -147,7 +139,6 @@
this._domElt.value = newValue;
}
}
- this._inputText = aria.utils.Dom.getElementById(this._id);
},
/**
@@ -174,7 +165,7 @@
* Function to assign the focus to input field.
*/
focus : function () {
- this._inputText.focus();
+ this._domElt.focus();
},
/**
View
7 test/aria/html/ElementTest.js
@@ -75,10 +75,13 @@ Aria.classDefinition({
cfg.id = 'x';
widget = new aria.html.Element(cfg, {
- tplClasspath : "Element"
+ tplClasspath : "Element",
+ $getId : function (id) {
+ return "tpl0_" + id;
+ }
});
- this.assertEquals(widget._id, "w0_x", "The id is not the id expected");
+ this.assertEquals(widget._id, "tpl0_x", "The id is not the id expected");
widget.$dispose();
delete cfg.id;
View
6 test/aria/html/HTMLTestSuite.js
@@ -20,13 +20,9 @@ Aria.classDefinition({
this.$TestSuite.constructor.call(this);
this.addTests("test.aria.html.ElementTest");
- this.addTests("test.aria.html.TextInputTest");
this.addTests("test.aria.html.ElementBindingsTest");
this.addTests("test.aria.html.ElementEventsTest");
- this.addTests("test.aria.html.TextInputBindTest");
- this.addTests("test.aria.html.TextInputOnTypeTest");
- this.addTests("test.aria.html.TextInputPasswordTest");
this.addTests("test.aria.html.controllers.suggestions.ResourcesHandlerTest");
-
+ this.addTests("test.aria.html.textinput.TextInputTestSuite");
}
});
View
2  test/aria/html/TextInputBindTest.js → test/aria/html/textinput/TextInputBindTest.js
@@ -14,7 +14,7 @@
*/
Aria.classDefinition({
- $classpath : "test.aria.html.TextInputBindTest",
+ $classpath : "test.aria.html.textinput.TextInputBindTest",
$extends : "aria.jsunit.TestCase",
$dependencies : ["aria.html.TextInput", "aria.utils.json"],
$prototype : {
View
2  test/aria/html/TextInputOnTypeTest.js → test/aria/html/textinput/TextInputOnTypeTest.js
@@ -14,7 +14,7 @@
*/
Aria.classDefinition({
- $classpath : "test.aria.html.TextInputOnTypeTest",
+ $classpath : "test.aria.html.textinput.TextInputOnTypeTest",
$extends : "aria.jsunit.TestCase",
$dependencies : ["aria.html.TextInput", "aria.utils.FireDomEvent"],
$prototype : {
View
2  test/aria/html/TextInputPasswordTest.js → test/aria/html/textinput/TextInputPasswordTest.js
@@ -14,7 +14,7 @@
*/
Aria.classDefinition({
- $classpath : "test.aria.html.TextInputPasswordTest",
+ $classpath : "test.aria.html.textinput.TextInputPasswordTest",
$extends : "aria.jsunit.TestCase",
$dependencies : ["aria.html.TextInput"],
$prototype : {
View
2  test/aria/html/TextInputTest.js → test/aria/html/textinput/TextInputTest.js
@@ -14,7 +14,7 @@
*/
Aria.classDefinition({
- $classpath : "test.aria.html.TextInputTest",
+ $classpath : "test.aria.html.textinput.TextInputTest",
$extends : "aria.jsunit.TestCase",
$dependencies : ["aria.html.TextInput"],
$prototype : {
View
28 test/aria/html/textinput/TextInputTestSuite.js
@@ -0,0 +1,28 @@
+/*
+ * 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.html.textinput.TextInputTestSuite",
+ $extends : "aria.jsunit.TestSuite",
+ $constructor : function () {
+ this.$TestSuite.constructor.call(this);
+
+ this.addTests("test.aria.html.textinput.TextInputTest");
+ this.addTests("test.aria.html.textinput.TextInputBindTest");
+ this.addTests("test.aria.html.textinput.TextInputOnTypeTest");
+ this.addTests("test.aria.html.textinput.TextInputPasswordTest");
+ this.addTests("test.aria.html.textinput.focus.FocusTestCase");
+ }
+});
View
39 test/aria/html/textinput/focus/FocusTestCase.js
@@ -0,0 +1,39 @@
+/*
+ * 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.html.textinput.focus.FocusTestCase",
+ $extends : "aria.jsunit.TemplateTestCase",
+ $dependencies : ["aria.utils.Dom"],
+ $prototype : {
+ runTemplateTest : function () {
+ this.templateCtxt.$focus("focusable");
+ aria.core.Timer.addCallback({
+ fn : this._afterFocus,
+ scope : this,
+ delay : 100
+ });
+ },
+
+ _afterFocus : function (_, element) {
+ var element = Aria.$window.document.getElementsByTagName("input")[0];
+
+ var active = Aria.$window.document.activeElement;
+ this.assertTrue(element.id == active.id, "$focus method failed.");
+
+ this.end();
+ }
+ }
+})
View
35 test/aria/html/textinput/focus/FocusTestCaseTpl.tpl
@@ -0,0 +1,35 @@
+/*
+ * 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.html.textinput.focus.FocusTestCaseTpl",
+ $wlibs : {
+ html : "aria.html.HtmlLibrary"
+ }
+}}
+
+ {macro main()}
+
+ <div>
+
+ {@html:TextInput {
+ id: "focusable"
+ }/}
+
+ </div>
+
+ {/macro}
+
+{/Template}
Something went wrong with that request. Please try again.