[TIMOB-11117] iOS: TabGroup - TabGroup has undefined value
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-11-02T12:30:46.000+0000 |
Affected Version/s | Release 2.1.3, Release 3.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | qe-ios090112 |
Reporter | Tamila Smolich |
Assignee | Hans Knöchel |
Created | 2012-09-25T19:22:36.000+0000 |
Updated | 2017-03-24T17:59:56.000+0000 |
Description
Description:
TabGroup has undefined value.
Console info:
[INFO] -------------> tab1 focus event fired! - Tab 1
[INFO] -------------> tabGroup focus event fired! - undefined
[INFO] -------------> win1 focus event fired! - win 1
[INFO] **************> win1 blur event fired! - win 1
[INFO] **************> tab1 blur event fired! - Tab 1
[INFO] -------------> tabGroup focus event fired! - undefined
[INFO] -------------> tab2 focus event fired! - Tab 2
[INFO] -------------> win2 focus event fired! - win 2
[INFO] **************> win2 blur event fired! - win 2
[INFO] **************> tab2 blur event fired! - Tab 2
This is not a regression, occurs on 2.1.2 and 2.1.1 as well.
Steps to reproduce:
1. Run the following code and check the console:
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
name: "win 1"
});
var tab1 = Ti.UI.createTab({
name: "Tab 1",
title:'Tab 1',
window:win1
});
var win2 = Ti.UI.createWindow({
name: "win 2",
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Ti.UI.createTab({
name: "Tab 2",
title:'Tab 2',
window:win2
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addEventListener('focus', function(e){
Ti.API.info('-------------> tabGroup focus event fired! - ' + e.source.name);
});
tab1.addEventListener('focus', function(e){
Ti.API.info('-------------> tab1 focus event fired! - ' + e.source.name);
});
tab2.addEventListener('focus', function(e){
Ti.API.info('-------------> tab2 focus event fired! - ' + e.source.name);
});
win1.addEventListener('focus', function(e){
Ti.API.info('-------------> win1 focus event fired! - ' + e.source.name);
});
win2.addEventListener('focus', function(e){
Ti.API.info('-------------> win2 focus event fired! - ' + e.source.name);
});
tab1.addEventListener('blur', function(e){
Ti.API.info('**************> tab1 blur event fired! - ' + e.source.name);
});
tab2.addEventListener('blur', function(e){
Ti.API.info('**************> tab2 blur event fired! - ' + e.source.name);
});
win1.addEventListener('blur', function(e){
Ti.API.info('**************> win1 blur event fired! - ' + e.source.name);
});
win2.addEventListener('blur', function(e){
Ti.API.info('**************> win2 blur event fired! - ' + e.source.name);
});
tabGroup.open();
2. Interchangeably press the two tabs
Expected result:
All values should be defined
Actual result:
TabGroup has undefined value
Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
Hi, Got through the bug as I was executing TabGroup related test Cases. I think according to the code the tab group behavior(giving value as undefined) is correct. Since there is no custom property named "name" is assigned for tab group. Hence the value retrieved for it gives undefined. And on modifying the code:
Above code works fine as per expectations. Please let me know if anything wrong else bug can be updated. Tested Environment: Appcelerator Studio: 3.2.0.201311200357 SDK:3.2.0.v20131119142443 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0-alpha titanium-code-processor: 1.1.0-alpha Xcode:5.0.2 OS: Mac OSX 10.9 Device: iphone5S(V7.0.2)
As [~pagarwal] noted correctly, the "name" property was not set and therefore undefined in the log. Using the following (simplified) test-case, it works as expected:
Closing ticket as invalid with reference to the above comments.