Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18327] Windows: Ti.UI.createXX should return an Object, not a Function

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-01-30T00:24:23.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsWindows
Labelsn/a
ReporterKota Iguchi
AssigneeIngo Muschenetz
Created2015-01-06T20:59:54.000+0000
Updated2017-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());
}

Comments

  1. Kota Iguchi 2015-01-20

    This is a issue on HAL and fixed in latest master. needs to be integrated into titanium_mobile_windows.
  2. Kota Iguchi 2015-01-30

    Fixed for now.
  3. Lee Morris 2017-03-21

    Closing ticket as fixed.

JSON Source