-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TIMOB-26167] Android: Fixed TextField/TextArea focus/blur handling. (#…
…10149) - Fixed bug where TextField/TextArea cannot be edited while in a ScrollView. (Introduced in 7.3.0.) - Fixed [TIMOB-26172] where a view's "focus" and "blur" events should not bubble to parent views, like iOS. - TextField/TextArea and other focusable views no longer receive focus by default when opening a window, like iOS. * Resolves tickets [TIMOB-8637], [TIMOB-24138], and [TIMOB-25819].
- Loading branch information
1 parent
880d8eb
commit 6c7918a
Showing
4 changed files
with
81 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
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,63 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* global Ti, Titanium */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
var should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.UI.TextField', function () { | ||
var win; | ||
|
||
afterEach(function () { | ||
if (win) { | ||
win.close(); | ||
} | ||
win = null; | ||
}); | ||
|
||
// TextField must not receive focus by default upon opening a window. | ||
it('focus-win-open', function (finish) { | ||
var textField; | ||
this.timeout(5000); | ||
|
||
win = Ti.UI.createWindow(); | ||
textField = Ti.UI.createTextField(); | ||
textField.addEventListener('focus', function () { | ||
// This should never happen. | ||
finish(new Error('TextField wrongly received focus on open.')); | ||
}); | ||
win.add(textField); | ||
win.addEventListener('postlayout', function () { | ||
// If we made it this far, assume TextField did not receive focus. | ||
finish(); | ||
}); | ||
win.open(); | ||
}); | ||
|
||
// The "focus" and "blur" events are not supposed to bubble up the view hierarchy. | ||
it('focus-blur-bubbles', function (finish) { | ||
var textField; | ||
this.timeout(5000); | ||
|
||
win = Ti.UI.createWindow(); | ||
textField = Ti.UI.createTextField(); | ||
textField.addEventListener('focus', function (e) { | ||
should(e.bubbles).be.eql(false); | ||
textField.blur(); | ||
}); | ||
textField.addEventListener('blur', function (e) { | ||
should(e.bubbles).be.eql(false); | ||
finish(); | ||
}); | ||
win.add(textField); | ||
win.addEventListener('open', function () { | ||
textField.focus(); | ||
}); | ||
win.open(); | ||
}); | ||
}); |