[TIMOB-18327] Windows: Ti.UI.createXX should return an Object, not a Function
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-01-30T00:24:23.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Windows |
| Labels | n/a |
| Reporter | Kota Iguchi |
| Assignee | Ingo Muschenetz |
| Created | 2015-01-06T20:59:54.000+0000 |
| Updated | 2017-03-21T19:01:36.000+0000 |
Description
Noticed that
Ti.UI.createXXX function returns JS Function. Shouldn't it return JS Object because API doc says "Creates and returns an *instance of* XX"? It prevents from writing a unit test against object like should(view).be.an.Object;.
How to reproduce:
try {
var should = require('should');
var view = Ti.UI.createView();
Ti.API.info(typeof view); // <-- This prints "function"
should(view).be.an.Object; // <-- This throws assertion error because view is not an object
} catch (E) {
Ti.API.info(E.toString());
}
This is a issue on HAL and fixed in latest master. needs to be integrated into titanium_mobile_windows.
Fixed for now.
Closing ticket as fixed.