Titanium JIRA Archive
Alloy (ALOY)

[ALOY-496] Alloy: formFactor attribute wrong behaviors

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-02-06T00:06:31.000+0000
Affected Version/sAlloy 1.0.0
Fix Version/s2013 Sprint 03
ComponentsSamples & Templates, Titanium SDK
Labelsqe-sdk3.0.2
ReporterFederico Casali
AssigneeTony Lukasavage
Created2013-02-05T00:37:41.000+0000
Updated2014-06-22T13:21:03.000+0000

Description

Problem

setting 'formFactor' attribute, does not always generate the intended behavior

Steps to reproduce

(code taken from "advanced/device_query", modifying formFactor attributes for the handheld devices)
"#osLabel": {
	text: "Generic"
},
"#osLabel[platform=ios]": {
	text: "iOS device\n(size unknown)"
},
"#osLabel[platform=ios formFactor=tablet]": {
	text: "iPad"
},
"#osLabel[platform=ios formFactor=foo]": {
	text: "iPhone"
},
"#osLabel[platform=android formFactor=bar]": {
	text: "AndroidPhone",
	color: "#000"
},
"#osLabel[platform=android formFactor=tablet]": {
	text: "AndroidTablet",
	color: "#000"
},
Results: . iPhone: always displaying 'iPhone' text, also when setting anything as 'formFactor' and different than 'tablet' . iPad: works fine, displaying 'iPad' text only when setting 'tablet' word as 'formFactor' . Android Phone and Tablets: Always displaying the text associated to the Conditional Code part if a 'formFactor' attribute is set with any value. However, if only 'formFactor=tablet' is specified (commenting out the 'formFactor=bar' part), the condition is not satisfied and the 'Generic' text is displayed, even on tablets. i.e. in the sample code, run on tablet devices, 'Android' text is always displayed instead of 'Android\nTablet'

Comments

  1. Tony Lukasavage 2013-02-05

    I don't think it's worth inspecting the unexpected behavior of misusing the formFactor attribute in device queries personally. Does it ever actually fail when used properly? Do we really need to dig into this one as it is documented?
  2. Federico Casali 2013-02-05

    When used properly (i.e. using the original 'advanced/device_query' Sample code), it fails for Android Tablets, always detected just as 'Android'. Not been able to correctly detect Android Tablet.
       "#osLabel[platform=android]": {
       	text: "Android",
       	color: "#000"
       },
       "#osLabel[platform=android formFactor=tablet]": {
       	text: "Android\nTablet",
       	color: "#000"
       },
       
  3. Tony Lukasavage 2013-02-05

    I can't reproduce the issue with the advanced/device_query app. Just tested on emulator against 2 separate android tablets and they both show the styles for android tablet. Any more details on how you ran this or can i close the ticket?
  4. Tony Lukasavage 2013-02-06

    This is caused by the same issue in ALOY-497
  5. Federico Casali 2013-02-07

    Verified as fixed with the latest 1_0_X version (Git commit b97ead593b6e7c2b2a3beae4cb9a8720dd3931b6) All JS files are regenerated on each build.

JSON Source