Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1146] Picker values are not correctly returned using Dynamic Styles

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-09-26T20:22:24.000+0000
Affected Version/sAlloy 1.5.0
Fix Version/sAlloy 1.5.0
Componentsn/a
Labelsqe-3.4.0, qe-manualtest, regression
ReporterFederico Casali
AssigneeTim Poulsen
Created2014-09-23T00:48:47.000+0000
Updated2014-11-20T22:16:06.000+0000

Description

Problem description

Using Dynamic Styles classes, some properties of Picker objects are not returned correctly. It might be related to the fix introduced for ALOY-1051 (and eventually in PR501 for ALOY-1144), as is not reproducible using Alloy 1.4.1 and 1.5.0-rc3, but is reproducible using Alloy versions 1.5.0-rc4 and 1.5.0-rc (or 1.5.0-dev).

Steps to reproduce

1. Run the attached sample code 2. Click on the 'Hello World' label and check console log Result:
Ti.API.info(JSON.stringify($.createStyle({
		classes:['test', "pickerClass"]
	})));
should return:
{"type":1,"minDate":"2012-01-01T00:00:00.000Z","maxDate":"2014-05-01T19:00:00.000Z","value":"2014-04-15T19:00:00.000Z","classes":["test","pickerClass"]}
(and that is what is being returned using 1.4.1 and 1.5.0-rc3) instead, using Alloy 1.5.0-rc or 1.5.0-rc4, it returns:
{"type":1,"minDate":{},"maxDate":{},"value":{},"classes":["test","pickerClass"]}

Attachments

FileDateSize
PickerProperties_dynamicStyles.zip2014-09-23T00:48:47.000+000010393171

Comments

  1. Fokke Zandbergen 2014-09-23

    ..
  2. Tim Poulsen 2014-09-23

    With RC4 the alert/info statements show: * the properly merged properties for the dynamic style based on the family & size classes * incompletely merged properties for the dynamic style based on the test & pickerClass classes * the properly merged properties for the dynamic style based on the test2 & viewClass classes
       [INFO]  {"font":{"fontFamily":"AmericanTypewriter","fontSize":50},"duration":1000,"classes":["family","size"]}
       [INFO]  {"type":1,"minDate":{},"maxDate":{},"value":{},"classes":["test","pickerClass"]}
       [INFO]  {"type":1,"id":"pickerTest","value":"2014-04-15T16:00:00.000Z","horizontalWrap":true,"minDate":"2012-01-01T00:00:00.000Z","columns":[],"maxDate":"2014-05-01T16:00:00.000Z"}
       [INFO]  {"backgroundColor":"blue","width":"90%","height":50,"bottom":0,"pippo":"tanto pippo test, 22343","classes":["test2","viewClass"]}
       
    With RC3, the alert/info statements show: * incompletely merged properties for the dynamic style based on the family & size classes * the properly merged properties for the dynamic style based on the test & pickerClass classes * the properly merged properties for the dynamic style based on the test2 & viewClass classes
       [INFO]  {"font":{"fontSize":50},"duration":1000,"classes":["family","size"]}
       [INFO]  {"type":1,"minDate":"2012-01-01T00:00:00.000Z","maxDate":"2014-05-01T16:00:00.000Z","value":"2014-04-15T16:00:00.000Z","classes":["test","pickerClass"]}
       [INFO]  {"type":1,"id":"pickerTest","value":"2014-04-15T16:00:00.000Z","horizontalWrap":true,"minDate":"2012-01-01T00:00:00.000Z","columns":[],"maxDate":"2014-05-01T16:00:00.000Z"}
       [INFO]  {"backgroundColor":"blue","width":"90%","height":50,"bottom":0,"pippo":"tanto pippo test, 22343","classes":["test2","viewClass"]}
       
    The pickerClass class would generate JavaScript Date objects, which would be evaluated when the info/alert methods are run. The JSON.stringify() method returns null for objects with methods, which would include those Date objects. This is most likely the reason for the different output.
  3. Fokke Zandbergen 2014-09-23

    I think there *is* an issue with Date objects, which can be fixed by:
       ..
               if (_.isDate(copy)) {
                 clone = new Date(copy.valueOf());
       
               // Recurse if we're merging plain objects or arrays
               } else if (deep && copy && ((_.isObject(copy) && typeof copy.apiName !== 'string') || (copy_is_array = _.isArray(copy)))) {
       ..
       
  4. Fokke Zandbergen 2014-09-23

    Which can be fixed by my comment above yours.
  5. Tim Poulsen 2014-09-23

    PRs: 1_5_X -- https://github.com/appcelerator/alloy/pull/572 master -- https://github.com/appcelerator/alloy/pull/573 Functional tests: * Run the attached app & follow steps to reproduce. The app should output the expected values * Run the ALOY\-1051 test app. Clicking the label should alert the properly merged style values * Run the advanced/complex_styling app and all font styles should be properly merged and displayed
  6. Praveen Innamuri 2014-09-23

    Merged PRs.
  7. Feon Sua Xin Miao 2014-09-24

    Merged PRs: Master: https://github.com/appcelerator/alloy/pull/575 1_5_X: https://github.com/appcelerator/alloy/pull/576
  8. Visalakshi Chidambaram 2014-09-24

    When I run the attached project now with alloy 1.5.0 -rc4 taken from : git://github.com/appcelerator/alloy.git#1_5_X I am able to see the following result:
       
       [INFO] :   {"font":{"fontFamily":"AmericanTypewriter","fontSize":50},"duration":1000,"classes":["family","size"]}
       [INFO] :   {"type":1,"minDate":"2012-01-01T00:00:00.000Z","maxDate":"2014-05-01T04:00:00.000Z","value":"2014-04-15T04:00:00.000Z","classes":["test","pickerClass"]}
       [INFO] :   {"type":1,"id":"pickerTest","value":"2014-04-15T04:00:00.000Z","horizontalWrap":true,"minDate":"2012-01-01T00:00:00.000Z","columns":[],"maxDate":"2014-05-01T04:00:00.000Z"}
       [INFO] :   {"backgroundColor":"blue","width":"90%","height":50,"bottom":0,"pippo":"tanto pippo test, 22343","classes":["test2","viewClass"]}
       
       
    Hence, able to see the expected results.
  9. Federico Casali 2014-09-25

    Verified fixed. TiSDK 3.4.0.v20140924140915 Appcelerator Studio 3.4.0.201409231834 CLI 3.4.0-rc4 Alloy 1.5.0-rc4 Xcode6 iPad mini & iPhone 5 (iOS 8) and Android Galaxy Nexus 4.3 Closing.
  10. Tim Poulsen 2014-09-26

    Added story points

JSON Source