Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1132

'testing/ALOY-1058' sample code is using quoted type value

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Alloy 1.5.0, Alloy 1.4.1
    • Fix Version/s: Alloy 1.7.0
    • Component/s: Samples & Templates
    • Labels:
    • Environment:

      TiSDK 3.4.0.v20140903121714
      Appcelerator Studio 3.4.0.201409032106
      CLI 3.4.0-beta
      Alloy 1.5.0-beta2
      Xcode6-beta7

    • Story Points:
      2
    • Sprint:
      2014 Sprint 19 Alloy

      Description

      Problem description

      Sample code for ALOY-1058 is using a value for the type property with quotes, while, setting the type from the TSS, it should be used with no quotes.
      Not a regression.

      From the sample code "index.tss", type is defined in this way:

      "#picker":{
      	type:"Ti.UI.PICKER_TYPE_DATE"
      }
      

      while type should be:

      type: Ti.UI.PICKER_TYPE_DATE
      

      Steps to reproduce

      1. Run the sample code
      Result: Running the sample, the picker is actually showing DATE as a type when run, but the constant values should be used with no quotes in the TSS.
      Here is the compiled code from Resources/iphone/alloy/controller/index.js:

        $.__views.picker = Ti.UI.createPicker({
              type: "Ti.UI.PICKER_TYPE_DATE",
              id: "picker",
              minDate: new Date("Tue Apr 01 2014 00:00:00 GMT-0700 (PDT)"),
              maxDate: new Date("Thu May 01 2014 12:00:00 GMT-0700 (PDT)"),
              value: new Date("Tue Apr 15 2014 12:00:00 GMT-0700 (PDT)")
          });
      

      2. Change index.tss picker stile to:

      "#picker":{
      	type:Ti.UI.PICKER_TYPE_DATE_AND_TIME
      }
      

      Result: compiled code is:

         $.__views.picker = Ti.UI.createPicker({
              type: "Ti.UI.PICKER_TYPE_DATE_AND_TIME",
              id: "picker",
              minDate: new Date("Tue Apr 01 2014 00:00:00 GMT-0700 (PDT)"),
              maxDate: new Date("Thu May 01 2014 12:00:00 GMT-0700 (PDT)"),
              value: new Date("Tue Apr 15 2014 12:00:00 GMT-0700 (PDT)")
          });
      

      However, DATE type picker is still shown (not DATE_AND_TIME).
      Considering the generated code, this could be a behavior issue relative to how SDK is handling the Picker type property, not Alloy. Investigating and creating a Classic Titanium sample.

      3. Change the picker style to:

      "#picker":{
      	type:Ti.UI.PICKER_TYPE_DATE_AND_TIME
      }
      

      Result: Picker DATE_AND_STYLE is shown. Compiled code also looks good:

       $.__views.picker = Ti.UI.createPicker({
              type: Ti.UI.PICKER_TYPE_DATE_AND_TIME,
              id: "picker",
              minDate: new Date("Tue Apr 01 2014 00:00:00 GMT-0700 (PDT)"),
              maxDate: new Date("Thu May 01 2014 12:00:00 GMT-0700 (PDT)"),
              value: new Date("Tue Apr 15 2014 12:00:00 GMT-0700 (PDT)")
          });
      

      Note

      My suggestion for the sample is to use the DATE_AND_TIME picker as type in case of iOS.
      i.e.

      "#picker":{
      	type:Ti.UI.PICKER_TYPE_DATE
      }
       
      "#picker[platform=ios]":{
      	type:Ti.UI.PICKER_TYPE_DATE_AND_TIME
      }
      

        Attachments

          Activity

            People

            • Assignee:
              skypanther Tim Poulsen
              Reporter:
              fcasali Federico Casali
              Reviewer:
              Feon Sua Xin Miao
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration